diff --git a/build.gradle.kts b/build.gradle.kts index b5f423d0..e890cec4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,12 +1,12 @@ plugins { id("java") - id("fabric-loom") version ("1.7.2") apply (false) + id("fabric-loom") version ("1.8.9") apply (false) } -val MINECRAFT_VERSION by extra { "1.21.1" } -val NEOFORGE_VERSION by extra { "21.1.23" } -val FABRIC_LOADER_VERSION by extra { "0.16.2" } -val FABRIC_API_VERSION by extra { "0.102.1+1.21.1" } +val MINECRAFT_VERSION by extra { "1.21.3" } +val NEOFORGE_VERSION by extra { "21.3.0-beta" } +val FABRIC_LOADER_VERSION by extra { "0.16.7" } +val FABRIC_API_VERSION by extra { "0.106.1+1.21.2" } // This value can be set to null to disable Parchment. val PARCHMENT_VERSION by extra { null } @@ -14,8 +14,8 @@ val PARCHMENT_VERSION by extra { null } // https://semver.org/ val MAVEN_GROUP by extra { "me.flashyreese.mods" } val ARCHIVE_NAME by extra { "sodium-extra" } -val MOD_VERSION by extra { "0.6.0-beta.3" } -val SODIUM_VERSION by extra { "mc1.21-0.6.0-beta.2" } +val MOD_VERSION by extra { "0.6.0-beta.4" } +val SODIUM_VERSION by extra { "mc1.21.2-0.6.0-beta.3" } allprojects { apply(plugin = "java") @@ -34,6 +34,7 @@ subprojects { repositories { maven("https://maven.parchmentmc.org/") maven("https://api.modrinth.com/maven") + maven("https://libraries.minecraft.net") } base { diff --git a/common/build.gradle.kts b/common/build.gradle.kts index f6f2953e..37c621f9 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -3,7 +3,7 @@ import net.fabricmc.loom.task.AbstractRemapJarTask plugins { id("java") id("idea") - id("fabric-loom") version "1.7.2" + id("fabric-loom") version "1.8.9" } val MINECRAFT_VERSION: String by rootProject.extra diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java index 5358c957..c69ab0e0 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/SodiumExtraClientMod.java @@ -51,10 +51,8 @@ public static CaffeineConfig mixinConfig() { .addMixinOption("optimizations", true) .addMixinOption("optimizations.beacon_beam_rendering", true) .addMixinOption("optimizations.draw_helpers", false) - .addMixinOption("optimizations.fast_weather", false) .addMixinOption("particle", true) .addMixinOption("prevent_shaders", true) - .addMixinOption("profiler", true) .addMixinOption("reduce_resolution_on_mac", true) .addMixinOption("render", true) .addMixinOption("render.block", true) diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptionPages.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptionPages.java index 5894bd47..4ca52f66 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptionPages.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptionPages.java @@ -187,11 +187,17 @@ public static OptionPage detail() { ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sun_moon").isEnabled()) - .setName(Component.translatable("sodium-extra.option.sun_moon")) - .setTooltip(Component.translatable("sodium-extra.option.sun_moon.tooltip")) + .setName(Component.translatable("sodium-extra.option.sun")) + .setTooltip(Component.translatable("sodium-extra.option.sun.tooltip")) .setControl(TickBoxControl::new) - .setBinding((opts, value) -> opts.detailSettings.sunMoon = value, opts -> opts.detailSettings.sunMoon) - .setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD) + .setBinding((opts, value) -> opts.detailSettings.sun = value, opts -> opts.detailSettings.sun) + .build() + ).add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) + .setEnabled(() -> SodiumExtraClientMod.mixinConfig().getOptions().get("mixin.sun_moon").isEnabled()) + .setName(Component.translatable("sodium-extra.option.moon")) + .setTooltip(Component.translatable("sodium-extra.option.moon.tooltip")) + .setControl(TickBoxControl::new) + .setBinding((opts, value) -> opts.detailSettings.moon = value, opts -> opts.detailSettings.moon) .build() ) .add(OptionImpl.createBuilder(boolean.class, sodiumExtraOpts) diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptions.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptions.java index b4c50da3..9a3eb26b 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptions.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/SodiumExtraGameOptions.java @@ -173,7 +173,8 @@ public ParticleSettings() { public static class DetailSettings { public boolean sky; - public boolean sunMoon; + public boolean sun; + public boolean moon; public boolean stars; public boolean rainSnow; public boolean biomeColors; @@ -181,7 +182,8 @@ public static class DetailSettings { public DetailSettings() { this.sky = true; - this.sunMoon = true; + this.sun = true; + this.moon = true; this.stars = true; this.rainSnow = true; this.biomeColors = true; diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/scrollable_page/AbstractFrame.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/scrollable_page/AbstractFrame.java index 1ebfa874..bd7764e6 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/scrollable_page/AbstractFrame.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/scrollable_page/AbstractFrame.java @@ -1,10 +1,8 @@ package me.flashyreese.mods.sodiumextra.client.gui.scrollable_page; -import com.mojang.blaze3d.systems.RenderSystem; import net.caffeinemc.mods.sodium.client.gui.options.control.ControlElement; import net.caffeinemc.mods.sodium.client.gui.widgets.AbstractWidget; import net.caffeinemc.mods.sodium.client.util.Dim2i; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ComponentPath; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Renderable; @@ -12,6 +10,7 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.navigation.FocusNavigationEvent; import net.minecraft.client.gui.navigation.ScreenRectangle; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -20,7 +19,6 @@ public abstract class AbstractFrame extends AbstractWidget implements ContainerEventHandler { protected final Dim2i dim; protected final List children = new ArrayList<>(); - protected final List renderable = new ArrayList<>(); protected final List> controlElements = new ArrayList<>(); private GuiEventListener focused; private boolean dragging; @@ -31,31 +29,26 @@ public AbstractFrame(Dim2i dim) { public void buildFrame() { for (GuiEventListener element : this.children) { - if (element instanceof AbstractFrame) { - this.controlElements.addAll(((AbstractFrame) element).controlElements); + if (element instanceof AbstractFrame abstractFrame) { + this.controlElements.addAll(abstractFrame.controlElements); } if (element instanceof ControlElement) { this.controlElements.add((ControlElement) element); } - if (element instanceof Renderable) { - this.renderable.add((Renderable) element); - } } } @Override - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta) { - for (Renderable renderable : this.renderable) { + public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float delta) { + for (Renderable renderable : this.children) { renderable.render(guiGraphics, mouseX, mouseY, delta); } } - public void applyScissor(int x, int y, int width, int height, Runnable action) { - double scale = Minecraft.getInstance().getWindow().getGuiScale(); - RenderSystem.enableScissor((int) (x * scale), (int) (Minecraft.getInstance().getWindow().getHeight() - (y + height) * scale), - (int) (width * scale), (int) (height * scale)); + public void applyScissor(@NotNull GuiGraphics guiGraphics, int x, int y, int width, int height, Runnable action) { + guiGraphics.enableScissor(x, y, x + width, y + height); action.run(); - RenderSystem.disableScissor(); + guiGraphics.disableScissor(); } @Override diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/scrollable_page/OptionPageScrollFrame.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/scrollable_page/OptionPageScrollFrame.java index e4745532..58231fac 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/scrollable_page/OptionPageScrollFrame.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/client/gui/scrollable_page/OptionPageScrollFrame.java @@ -13,6 +13,7 @@ import net.minecraft.locale.Language; import net.minecraft.network.chat.Component; import net.minecraft.util.FormattedCharSequence; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -31,7 +32,6 @@ public OptionPageScrollFrame(Dim2i dim, OptionPage page) { public void setupFrame() { this.children.clear(); - this.renderable.clear(); this.controlElements.clear(); int y = 0; @@ -57,7 +57,6 @@ public void buildFrame() { if (this.page == null) return; this.children.clear(); - this.renderable.clear(); this.controlElements.clear(); int y = 0; @@ -84,7 +83,7 @@ public void buildFrame() { } @Override - public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta) { + public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float delta) { ControlElement hoveredElement = this.controlElements.stream() .filter(ControlElement::isHovered) .findFirst() @@ -92,7 +91,7 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta) .filter(ControlElement::isFocused) .findFirst() .orElse(null)); - this.applyScissor(this.dim.x(), this.dim.y(), this.dim.width(), this.dim.height(), () -> super.render(guiGraphics, mouseX, mouseY, delta)); + this.applyScissor(guiGraphics, this.dim.x(), this.dim.y(), this.dim.width(), this.dim.height(), () -> super.render(guiGraphics, mouseX, mouseY, delta)); if (this.canScroll) { this.scrollBar.render(guiGraphics, mouseX, mouseY, delta); } diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/fog/MixinFogRenderer.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/fog/MixinFogRenderer.java index df70b50b..f4467b19 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/fog/MixinFogRenderer.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/fog/MixinFogRenderer.java @@ -1,28 +1,29 @@ package me.flashyreese.mods.sodiumextra.mixin.fog; -import com.mojang.blaze3d.systems.RenderSystem; import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; import net.minecraft.client.Camera; +import net.minecraft.client.renderer.FogParameters; import net.minecraft.client.renderer.FogRenderer; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.material.FogType; import org.jetbrains.annotations.Nullable; +import org.joml.Vector4f; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(FogRenderer.class) public abstract class MixinFogRenderer { @Shadow @Nullable - protected static FogRenderer.MobEffectFogFunction getPriorityFogFunction(Entity entity, float f) { + private static FogRenderer.MobEffectFogFunction getPriorityFogFunction(Entity entity, float f) { return null; } - @Inject(method = "setupFog", at = @At(value = "TAIL")) - private static void applyFog(Camera camera, FogRenderer.FogMode fogType, float viewDistance, boolean thickFog, float tickDelta, CallbackInfo ci) { + @Inject(method = "setupFog", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/FogParameters;(FFLcom/mojang/blaze3d/shaders/FogShape;FFFF)V", shift = At.Shift.AFTER), cancellable = true) + private static void applyFog(Camera camera, FogRenderer.FogMode fogMode, Vector4f vector4f, float f, boolean thickFog, float tickDelta, CallbackInfoReturnable cir) { Entity entity = camera.getEntity(); SodiumExtraClientMod.options().renderSettings.dimensionFogDistanceMap.putIfAbsent(entity.level().dimensionType().effectsLocation(), 0); int fogDistance = SodiumExtraClientMod.options().renderSettings.multiDimensionFogControl ? SodiumExtraClientMod.options().renderSettings.dimensionFogDistanceMap.get(entity.level().dimensionType().effectsLocation()) : SodiumExtraClientMod.options().renderSettings.fogDistance; @@ -30,15 +31,14 @@ private static void applyFog(Camera camera, FogRenderer.FogMode fogType, float v if (fogDistance == 0 || mobEffectFogFunction != null) { return; } - if (camera.getFluidInCamera() == FogType.NONE && (thickFog || fogType == FogRenderer.FogMode.FOG_TERRAIN)) { + if (camera.getFluidInCamera() == FogType.NONE && (thickFog || fogMode == FogRenderer.FogMode.FOG_TERRAIN)) { float fogStart = (float) SodiumExtraClientMod.options().renderSettings.fogStart / 100; if (fogDistance == 33) { - RenderSystem.setShaderFogColor(1f, 1f, 1f, 0f); - //RenderSystem.setShaderFogStart(Short.MAX_VALUE - 1 * fogStart); - //RenderSystem.setShaderFogEnd(Short.MAX_VALUE); + cir.setReturnValue(FogParameters.NO_FOG); } else { - RenderSystem.setShaderFogStart(fogDistance * 16 * fogStart); - RenderSystem.setShaderFogEnd((fogDistance + 1) * 16); + FogParameters ci = cir.getReturnValue(); + FogParameters newFogParameters = new FogParameters(fogDistance * 16 * fogStart, (fogDistance + 1) * 16, ci.shape(), ci.red(), ci.green(), ci.blue(), ci.alpha()); + cir.setReturnValue(newFogParameters); } } } diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/fog_falloff/MixinFogRenderer.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/fog_falloff/MixinFogRenderer.java index 2a7d20e1..58ac9dfc 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/fog_falloff/MixinFogRenderer.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/fog_falloff/MixinFogRenderer.java @@ -8,9 +8,8 @@ @Mixin(FogRenderer.class) public class MixinFogRenderer { - @ModifyArg(method = "setupFog", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderFogStart(F)V"), index = 0) - private static float modifySetShaderFogStart(float original) { - float fogStart = (float) SodiumExtraClientMod.options().renderSettings.fogStart / 100; - return original * fogStart; + @ModifyArg(method = "setupFog", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/FogParameters;(FFLcom/mojang/blaze3d/shaders/FogShape;FFFF)V"), index = 0) + private static float setupFog(float fogStart) { + return fogStart * ((float) SodiumExtraClientMod.options().renderSettings.fogStart / 100); } } diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/optimizations/draw_helpers/MixinGuiGraphics.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/optimizations/draw_helpers/MixinGuiGraphics.java index 66e7abf2..41ff6b0a 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/optimizations/draw_helpers/MixinGuiGraphics.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/optimizations/draw_helpers/MixinGuiGraphics.java @@ -22,6 +22,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.function.Function; + @Mixin(value = GuiGraphics.class, priority = 1500) public abstract class MixinGuiGraphics { @@ -33,10 +35,6 @@ public abstract class MixinGuiGraphics { @Final private MultiBufferSource.BufferSource bufferSource; - @Shadow - @Deprecated - protected abstract void flushIfUnmanaged(); - /** * @author FlashyReese * @reason Impl Sodium's vertex writer @@ -107,7 +105,6 @@ public void fill(RenderType type, int x1, int y1, int x2, int y2, int z, int col writer.push(stack, buffer, 4, ColorVertex.FORMAT); } - this.flushIfUnmanaged(); ci.cancel(); } @@ -116,68 +113,35 @@ public void fill(RenderType type, int x1, int y1, int x2, int y2, int z, int col * @author FlashyReese * @reason Impl Sodium's vertex writer */ - @Inject(method = "innerBlit(Lnet/minecraft/resources/ResourceLocation;IIIIIFFFF)V", at = @At(value = "HEAD"), cancellable = true) - public void drawTexturedQuad(ResourceLocation texture, int x1, int x2, int y1, int y2, int z, float u1, float u2, float v1, float v2, CallbackInfo ci) { - RenderSystem.setShaderTexture(0, texture); - RenderSystem.setShader(GameRenderer::getPositionTexShader); + @Inject(method = "innerBlit", at = @At(value = "HEAD"), cancellable = true) + public void innerBlit(Function function, ResourceLocation resourceLocation, int x1, int x2, int y1, int y2, float u1, float u2, float v1, float v2, int color, CallbackInfo ci) { + RenderType renderType = function.apply(resourceLocation); Matrix4f matrix4f = this.pose.last().pose(); - BufferBuilder bufferBuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - VertexBufferWriter writer = VertexBufferWriter.of(bufferBuilder); + VertexConsumer vertexConsumer = this.bufferSource.getBuffer(renderType); + vertexConsumer.addVertex(matrix4f, (float)x1, (float)y1, 0.0F).setUv(u1, v1).setColor(color); + vertexConsumer.addVertex(matrix4f, (float)x1, (float)y2, 0.0F).setUv(u1, v2).setColor(color); + vertexConsumer.addVertex(matrix4f, (float)x2, (float)y2, 0.0F).setUv(u2, v2).setColor(color); + vertexConsumer.addVertex(matrix4f, (float)x2, (float)y1, 0.0F).setUv(u2, v1).setColor(color); + + VertexBufferWriter writer = VertexBufferWriter.of(vertexConsumer); try (MemoryStack stack = MemoryStack.stackPush()) { final long buffer = stack.nmalloc(4 * TextureVertex.STRIDE); long ptr = buffer; - TextureVertex.write(ptr, matrix4f, x1, y1, z, u1, v1); + TextureVertex.write(ptr, matrix4f, x1, y1, 0.0F, u1, v1); ptr += TextureVertex.STRIDE; - TextureVertex.write(ptr, matrix4f, x1, y2, z, u1, v2); + TextureVertex.write(ptr, matrix4f, x1, y2, 0.0F, u1, v2); ptr += TextureVertex.STRIDE; - TextureVertex.write(ptr, matrix4f, x2, y2, z, u2, v2); + TextureVertex.write(ptr, matrix4f, x2, y2, 0.0F, u2, v2); ptr += TextureVertex.STRIDE; - TextureVertex.write(ptr, matrix4f, x2, y1, z, u2, v1); + TextureVertex.write(ptr, matrix4f, x2, y1, 0.0F, u2, v1); ptr += TextureVertex.STRIDE; writer.push(stack, buffer, 4, TextureVertex.FORMAT); } - BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); - ci.cancel(); - } - - /** - * @author FlashyReese - * @reason Impl Sodium's vertex writer - */ - @Inject(method = "innerBlit(Lnet/minecraft/resources/ResourceLocation;IIIIIFFFFFFFF)V", at = @At(value = "HEAD"), cancellable = true) - public void drawTexturedQuad(ResourceLocation texture, int x1, int x2, int y1, int y2, int z, float u1, float u2, float v1, float v2, float red, float green, float blue, float alpha, CallbackInfo ci) { - RenderSystem.setShaderTexture(0, texture); - RenderSystem.setShader(GameRenderer::getPositionTexColorShader); - RenderSystem.enableBlend(); - Matrix4f matrix4f = this.pose.last().pose(); - BufferBuilder bufferBuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); - VertexBufferWriter writer = VertexBufferWriter.of(bufferBuilder); - int color = ColorABGR.pack(red, green, blue, alpha); - try (MemoryStack stack = MemoryStack.stackPush()) { - final long buffer = stack.nmalloc(4 * TextureColorVertex.STRIDE); - long ptr = buffer; - - TextureColorVertex.write(ptr, matrix4f, x1, y1, z, color, u1, v1); - ptr += TextureColorVertex.STRIDE; - - TextureColorVertex.write(ptr, matrix4f, x1, y2, z, color, u1, v2); - ptr += TextureColorVertex.STRIDE; - - TextureColorVertex.write(ptr, matrix4f, x2, y2, z, color, u2, v2); - ptr += TextureColorVertex.STRIDE; - - TextureColorVertex.write(ptr, matrix4f, x2, y1, z, color, u2, v1); - ptr += TextureColorVertex.STRIDE; - - writer.push(stack, buffer, 4, TextureColorVertex.FORMAT); - } - BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); - RenderSystem.disableBlend(); ci.cancel(); } } diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/optimizations/fast_weather/MixinLevelRenderer.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/optimizations/fast_weather/MixinLevelRenderer.java deleted file mode 100644 index f9fa1bf5..00000000 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/optimizations/fast_weather/MixinLevelRenderer.java +++ /dev/null @@ -1,225 +0,0 @@ -package me.flashyreese.mods.sodiumextra.mixin.optimizations.fast_weather; - -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.*; -import it.unimi.dsi.fastutil.longs.Long2ReferenceMap; -import it.unimi.dsi.fastutil.longs.Long2ReferenceOpenHashMap; -import me.flashyreese.mods.sodiumextra.client.render.vertex.formats.WeatherVertex; -import me.flashyreese.mods.sodiumextra.common.util.Utils; -import net.caffeinemc.mods.sodium.api.util.ColorABGR; -import net.caffeinemc.mods.sodium.api.vertex.buffer.VertexBufferWriter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.LightTexture; -import net.minecraft.core.BlockPos; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.util.RandomSource; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.levelgen.Heightmap; -import org.lwjgl.system.MemoryStack; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(value = LevelRenderer.class, priority = 1500) -public class MixinLevelRenderer { - @Shadow - @Final - private static ResourceLocation RAIN_LOCATION; - @Shadow - @Final - private static ResourceLocation SNOW_LOCATION; - @Unique - private final Long2ReferenceMap biomeLong2ReferenceMap = new Long2ReferenceOpenHashMap<>(); - @Shadow - @Final - private Minecraft minecraft; - @Shadow - private int ticks; - @Shadow - @Final - private float[] rainSizeX; - @Shadow - @Final - private float[] rainSizeZ; - - - @Inject(method = "renderSnowAndRain", at = @At(value = "HEAD"), cancellable = true) - public void sodiumExtra$renderWeather(LightTexture lightTexture, float tickDelta, double cameraX, double cameraY, double cameraZ, CallbackInfo ci) { - assert this.minecraft.level != null; - float rainGradient = this.minecraft.level.getRainLevel(tickDelta); - if (rainGradient > 0.0F) { - lightTexture.turnOnLightLayer(); - Level world = this.minecraft.level; - int cameraPosX = Mth.floor(cameraX); - int cameraPosY = Mth.floor(cameraY); - int cameraPosZ = Mth.floor(cameraZ); - Tesselator tessellator = Tesselator.getInstance(); - BufferBuilder bufferBuilder = null; - RenderSystem.disableCull(); - RenderSystem.enableBlend(); - RenderSystem.enableDepthTest(); - int range = Minecraft.useFancyGraphics() ? 10 : 5; - - RenderSystem.depthMask(Minecraft.useShaderTransparency()); - int precipitationType = -1; - float time = (float) this.ticks + tickDelta; - RenderSystem.setShader(GameRenderer::getParticleShader); - BlockPos.MutableBlockPos mutable = new BlockPos.MutableBlockPos(); - - for (int z = cameraPosZ - range; z <= cameraPosZ + range; ++z) { - for (int x = cameraPosX - range; x <= cameraPosX + range; ++x) { - int positionIndex = (z - cameraPosZ + 16) * 32 + x - cameraPosX + 16; - double offsetX = (double) this.rainSizeX[positionIndex] * 0.5; - double offsetZ = (double) this.rainSizeZ[positionIndex] * 0.5; - mutable.set(x, cameraY, z); - - long biomePacked = Utils.packPosition(x, z); - Biome biome = this.biomeLong2ReferenceMap.computeIfAbsent(biomePacked, key -> world.getBiome(mutable).value()); - if (biome.hasPrecipitation()) { - int topY = world.getHeight(Heightmap.Types.MOTION_BLOCKING, x, z); - int minY = cameraPosY - range; - int maxY = cameraPosY + range; - if (minY < topY) { - minY = topY; - } - - if (maxY < topY) { - maxY = topY; - } - - int adjustedTopY = Math.max(topY, cameraPosY); - - if (minY != maxY) { - RandomSource random = RandomSource.create((long) x * x * 3121 + x * 45238971L ^ (long) z * z * 418711 + z * 13761L); - mutable.set(x, minY, z); - Biome.Precipitation precipitation = biome.getPrecipitationAt(mutable); - if (precipitation == Biome.Precipitation.RAIN) { - if (precipitationType != 0) { - if (precipitationType >= 0) { - BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); - } - - precipitationType = 0; - RenderSystem.setShaderTexture(0, RAIN_LOCATION); - bufferBuilder = tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); - } - - int ticksModulus = this.ticks & 131071; - int randomOffset = x * x * 3121 + x * 45238971 + z * z * 418711 + z * 13761 & 0xFF; - float dropLength = 3.0F + random.nextFloat(); - float dropTimeOffset = -((float) (ticksModulus + randomOffset) + tickDelta) / 32.0F * dropLength; - float dropTextureOffset = dropTimeOffset % 32.0F; - - double relativeX = (double) x + 0.5 - cameraX; - double relativeZ = (double) z + 0.5 - cameraZ; - float distance = (float) Math.sqrt(relativeX * relativeX + relativeZ * relativeZ) / (float) range; - float alpha = ((1.0F - distance * distance) * 0.5F + 0.5F) * rainGradient; - mutable.set(x, adjustedTopY, z); - int color = ColorABGR.pack(1.0F, 1.0F, 1.0F, alpha); - int light = LevelRenderer.getLightColor(world, mutable); - - VertexBufferWriter writer = VertexBufferWriter.of(bufferBuilder); - write(writer, cameraX, cameraY, cameraZ, x, z, offsetX, offsetZ, minY, maxY, 0, dropTextureOffset, color, light); - } else if (precipitation == Biome.Precipitation.SNOW) { - if (precipitationType != 1) { - if (precipitationType >= 0) { - BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); - } - - precipitationType = 1; - RenderSystem.setShaderTexture(0, SNOW_LOCATION); - bufferBuilder = tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); - } - - float snowFallSpeed = -((float) (this.ticks & 511) + tickDelta) / 512.0F; - float snowTextureOffsetX = (float) (random.nextDouble() + (double) time * 0.01 * (double) ((float) random.nextGaussian())); - float snowTextureOffsetY = (float) (random.nextDouble() + (double) (time * (float) random.nextGaussian()) * 0.001); - - double relativeX = (double) x + 0.5 - cameraX; - double relativeZ = (double) z + 0.5 - cameraZ; - float distance = (float) Math.sqrt(relativeX * relativeX + relativeZ * relativeZ) / (float) range; - float alpha = ((1.0F - distance * distance) * 0.3F + 0.5F) * rainGradient; - - mutable.set(x, adjustedTopY, z); - int light = LevelRenderer.getLightColor(world, mutable); - int blockLight = light >> 16 & (LightTexture.FULL_BLOCK | 65295); - int skyLight = light & (LightTexture.FULL_BLOCK | 65295); - int adjustedBlockLight = (blockLight * 3 + LightTexture.FULL_BLOCK) / 4; - int adjustedSkyLight = (skyLight * 3 + LightTexture.FULL_BLOCK) / 4; - - VertexBufferWriter writer = VertexBufferWriter.of(bufferBuilder); - int color = ColorABGR.pack(1.0F, 1.0F, 1.0F, alpha); - int packedLight = Utils.packLight(adjustedSkyLight, adjustedBlockLight); - write(writer, cameraX, cameraY, cameraZ, x, z, offsetX, offsetZ, minY, maxY, snowTextureOffsetX, snowFallSpeed + snowTextureOffsetY, color, packedLight); - } - } - } - } - } - - if (precipitationType >= 0) { - BufferUploader.drawWithShader(bufferBuilder.buildOrThrow()); - } - - RenderSystem.enableCull(); - RenderSystem.disableBlend(); - lightTexture.turnOffLightLayer(); - } - ci.cancel(); - } - - @Inject(method = "allChanged", at = @At(value = "TAIL")) - private void postReload(CallbackInfo ci) { - this.biomeLong2ReferenceMap.clear(); - } - - @Unique - private void write(VertexBufferWriter writer, double cameraX, double cameraY, double cameraZ, int x, int z, double offsetX, double offsetZ, int minY, int maxY, float textureOffsetX, float textureOffsetY, int color, int light) { - try (MemoryStack stack = MemoryStack.stackPush()) { - long buffer = stack.nmalloc(4 * WeatherVertex.STRIDE); - long ptr = buffer; - - WeatherVertex.put(ptr, - (float) ((double) x - cameraX - offsetX + 0.5), (float) ((double) maxY - cameraY), (float) ((double) z - cameraZ - offsetZ + 0.5), - 0.0F + textureOffsetX, (float) minY * 0.25F + textureOffsetY, - color, - light - ); - ptr += WeatherVertex.STRIDE; - - WeatherVertex.put(ptr, - (float) ((double) x - cameraX + offsetX + 0.5), (float) ((double) maxY - cameraY), (float) ((double) z - cameraZ + offsetZ + 0.5), - 1.0F + textureOffsetX, (float) minY * 0.25F + textureOffsetY, - color, - light - ); - ptr += WeatherVertex.STRIDE; - - WeatherVertex.put(ptr, - (float) ((double) x - cameraX + offsetX + 0.5), (float) ((double) minY - cameraY), (float) ((double) z - cameraZ + offsetZ + 0.5), - 1.0F + textureOffsetX, (float) maxY * 0.25F + textureOffsetY, - color, - light - ); - ptr += WeatherVertex.STRIDE; - - WeatherVertex.put(ptr, - (float) ((double) x - cameraX - offsetX + 0.5), (float) ((double) minY - cameraY), (float) ((double) z - cameraZ - offsetZ + 0.5), - 0.0F + textureOffsetX, (float) maxY * 0.25F + textureOffsetY, - color, - light - ); - ptr += WeatherVertex.STRIDE; - - writer.push(stack, buffer, 4, WeatherVertex.FORMAT); - } - } -} diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/particle/MixinLevelRenderer.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/particle/MixinLevelRenderer.java index 544f31d9..96b17980 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/particle/MixinLevelRenderer.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/particle/MixinLevelRenderer.java @@ -2,26 +2,30 @@ import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; import net.minecraft.client.Camera; -import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.WeatherEffectRenderer; +import net.minecraft.server.level.ParticleStatus; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(LevelRenderer.class) +@Mixin(WeatherEffectRenderer.class) public class MixinLevelRenderer { - @Inject(method = "tickRain", at = @At(value = "HEAD"), cancellable = true) - public void tickRainSplashing(Camera camera, CallbackInfo callbackInfo) { + @Inject(method = "tickRainParticles", at = @At(value = "HEAD"), cancellable = true) + public void tickRainSplashing(ClientLevel clientLevel, Camera camera, int i, ParticleStatus particleStatus, CallbackInfo ci) { if (!(SodiumExtraClientMod.options().particleSettings.particles && SodiumExtraClientMod.options().particleSettings.rainSplash)) { - callbackInfo.cancel(); + ci.cancel(); } } - @Inject(method = "renderSnowAndRain", at = @At(value = "HEAD"), cancellable = true) - private void renderWeather(LightTexture manager, float f, double d, double e, double g, CallbackInfo callbackInfo) { + @Inject(method = "render(Lnet/minecraft/world/level/Level;Lnet/minecraft/client/renderer/LightTexture;IFLnet/minecraft/world/phys/Vec3;)V", at = @At(value = "HEAD"), cancellable = true) + private void renderWeather(Level level, LightTexture lightTexture, int i, float f, Vec3 vec3, CallbackInfo ci) { if (!(SodiumExtraClientMod.options().detailSettings.rainSnow)) { - callbackInfo.cancel(); + ci.cancel(); } } } diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/prevent_shaders/MixinGameRenderer.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/prevent_shaders/MixinGameRenderer.java index 2c1040fe..e5cbdb8a 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/prevent_shaders/MixinGameRenderer.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/prevent_shaders/MixinGameRenderer.java @@ -18,7 +18,7 @@ private void preventShaders(CallbackInfo ci) { } } - @Inject(method = "loadEffect", at = @At("HEAD"), cancellable = true) + @Inject(method = "setPostEffect", at = @At("HEAD"), cancellable = true) private void dontLoadShader(ResourceLocation identifier, CallbackInfo ci) { if (SodiumExtraClientMod.options().extraSettings.preventShaders) { ci.cancel(); diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/profiler/MixinBlockEntityRenderDispatcher.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/profiler/MixinBlockEntityRenderDispatcher.java deleted file mode 100644 index 2833b785..00000000 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/profiler/MixinBlockEntityRenderDispatcher.java +++ /dev/null @@ -1,43 +0,0 @@ -package me.flashyreese.mods.sodiumextra.mixin.profiler; - -import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; -import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.entity.BlockEntity; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.WeakHashMap; - -@Mixin(BlockEntityRenderDispatcher.class) -public class MixinBlockEntityRenderDispatcher { - @Unique - private static final WeakHashMap, String> names = new WeakHashMap<>(); - - @Inject(at = @At("HEAD"), method = "setupAndRender") - private static void onRender(BlockEntityRenderer renderer, T blockEntity, float tickDelta, PoseStack matrices, MultiBufferSource vertexConsumers, CallbackInfo info) { - Level level = blockEntity.getLevel(); - if (level != null) { - String name = names.computeIfAbsent(renderer.getClass(), Class::getSimpleName); - if (!name.isEmpty()) { - level.getProfiler().push(name); - } - } - } - - @Inject(at = @At("TAIL"), method = "setupAndRender") - private static void afterRender(BlockEntityRenderer renderer, T blockEntity, float tickDelta, PoseStack matrices, MultiBufferSource vertexConsumers, CallbackInfo info) { - Level level = blockEntity.getLevel(); - if (level != null) { - String name = names.computeIfAbsent(renderer.getClass(), Class::getSimpleName); - if (!name.isEmpty()) { - level.getProfiler().pop(); - } - } - } -} \ No newline at end of file diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/profiler/MixinEntityRenderDispatcher.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/profiler/MixinEntityRenderDispatcher.java deleted file mode 100644 index 3ca010fb..00000000 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/profiler/MixinEntityRenderDispatcher.java +++ /dev/null @@ -1,45 +0,0 @@ -package me.flashyreese.mods.sodiumextra.mixin.profiler; - -import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.entity.EntityRenderDispatcher; -import net.minecraft.client.renderer.entity.EntityRenderer; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.Level; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.WeakHashMap; - -@Mixin(EntityRenderDispatcher.class) -public abstract class MixinEntityRenderDispatcher { - private static final WeakHashMap, String> names = new WeakHashMap<>(); - - @Shadow - public abstract EntityRenderer getRenderer(T entity); - - @Inject(at = @At("HEAD"), method = "render") - private void onRender(E entity, double x, double y, double z, float yaw, float tickDelta, PoseStack matrices, MultiBufferSource vertexConsumers, int light, CallbackInfo ci) { - Level level = entity.level(); - if (level != null) { - String name = names.computeIfAbsent(this.getRenderer(entity).getClass(), Class::getSimpleName); - if (!name.isEmpty()) { - level.getProfiler().push(name); - } - } - } - - @Inject(at = @At("TAIL"), method = "render") - private void afterRender(E entity, double x, double y, double z, float yaw, float tickDelta, PoseStack matrices, MultiBufferSource vertexConsumers, int light, CallbackInfo ci) { - Level level = entity.level(); - if (level != null) { - String name = names.computeIfAbsent(this.getRenderer(entity).getClass(), Class::getSimpleName); - if (!name.isEmpty()) { - level.getProfiler().pop(); - } - } - } -} \ No newline at end of file diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/block/entity/MixinBeaconRenderer.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/block/entity/MixinBeaconRenderer.java index 8bdc114e..57eb1d9c 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/block/entity/MixinBeaconRenderer.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/block/entity/MixinBeaconRenderer.java @@ -33,7 +33,7 @@ public void render(BeaconBlockEntity beaconBlockEntity, float f, PoseStack poseS private void modifyMaxY(PoseStack matrices, MultiBufferSource vertexConsumers, float tickDelta, long worldTime, int yOffset, int maxY, int color, BeaconBlockEntity beaconBlockEntity, float f, PoseStack matrixStack, MultiBufferSource vertexConsumerProvider, int i, int j) { if (maxY == 1024 && SodiumExtraClientMod.options().renderSettings.limitBeaconBeamHeight) { int lastSegment = beaconBlockEntity.getBlockPos().getY() + yOffset; - maxY = Objects.requireNonNull(beaconBlockEntity.getLevel()).getMaxBuildHeight() - lastSegment; + maxY = Objects.requireNonNull(beaconBlockEntity.getLevel()).getMaxY() - lastSegment; } renderBeaconBeam(matrices, vertexConsumers, tickDelta, worldTime, yOffset, maxY, color); } diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/entity/MixinItemFrameEntityRenderer.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/entity/MixinItemFrameEntityRenderer.java index e0c7881e..e4f4694f 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/entity/MixinItemFrameEntityRenderer.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/entity/MixinItemFrameEntityRenderer.java @@ -4,6 +4,7 @@ import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.ItemFrameRenderer; +import net.minecraft.client.renderer.entity.state.ItemFrameRenderState; import net.minecraft.world.entity.decoration.ItemFrame; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -14,15 +15,15 @@ @Mixin(ItemFrameRenderer.class) public class MixinItemFrameEntityRenderer { - @Inject(method = "render(Lnet/minecraft/world/entity/decoration/ItemFrame;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderer;render(Lnet/minecraft/world/entity/Entity;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", shift = At.Shift.AFTER), cancellable = true) - public void render(ItemFrame itemFrame, float f, float g, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) { + @Inject(method = "render(Lnet/minecraft/client/renderer/entity/state/ItemFrameRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderer;render(Lnet/minecraft/client/renderer/entity/state/EntityRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", shift = At.Shift.AFTER), cancellable = true) + public void render(ItemFrameRenderState itemFrameRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) { if (!SodiumExtraClientMod.options().renderSettings.itemFrame) { ci.cancel(); } } - @Inject(method = "shouldShowName(Lnet/minecraft/world/entity/decoration/ItemFrame;)Z", at = @At(value = "HEAD"), cancellable = true) - private void hasLabel(T entity, CallbackInfoReturnable cir) { + @Inject(method = "shouldShowName(Lnet/minecraft/world/entity/decoration/ItemFrame;D)Z", at = @At(value = "HEAD"), cancellable = true) + private void hasLabel(T itemFrame, double d, CallbackInfoReturnable cir) { if (!SodiumExtraClientMod.options().renderSettings.itemFrameNameTag) { cir.setReturnValue(false); } diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/entity/MixinLivingEntityRenderer.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/entity/MixinLivingEntityRenderer.java index c32cdf6b..3e8dea65 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/entity/MixinLivingEntityRenderer.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/entity/MixinLivingEntityRenderer.java @@ -9,6 +9,8 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.state.ArmorStandRenderState; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.decoration.ArmorStand; import org.spongepowered.asm.mixin.Mixin; @@ -18,24 +20,25 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(LivingEntityRenderer.class) -abstract class MixinLivingEntityRenderer> extends EntityRenderer implements RenderLayerParent { +abstract class MixinLivingEntityRenderer> extends EntityRenderer implements RenderLayerParent { + protected MixinLivingEntityRenderer(EntityRendererProvider.Context ctx) { super(ctx); } - @Inject(method = "render(Lnet/minecraft/world/entity/LivingEntity;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", at = @At("HEAD"), cancellable = true) - private void onRender(T entity, float f, float g, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) { - if (entity instanceof ArmorStand && !SodiumExtraClientMod.options().renderSettings.armorStand) { + @Inject(method = "render(Lnet/minecraft/client/renderer/entity/state/LivingEntityRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", at = @At("HEAD"), cancellable = true) + private void onRender(S livingEntityRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) { + if (livingEntityRenderState instanceof ArmorStandRenderState && !SodiumExtraClientMod.options().renderSettings.armorStand) { ci.cancel(); - if (this.shouldShowName(entity)) { - this.renderNameTag(entity, entity.getDisplayName(), poseStack, multiBufferSource, i, g); + if (livingEntityRenderState.nameTag != null) { + this.renderNameTag(livingEntityRenderState, livingEntityRenderState.nameTag, poseStack, multiBufferSource, i); } } } - @Inject(method = "shouldShowName(Lnet/minecraft/world/entity/LivingEntity;)Z", at = @At(value = "HEAD"), cancellable = true) - private void shouldShowName(T entity, CallbackInfoReturnable cir) { - if (entity instanceof AbstractClientPlayer && !SodiumExtraClientMod.options().renderSettings.playerNameTag) { + @Inject(method = "shouldShowName(Lnet/minecraft/world/entity/LivingEntity;D)Z", at = @At(value = "HEAD"), cancellable = true) + private void shouldShowName(T livingEntity, double d, CallbackInfoReturnable cir) { + if (livingEntity instanceof AbstractClientPlayer && !SodiumExtraClientMod.options().renderSettings.playerNameTag) { cir.setReturnValue(false); } } diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/entity/MixinPaintingEntityRenderer.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/entity/MixinPaintingEntityRenderer.java index b263b29c..d7c70f81 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/entity/MixinPaintingEntityRenderer.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/render/entity/MixinPaintingEntityRenderer.java @@ -4,6 +4,7 @@ import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.PaintingRenderer; +import net.minecraft.client.renderer.entity.state.PaintingRenderState; import net.minecraft.world.entity.decoration.Painting; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -12,8 +13,8 @@ @Mixin(PaintingRenderer.class) public class MixinPaintingEntityRenderer { - @Inject(at = @At("HEAD"), method = "render(Lnet/minecraft/world/entity/decoration/Painting;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", cancellable = true) - public void render(Painting painting, float f, float g, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) { + @Inject(at = @At("HEAD"), method = "render(Lnet/minecraft/client/renderer/entity/state/PaintingRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", cancellable = true) + public void render(PaintingRenderState paintingRenderState, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) { if (!SodiumExtraClientMod.options().renderSettings.lightUpdates) ci.cancel(); } diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sky/MixinLevelRenderer.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sky/MixinLevelRenderer.java deleted file mode 100644 index 519baa92..00000000 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sky/MixinLevelRenderer.java +++ /dev/null @@ -1,39 +0,0 @@ -package me.flashyreese.mods.sodiumextra.mixin.sky; - -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexBuffer; -import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; -import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.ShaderInstance; -import org.joml.Matrix4f; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(LevelRenderer.class) -public class MixinLevelRenderer { - @WrapOperation( - method = "renderSky", - at = @At( - value = "INVOKE", - target = "Lcom/mojang/blaze3d/vertex/VertexBuffer;drawWithShader(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/client/renderer/ShaderInstance;)V", - ordinal = 0 - ) - ) - public void redirectSetSkyShader(VertexBuffer instance, Matrix4f viewMatrix, Matrix4f projectionMatrix, ShaderInstance program, Operation original) { - if (SodiumExtraClientMod.options().detailSettings.sky) { - original.call(instance, viewMatrix, projectionMatrix, program); - } - } - - @Inject(method = "renderEndSky", at = @At(value = "HEAD"), cancellable = true) - public void preRenderEndSky(PoseStack stack, CallbackInfo ci) { - if (!SodiumExtraClientMod.options().detailSettings.sky) { - ci.cancel(); - } - } -} diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sky/MixinSkyRenderer.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sky/MixinSkyRenderer.java new file mode 100644 index 00000000..ca9011aa --- /dev/null +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sky/MixinSkyRenderer.java @@ -0,0 +1,52 @@ +package me.flashyreese.mods.sodiumextra.mixin.sky; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.Tesselator; +import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; +import net.minecraft.client.renderer.FogParameters; +import net.minecraft.client.renderer.SkyRenderer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(SkyRenderer.class) +public class MixinSkyRenderer { + @Inject( + method = "renderSkyDisc", + at = @At(value = "HEAD"), cancellable = true + ) + public void redirectRenderSkyDisc(float f, float g, float h, CallbackInfo ci) { + if (!SodiumExtraClientMod.options().detailSettings.sky) { + ci.cancel(); + } + } + + @Inject(method = "renderEndSky", at = @At(value = "HEAD"), cancellable = true) + public void preRenderEndSky(PoseStack stack, CallbackInfo ci) { + if (!SodiumExtraClientMod.options().detailSettings.sky) { + ci.cancel(); + } + } + + @Inject(method = "renderSun", at = @At(value = "HEAD"), cancellable = true) + private void renderSun(float f, Tesselator tesselator, PoseStack poseStack, CallbackInfo ci) { + if (!SodiumExtraClientMod.options().detailSettings.sun) { + ci.cancel(); + } + } + + @Inject(method = "renderMoon", at = @At(value = "HEAD"), cancellable = true) + private void renderMoon(int i, float f, Tesselator tesselator, PoseStack poseStack, CallbackInfo ci) { + if (!SodiumExtraClientMod.options().detailSettings.moon) { + ci.cancel(); + } + } + + @Inject(method = "renderStars", at = @At(value = "HEAD"), cancellable = true) + private void renderStars(FogParameters fogParameters, float f, PoseStack poseStack, CallbackInfo ci) { + if (!SodiumExtraClientMod.options().detailSettings.stars) { + ci.cancel(); + } + } +} diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/stars/MixinLevelRenderer.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/stars/MixinLevelRenderer.java deleted file mode 100644 index bd95b79c..00000000 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/stars/MixinLevelRenderer.java +++ /dev/null @@ -1,28 +0,0 @@ -package me.flashyreese.mods.sodiumextra.mixin.stars; - -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.LevelRenderer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(LevelRenderer.class) -public class MixinLevelRenderer { - @WrapOperation( - method = "renderSky", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/multiplayer/ClientLevel;getStarBrightness(F)F" - ) - ) - public float redirectGetStarBrightness(ClientLevel instance, float f, Operation original) { - if (SodiumExtraClientMod.options().detailSettings.stars) { - return original.call(instance, f); - } else { - return 0.0f; - } - } -} diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sun_moon/MixinLevelRenderer.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sun_moon/MixinLevelRenderer.java deleted file mode 100644 index e4ecdff7..00000000 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/sun_moon/MixinLevelRenderer.java +++ /dev/null @@ -1,59 +0,0 @@ -package me.flashyreese.mods.sodiumextra.mixin.sun_moon; - -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; -import net.minecraft.client.renderer.DimensionSpecialEffects; -import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.resources.ResourceLocation; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(LevelRenderer.class) -public class MixinLevelRenderer { - - @Mutable - @Shadow - @Final - private static ResourceLocation SUN_LOCATION; - - @Mutable - @Shadow - @Final - private static ResourceLocation MOON_LOCATION; - - @WrapOperation( - method = "renderSky", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/renderer/DimensionSpecialEffects;getSunriseColor(FF)[F" - ) - ) - public float[] redirectGetFogColorOverride(DimensionSpecialEffects instance, float skyAngle, float tickDelta, Operation original) { - if (SodiumExtraClientMod.options().detailSettings.sunMoon) { - return original.call(instance, skyAngle, tickDelta); - } else { - return null; - } - } - - @Inject( - method = "allChanged()V", - at = @At(value = "TAIL") - ) - private void postWorldRendererReload(CallbackInfo ci) { - if (SodiumExtraClientMod.options().detailSettings.sunMoon) { - MOON_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/moon_phases.png"); - SUN_LOCATION = ResourceLocation.withDefaultNamespace("textures/environment/sun.png"); - } else { - MOON_LOCATION = ResourceLocation.fromNamespaceAndPath("sodium-extra", "textures/transparent.png"); - SUN_LOCATION = ResourceLocation.fromNamespaceAndPath("sodium-extra", "textures/transparent.png"); - } - } -} diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinAdvancementToast.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinAdvancementToast.java index 392cfd3c..4a7eb8f9 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinAdvancementToast.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinAdvancementToast.java @@ -1,21 +1,24 @@ package me.flashyreese.mods.sodiumextra.mixin.toasts; import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; -import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.toasts.AdvancementToast; import net.minecraft.client.gui.components.toasts.Toast; -import net.minecraft.client.gui.components.toasts.ToastComponent; +import net.minecraft.client.gui.components.toasts.ToastManager; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(AdvancementToast.class) public class MixinAdvancementToast { - @Inject(method = "render", at = @At("HEAD"), cancellable = true) - public void draw(GuiGraphics guiGraphics, ToastComponent manager, long startTime, CallbackInfoReturnable cir) { + @Shadow private Toast.Visibility wantedVisibility; + + @Inject(method = "update", at = @At("HEAD"), cancellable = true) + public void draw(ToastManager toastManager, long l, CallbackInfo ci) { if (!SodiumExtraClientMod.options().extraSettings.advancementToast) { - cir.setReturnValue(Toast.Visibility.HIDE); + this.wantedVisibility = Toast.Visibility.HIDE; + ci.cancel(); } } } diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinRecipeToast.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinRecipeToast.java index afbd8a70..a2d43313 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinRecipeToast.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinRecipeToast.java @@ -1,21 +1,25 @@ package me.flashyreese.mods.sodiumextra.mixin.toasts; import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; -import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.toasts.RecipeToast; import net.minecraft.client.gui.components.toasts.Toast; -import net.minecraft.client.gui.components.toasts.ToastComponent; +import net.minecraft.client.gui.components.toasts.ToastManager; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(RecipeToast.class) public class MixinRecipeToast { - @Inject(method = "render", at = @At("HEAD"), cancellable = true) - public void draw(GuiGraphics guiGraphics, ToastComponent manager, long startTime, CallbackInfoReturnable cir) { + @Shadow + private Toast.Visibility wantedVisibility; + + @Inject(method = "update", at = @At("HEAD"), cancellable = true) + public void draw(ToastManager toastManager, long l, CallbackInfo ci) { if (!SodiumExtraClientMod.options().extraSettings.recipeToast) { - cir.setReturnValue(Toast.Visibility.HIDE); + this.wantedVisibility = Toast.Visibility.HIDE; + ci.cancel(); } } } diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinSystemToast.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinSystemToast.java index 468ab1a1..3bce229f 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinSystemToast.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinSystemToast.java @@ -1,21 +1,25 @@ package me.flashyreese.mods.sodiumextra.mixin.toasts; import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; -import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.toasts.SystemToast; import net.minecraft.client.gui.components.toasts.Toast; -import net.minecraft.client.gui.components.toasts.ToastComponent; +import net.minecraft.client.gui.components.toasts.ToastManager; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(SystemToast.class) public class MixinSystemToast { - @Inject(method = "render", at = @At("HEAD"), cancellable = true) - public void draw(GuiGraphics guiGraphics, ToastComponent manager, long startTime, CallbackInfoReturnable cir) { + @Shadow + private Toast.Visibility wantedVisibility; + + @Inject(method = "update", at = @At("HEAD"), cancellable = true) + public void draw(ToastManager toastManager, long l, CallbackInfo ci) { if (!SodiumExtraClientMod.options().extraSettings.systemToast) { - cir.setReturnValue(Toast.Visibility.HIDE); + this.wantedVisibility = Toast.Visibility.HIDE; + ci.cancel(); } } } diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinToastManager.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinToastManager.java index aad91bf6..c73d0965 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinToastManager.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinToastManager.java @@ -1,13 +1,13 @@ package me.flashyreese.mods.sodiumextra.mixin.toasts; import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; -import net.minecraft.client.gui.components.toasts.ToastComponent; +import net.minecraft.client.gui.components.toasts.ToastManager; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(ToastComponent.class) +@Mixin(ToastManager.class) public class MixinToastManager { @Inject(method = "addToast", at = @At("HEAD"), cancellable = true) public void goodByeToasts(CallbackInfo ci) { diff --git a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinTutorialToast.java b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinTutorialToast.java index 370f9366..6484926b 100644 --- a/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinTutorialToast.java +++ b/common/src/main/java/me/flashyreese/mods/sodiumextra/mixin/toasts/MixinTutorialToast.java @@ -1,21 +1,25 @@ package me.flashyreese.mods.sodiumextra.mixin.toasts; import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod; -import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.toasts.Toast; -import net.minecraft.client.gui.components.toasts.ToastComponent; +import net.minecraft.client.gui.components.toasts.ToastManager; import net.minecraft.client.gui.components.toasts.TutorialToast; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(TutorialToast.class) public class MixinTutorialToast { - @Inject(method = "render", at = @At("HEAD"), cancellable = true) - public void draw(GuiGraphics guiGraphics, ToastComponent manager, long startTime, CallbackInfoReturnable cir) { - if (!SodiumExtraClientMod.options().extraSettings.tutorialToast) { - cir.setReturnValue(Toast.Visibility.HIDE); + @Shadow + private Toast.Visibility visibility; + + @Inject(method = "update", at = @At("HEAD"), cancellable = true) + public void draw(ToastManager toastManager, long l, CallbackInfo ci) { + if (!SodiumExtraClientMod.options().extraSettings.advancementToast) { + this.visibility = Toast.Visibility.HIDE; + ci.cancel(); } } } diff --git a/common/src/main/resources/assets/sodium-extra/lang/en_us.json b/common/src/main/resources/assets/sodium-extra/lang/en_us.json index 1c13621b..30aefe80 100644 --- a/common/src/main/resources/assets/sodium-extra/lang/en_us.json +++ b/common/src/main/resources/assets/sodium-extra/lang/en_us.json @@ -313,8 +313,10 @@ "sodium-extra.option.steady_debug_hud.tooltip": "If enabled, the debug hud will be refreshed at a certain amount of ticks configured by the Steady Debug Hud Refresh Rate.", "sodium-extra.option.steady_debug_hud_refresh_interval": "Steady Debug Hud Refresh Interval", "sodium-extra.option.steady_debug_hud_refresh_interval.tooltip": "Adjusts the interval of when the debug hud will be refreshed in ticks.", - "sodium-extra.option.sun_moon": "Sun & Moon", - "sodium-extra.option.sun_moon.tooltip": "If enabled, the sun and moon will be rendered.", + "sodium-extra.option.sun": "Sun", + "sodium-extra.option.sun.tooltip": "If enabled, the sun will be rendered.", + "sodium-extra.option.moon": "Moon", + "sodium-extra.option.moon.tooltip": "If enabled, the moon will be rendered.", "sodium-extra.option.system_toast": "System Toasts", "sodium-extra.option.system_toast.tooltip": "If enabled, system popups will be displayed.", "sodium-extra.option.text_contrast": "Text Contrast", diff --git a/common/src/main/resources/sodium-extra.mixins.json b/common/src/main/resources/sodium-extra.mixins.json index b97a4ca4..638cb6a8 100644 --- a/common/src/main/resources/sodium-extra.mixins.json +++ b/common/src/main/resources/sodium-extra.mixins.json @@ -21,14 +21,10 @@ "optimizations.beacon_beam_rendering.MixinBeaconRenderer", "optimizations.beacon_beam_rendering.MixinVertexSerializerRegistryImpl", "optimizations.beacon_beam_rendering.LevelRendererAccessor", - "optimizations.draw_helpers.MixinGuiGraphics", - "optimizations.fast_weather.MixinLevelRenderer", "particle.MixinFireworkParticle", "particle.MixinParticleEngine", "particle.MixinLevelRenderer", "prevent_shaders.MixinGameRenderer", - "profiler.MixinBlockEntityRenderDispatcher", - "profiler.MixinEntityRenderDispatcher", "reduce_resolution_on_mac.MixinWindow", "render.block.entity.MixinBeaconRenderer", "render.block.entity.MixinEnchantingTableBlockEntityRenderer", @@ -36,16 +32,14 @@ "render.entity.MixinItemFrameEntityRenderer", "render.entity.MixinLivingEntityRenderer", "render.entity.MixinPaintingEntityRenderer", - "sky.MixinLevelRenderer", + "sky.MixinSkyRenderer", "sky_colors.MixinBiome", "sodium.accessibility.MixinSodiumGameOptionPages", "sodium.cloud.MixinCloudRenderer", "sodium.fog.MixinOcclusionCuller", "sodium.scrollable_page.MixinSodiumOptionsGUI", "sodium.vsync.MixinSodiumGameOptionsPages", - "stars.MixinLevelRenderer", "steady_debug_hud.MixinDebugScreenOverlay", - "sun_moon.MixinLevelRenderer", "toasts.MixinAdvancementToast", "toasts.MixinRecipeToast", "toasts.MixinSystemToast", diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 3d6cab02..2237bf41 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -1,7 +1,7 @@ plugins { id("java") id("idea") - id("fabric-loom") version ("1.7.2") + id("fabric-loom") version ("1.8.9") } val MINECRAFT_VERSION: String by rootProject.extra diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index a2a5d175..c8485b56 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -50,8 +50,8 @@ ], "depends": { "fabricloader": ">=0.15", - "sodium": ">=0.6.0-beta.2", - "minecraft": ">=1.21" + "sodium": ">=0.6.0-beta.3", + "minecraft": ">=1.21.2" }, "breaks": { "iris": "<1.7.0", diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c0..e6441136 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0d184210..df97d72b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1aa94a42..b740cf13 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. diff --git a/neoforge/build.gradle.kts b/neoforge/build.gradle.kts index eb025004..e24665f6 100644 --- a/neoforge/build.gradle.kts +++ b/neoforge/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("idea") - id("net.neoforged.moddev") version "0.1.126" + id("net.neoforged.moddev") version "1.0.11" id("java-library") } diff --git a/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml index 26a5919e..9cd9bd98 100644 --- a/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -19,14 +19,14 @@ Features that shouldn't be in Sodium. [[dependencies.sodium_extra]] modId = "minecraft" type = "required" -versionRange = "[1.20.4,1.21.1)" +versionRange = "[1.21.1,1.21.4)" ordering = "NONE" side = "CLIENT" [[dependencies.sodium_extra]] modId = "sodium" type = "required" -versionRange = "[0.6.0-beta.2,0.6.0)" +versionRange = "[0.6.0-beta.3,0.6.0)" ordering = "NONE" side = "CLIENT"