Skip to content

Commit ddf628a

Browse files
committed
Fix X-Ray fluid rendering compat with Sodium
1 parent d74f30c commit ddf628a

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/main/java/net/wurstclient/mixin/sodium/DefaultFluidRendererMixin.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,38 @@ private void onIsFullBlockFluidOccluded(BlockAndTintGetter world,
5555
cir.setReturnValue(!event.isRendered());
5656
}
5757

58+
@Inject(at = @At("HEAD"),
59+
method = "isSideExposed(Lnet/minecraft/class_1920;IIILnet/minecraft/class_2350;F)Z",
60+
cancellable = true,
61+
remap = false,
62+
require = 0)
63+
private void onIsSideExposed(BlockAndTintGetter world, int x, int y, int z,
64+
Direction dir, float height, CallbackInfoReturnable<Boolean> cir)
65+
{
66+
BlockPos pos = new BlockPos(x, y, z);
67+
BlockState state = world.getBlockState(pos);
68+
69+
ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, pos);
70+
EventManager.fire(event);
71+
72+
if(event.isRendered() == null)
73+
return;
74+
75+
BlockPos nPos = pos.offset(dir.getUnitVec3i());
76+
BlockState neighborState = world.getBlockState(nPos);
77+
78+
cir.setReturnValue(!neighborState.getFluidState().getType()
79+
.isSame(state.getFluidState().getType()) && event.isRendered());
80+
}
81+
5882
/**
5983
* Modifies opacity of fluids when using X-Ray with Sodium installed.
6084
*/
6185
@ModifyExpressionValue(at = @At(value = "INVOKE",
6286
target = "Lnet/caffeinemc/mods/sodium/api/util/ColorARGB;toABGR(I)I"),
6387
method = "updateQuad",
64-
require = 0,
65-
remap = false)
88+
remap = false,
89+
require = 0)
6690
private int onUpdateQuad(int original, @Local(argsOnly = true) BlockPos pos,
6791
@Local(argsOnly = true) FluidState state)
6892
{

0 commit comments

Comments
 (0)