Skip to content

Commit 29ecb21

Browse files
committed
Use lowercasing
1 parent 9a21f76 commit 29ecb21

File tree

12 files changed

+57
-367
lines changed

12 files changed

+57
-367
lines changed

build.gradle.kts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Dependencies {
3636
val mixinsquaredVersion = property("deps.mixinsquared_version") as String?
3737
val lombokVersion = property("deps.lombok_version") as String?
3838
val lightConfigVersion = property("deps.lightconfig_version") as String?
39+
val lowercasingVersion = property("deps.lowercasing_version") as String?
3940
}
4041

4142
class LoaderData {
@@ -132,6 +133,7 @@ dependencies {
132133

133134
// LightConfig
134135
include(modImplementation("org.visuals.legacy:lightconfig:${deps.lightConfigVersion}-${mod.minecraftVersion}_${loader.name}")!!)
136+
include(modImplementation("btw.lowercase:lowercasing:${deps.lowercasingVersion}-${mod.minecraftVersion}_${loader.name}")!!)
135137

136138
include(implementation("com.moulberry:mixinconstraints:${deps.mixinconstraintsVersion}")!!)!!
137139
include(implementation(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-${loader.name}:${deps.mixinsquaredVersion}")!!)!!)
@@ -169,7 +171,7 @@ publishMods {
169171
}
170172

171173
displayName = "Release ${mod.version} for $niceVersionRangeTitle"
172-
this.version = mod.version.toString()
174+
this.version = mod.version
173175
changelog = project.rootProject.file("CHANGELOG.md").takeIf { it.exists() }?.readText() ?: "No changelog provided."
174176
type = STABLE
175177

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ deps.devauth_version=1.2.1
2525
deps.mixinconstraints_version=1.1.0
2626
deps.mixinsquared_version=0.2.0
2727
deps.lombok_version=1.18.42
28+
deps.lowercasing_version=1.0-beta.2
2829

2930
# Build Plugins
3031
# in libs.versions.toml

src/main/java/btw/lowercase/skyboxify/Skyboxify.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323

2424
package btw.lowercase.skyboxify;
2525

26+
import btw.lowercase.lowercasing.util.SimpleCodecs;
2627
import btw.lowercase.skyboxify.config.SkyboxifyConfig;
2728
import btw.lowercase.skyboxify.events.LevelTickEvent;
2829
import btw.lowercase.skyboxify.events.SkyRenderEvent;
2930
import btw.lowercase.skyboxify.skybox.*;
30-
import btw.lowercase.skyboxify.utils.ParserCodecs;
3131
import com.google.gson.JsonArray;
3232
import com.google.gson.JsonObject;
3333
import com.mojang.blaze3d.systems.RenderSystem;
@@ -139,8 +139,8 @@ private void parseSkyboxes(SkyboxResourceHelper skyboxResourceHelper, String sky
139139
final Matcher matcherId1 = skyPattern.matcher(id1);
140140
final Matcher matcherId2 = skyPattern.matcher(id2);
141141
if (matcherId1.find() && matcherId2.find()) {
142-
final int a = ParserCodecs.safeParseInteger(matcherId1.group("name").replace("sky", ""), -1);
143-
final int b = ParserCodecs.safeParseInteger(matcherId2.group("name").replace("sky", ""), -1);
142+
final int a = SimpleCodecs.safeParseInteger(matcherId1.group("name").replace("sky", ""), -1);
143+
final int b = SimpleCodecs.safeParseInteger(matcherId2.group("name").replace("sky", ""), -1);
144144
if (a >= 0 && b >= 0) {
145145
return a - b;
146146
}

src/main/java/btw/lowercase/skyboxify/skybox/SkyboxParser.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
package btw.lowercase.skyboxify.skybox;
2525

26+
import btw.lowercase.lowercasing.util.SimpleCodecs;
2627
import btw.lowercase.skyboxify.Skyboxify;
2728
import btw.lowercase.skyboxify.skybox.components.Range;
2829
import btw.lowercase.skyboxify.utils.CommonUtils;
@@ -66,7 +67,7 @@ private SkyboxParser() {
6667

6768
// Speed
6869
if (properties.containsKey("speed")) {
69-
final float value = ParserCodecs.safeParseFloat(properties.getProperty("speed", null), 1.0F);
70+
final float value = SimpleCodecs.safeParseFloat(properties.getProperty("speed", null), 1.0F);
7071
if (value != Float.MIN_VALUE) {
7172
output.addProperty("speed", value);
7273
} else {
@@ -120,8 +121,8 @@ private SkyboxParser() {
120121
private static int toTickTime(String time) {
121122
final String[] parts = time.trim().split(":");
122123
if (parts.length == 2) {
123-
final int m = ParserCodecs.safeParseInteger(parts[1], -1);
124-
int h = ParserCodecs.safeParseInteger(parts[0], -1);
124+
final int m = SimpleCodecs.safeParseInteger(parts[1], -1);
125+
int h = SimpleCodecs.safeParseInteger(parts[0], -1);
125126
if (h >= 0 && h <= 23 && m >= 0 && m <= 59) {
126127
h -= 6;
127128
if (h < 0) {
@@ -167,7 +168,7 @@ private static void parseDaysLoop(String days, String daysLoop, JsonObject outpu
167168
final List<Range> rangeEntries = ParserCodecs.getRangeEntriesCodec(false).orElse(List.of()).parse(JavaOps.INSTANCE, days).getOrThrow();
168169
if (!rangeEntries.isEmpty()) {
169170
final JsonObject loop = new JsonObject();
170-
loop.addProperty("days", daysLoop == null ? 8 : ParserCodecs.safeParseInteger(daysLoop, 8));
171+
loop.addProperty("days", daysLoop == null ? 8 : SimpleCodecs.safeParseInteger(daysLoop, 8));
171172

172173
final JsonArray ranges = new JsonArray();
173174
rangeEntries.stream().map(range -> Range.CODEC.encode(range, JsonOps.INSTANCE, new JsonObject()).getOrThrow()).forEach(ranges::add);

src/main/java/btw/lowercase/skyboxify/skybox/SkyboxSkyRenderer.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
package btw.lowercase.skyboxify.skybox;
2525

26+
import btw.lowercase.lowercasing.util.rendering.BlendFunction;
27+
import btw.lowercase.lowercasing.util.rendering.Renderer;
2628
import btw.lowercase.skyboxify.mixins.RenderPipelinesAccessor;
2729
import btw.lowercase.skyboxify.skybox.components.UVRange;
2830
import btw.lowercase.skyboxify.utils.*;
@@ -149,17 +151,17 @@ private void renderSkyLayer(final SkyLayer skyLayer, final Matrix4f modelViewMat
149151
final Vector4f shaderColor = skyLayer.blend().getShaderColor(finalAlpha);
150152

151153
//? >=1.21.6 {
152-
final com.mojang.blaze3d.buffers.GpuBufferSlice transforms = DynamicTransformsBuilder.of()
154+
final com.mojang.blaze3d.buffers.GpuBufferSlice transforms = new Renderer.DynamicTransforms()
153155
.withModelViewMatrix(modelViewMatrix)
154156
.withShaderColor(shaderColor)
155-
.build();
157+
.buffer();
156158
//?} else {
157159
/*RenderSystem.setShaderColor(shaderColor.x, shaderColor.y, shaderColor.z, shaderColor.w);
158160
*///?}
159161

160162
final com.mojang.blaze3d.pipeline.RenderPipeline renderPipeline = this.renderPipelineCache.computeIfAbsent(skyLayer.source(), (resourceLocation) -> {
161163
com.mojang.blaze3d.pipeline.RenderPipeline pipeline = getSkyboxPipeline(skyLayer.blend().getBlendFunction());
162-
IrisUtil.assignPipeline(pipeline, IrisPipeline.SKY_TEXTURED);
164+
btw.lowercase.lowercasing.util.compatibility.IrisUtil.assignPipeline(pipeline, btw.lowercase.lowercasing.util.compatibility.IrisPipeline.SKY_TEXTURED);
163165
return pipeline;
164166
});
165167

src/main/java/btw/lowercase/skyboxify/skybox/components/Biomes.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
package btw.lowercase.skyboxify.skybox.components;
2525

26-
import btw.lowercase.skyboxify.utils.ParserCodecs;
26+
import btw.lowercase.lowercasing.util.SimpleCodecs;
2727
import com.google.common.collect.ImmutableList;
2828
import com.mojang.serialization.Codec;
2929
import com.mojang.serialization.JavaOps;
@@ -34,19 +34,19 @@
3434
public record Biomes(ImmutableList<ResourceLocation> locations, boolean inclusion) {
3535
public static Biomes DEFAULT = new Biomes(ImmutableList.of(), true);
3636

37-
public static Codec<Biomes> CODEC = ParserCodecs.TRIMMED_STRING.xmap(input -> {
37+
public static Codec<Biomes> CODEC = SimpleCodecs.TRIMMED_STRING.xmap(input -> {
3838
final boolean inclusion = !input.startsWith("!");
3939
if (!inclusion) {
4040
input = input.substring(1);
4141
}
4242

43-
final List<String> entries = ParserCodecs.SPLIT_SPACE_TRIMMED.parse(JavaOps.INSTANCE, input).getOrThrow();
43+
final List<String> entries = SimpleCodecs.SPLIT_SPACE_TRIMMED.parse(JavaOps.INSTANCE, input).getOrThrow();
4444
if (!entries.isEmpty()) {
4545
final ImmutableList.Builder<ResourceLocation> builder = new ImmutableList.Builder<>();
4646
builder.addAll(entries.stream().filter(ResourceLocation::isValidPath).map(ResourceLocation::parse).toList());
4747
return new Biomes(builder.build(), inclusion);
4848
} else {
4949
return Biomes.DEFAULT;
5050
}
51-
}, ParserCodecs::emptyCodecString);
51+
}, SimpleCodecs::emptyCodecString);
5252
}

src/main/java/btw/lowercase/skyboxify/skybox/components/Blend.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
package btw.lowercase.skyboxify.skybox.components;
2525

26-
import btw.lowercase.skyboxify.utils.BlendFunction;
26+
import btw.lowercase.lowercasing.util.rendering.BlendFunction;
2727
import com.mojang.serialization.Codec;
2828
import lombok.Getter;
2929
import net.minecraft.util.StringRepresentable;
@@ -34,32 +34,32 @@
3434
import java.util.function.Function;
3535

3636
public enum Blend implements StringRepresentable {
37-
ADD(alpha -> new Vector4f(1.0F, 1.0F, 1.0F, alpha), new BlendFunction(GL11.GL_SRC_ALPHA, GL11.GL_ONE)),
38-
SUBTRACT(alpha -> new Vector4f(alpha, alpha, alpha, 1.0F), new BlendFunction(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ZERO)),
39-
MULTIPLY(alpha -> new Vector4f(alpha, alpha, alpha, alpha), new BlendFunction(GL11.GL_DST_COLOR, GL11.GL_ONE_MINUS_SRC_ALPHA)),
40-
DODGE(alpha -> new Vector4f(alpha, alpha, alpha, 1.0F), new BlendFunction(GL11.GL_ONE, GL11.GL_ONE)),
41-
BURN(alpha -> new Vector4f(alpha, alpha, alpha, 1.0F), new BlendFunction(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_COLOR)),
42-
SCREEN(alpha -> new Vector4f(alpha, alpha, alpha, 1.0F), new BlendFunction(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_COLOR)),
43-
REPLACE(alpha -> new Vector4f(1.0F, 1.0F, 1.0F, alpha), null),
44-
OVERLAY(alpha -> new Vector4f(alpha, alpha, alpha, 1.0F), new BlendFunction(GL11.GL_DST_COLOR, GL11.GL_SRC_COLOR)),
45-
ALPHA(alpha -> new Vector4f(1.0F, 1.0F, 1.0F, alpha), new BlendFunction(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA));
37+
ADD(alpha -> new Vector4f(1.0F, 1.0F, 1.0F, alpha), new BlendFunction(GL11.GL_SRC_ALPHA, GL11.GL_ONE)),
38+
SUBTRACT(alpha -> new Vector4f(alpha, alpha, alpha, 1.0F), new BlendFunction(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ZERO)),
39+
MULTIPLY(alpha -> new Vector4f(alpha, alpha, alpha, alpha), new BlendFunction(GL11.GL_DST_COLOR, GL11.GL_ONE_MINUS_SRC_ALPHA)),
40+
DODGE(alpha -> new Vector4f(alpha, alpha, alpha, 1.0F), new BlendFunction(GL11.GL_ONE, GL11.GL_ONE)),
41+
BURN(alpha -> new Vector4f(alpha, alpha, alpha, 1.0F), new BlendFunction(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_COLOR)),
42+
SCREEN(alpha -> new Vector4f(alpha, alpha, alpha, 1.0F), new BlendFunction(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_COLOR)),
43+
REPLACE(alpha -> new Vector4f(1.0F, 1.0F, 1.0F, alpha), null),
44+
OVERLAY(alpha -> new Vector4f(alpha, alpha, alpha, 1.0F), new BlendFunction(GL11.GL_DST_COLOR, GL11.GL_SRC_COLOR)),
45+
ALPHA(alpha -> new Vector4f(1.0F, 1.0F, 1.0F, alpha), new BlendFunction(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA));
4646

47-
public static final Codec<Blend> CODEC = StringRepresentable.fromEnum(Blend::values).orElse(Blend.ADD);
47+
public static final Codec<Blend> CODEC = StringRepresentable.fromEnum(Blend::values).orElse(Blend.ADD);
4848

49-
private final Function<Float, Vector4f> blendConsumer;
50-
@Getter
51-
private final BlendFunction blendFunction;
49+
private final Function<Float, Vector4f> blendConsumer;
50+
@Getter
51+
private final BlendFunction blendFunction;
5252

53-
Blend(Function<Float, Vector4f> blendConsumer, BlendFunction blendFunction) {
54-
this.blendConsumer = blendConsumer;
55-
this.blendFunction = blendFunction;
56-
}
53+
Blend(Function<Float, Vector4f> blendConsumer, BlendFunction blendFunction) {
54+
this.blendConsumer = blendConsumer;
55+
this.blendFunction = blendFunction;
56+
}
5757

58-
public Vector4f getShaderColor(float value) {
59-
return this.blendConsumer.apply(value);
60-
}
58+
public Vector4f getShaderColor(float value) {
59+
return this.blendConsumer.apply(value);
60+
}
6161

62-
//? <=1.21.4 {
62+
//? <=1.21.4 {
6363
/*public void apply(float value) {
6464
final Vector4f shaderColor = getShaderColor(value);
6565
com.mojang.blaze3d.systems.RenderSystem.setShaderColor(shaderColor.x, shaderColor.y, shaderColor.z, shaderColor.w);
@@ -72,8 +72,8 @@ public Vector4f getShaderColor(float value) {
7272
}
7373
*///?}
7474

75-
@Override
76-
public @NotNull String getSerializedName() {
77-
return this.name().toLowerCase();
78-
}
75+
@Override
76+
public @NotNull String getSerializedName() {
77+
return this.name().toLowerCase();
78+
}
7979
}

src/main/java/btw/lowercase/skyboxify/utils/BlendFunction.java

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/main/java/btw/lowercase/skyboxify/utils/DynamicTransformsBuilder.java

Lines changed: 0 additions & 92 deletions
This file was deleted.

0 commit comments

Comments
 (0)