From 72e280b86ddc26bb029f7103e8a1b7667d69a5e9 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 27 Aug 2024 11:02:10 +0200 Subject: [PATCH 1/2] Update X-Ray to work with Sodium 0.6 --- .../mixin/SodiumBlockOcclusionCacheMixin.java | 7 ++---- .../mixin/SodiumFluidRendererMixin.java | 25 +++++++++++-------- src/main/resources/fabric.mod.json | 3 ++- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java b/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java index 0d331286..14eb452d 100644 --- a/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java +++ b/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java @@ -22,16 +22,13 @@ import net.wurstclient.events.ShouldDrawSideListener.ShouldDrawSideEvent; @Pseudo @Mixin(targets = { - // current target - "me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache", - // < Sodium 0.5.0 - "me.jellysquid.mods.sodium.client.render.occlusion.BlockOcclusionCache"}, + "net.caffeinemc.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache"}, remap = false) public class SodiumBlockOcclusionCacheMixin { /** * This mixin hides and shows regular full blocks when using X-Ray with - * Sodium installed. + * Sodium installed. Last updated for Sodium 0.6.0-beta.1+mc1.21. */ @Inject(at = @At("HEAD"), method = "shouldDrawSide", cancellable = true) public void shouldDrawSide(BlockState state, BlockView world, BlockPos pos, diff --git a/src/main/java/net/wurstclient/mixin/SodiumFluidRendererMixin.java b/src/main/java/net/wurstclient/mixin/SodiumFluidRendererMixin.java index 86d69c83..fccdc98d 100644 --- a/src/main/java/net/wurstclient/mixin/SodiumFluidRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/SodiumFluidRendererMixin.java @@ -9,11 +9,13 @@ package net.wurstclient.mixin; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; +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.CallbackInfoReturnable; import net.minecraft.block.BlockState; +import net.minecraft.fluid.Fluid; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; @@ -22,26 +24,29 @@ import net.wurstclient.events.ShouldDrawSideListener.ShouldDrawSideEvent; @Pseudo @Mixin(targets = { - // current target - "me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.FluidRenderer", - // < Sodium 0.4.9 - "me.jellysquid.mods.sodium.client.render.pipeline.FluidRenderer"}, + "net.caffeinemc.mods.sodium.client.render.chunk.compile.pipeline.DefaultFluidRenderer"}, remap = false) public class SodiumFluidRendererMixin { + @Unique + private ThreadLocal mutablePosForExposedCheck = + ThreadLocal.withInitial(BlockPos.Mutable::new); + /** * This mixin hides and shows fluids when using X-Ray with Sodium installed. + * Last updated for Sodium 0.6.0-beta.1+mc1.21. */ - @Inject(at = @At("HEAD"), method = "isSideExposed", cancellable = true) - private void isSideExposed(BlockRenderView world, int x, int y, int z, - Direction dir, float height, CallbackInfoReturnable cir) + @Inject(at = @At("HEAD"), method = "isFluidOccluded", cancellable = true) + private void onIsFluidOccluded(BlockRenderView world, int x, int y, int z, + Direction dir, BlockState state, Fluid fluid, + CallbackInfoReturnable cir) { - BlockPos pos = new BlockPos(x, y, z); - BlockState state = world.getBlockState(pos); + BlockPos.Mutable pos = mutablePosForExposedCheck.get(); + pos.set(x, y, z); ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, pos); EventManager.fire(event); if(event.isRendered() != null) - cir.setReturnValue(event.isRendered()); + cir.setReturnValue(!event.isRendered()); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index c881efd7..023db277 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -36,7 +36,8 @@ "breaks": { "wi_zoom": "*", "wi-zoom": "*", - "vulkanmod": "*" + "vulkanmod": "*", + "sodium": "<0.6.0-beta.1" }, "custom": { "modmenu": { From f6fb739d1ae4f3c1453808ec11184b47fcc277f3 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 5 Sep 2024 20:45:24 +0200 Subject: [PATCH 2/2] Change version to 7.45.1 --- gradle.properties | 2 +- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index b3873dc1..c5143860 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ loader_version=0.16.4 fabric_version=0.103.0+1.21.1 # Mod Properties -mod_version = v7.45-MC1.21.1 +mod_version = v7.45.1-MC1.21.1 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 9205e981..459ca855 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -50,7 +50,7 @@ public enum WurstClient public static MinecraftClient MC; public static IMinecraftClient IMC; - public static final String VERSION = "7.45"; + public static final String VERSION = "7.45.1"; public static final String MC_VERSION = "1.21.1"; private WurstAnalytics analytics;