Skip to content

Commit

Permalink
Add support for Sodium 0.6.1
Browse files Browse the repository at this point in the history
Fixes #1088
  • Loading branch information
Alexander01998 committed Dec 3, 2024
1 parent a9c0e24 commit e4822ac
Showing 1 changed file with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import net.minecraft.block.BlockState;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockRenderView;
Expand All @@ -34,11 +35,39 @@ public class SodiumDefaultFluidRendererMixin

/**
* This mixin hides and shows fluids when using X-Ray with Sodium installed.
* Last updated for Sodium 0.6.0-beta.1+mc1.21.
*
* <p>
* Works with Sodium >=0.6.0-beta.1 and <0.6.1.
*/
@Inject(at = @At("HEAD"), method = "isFluidOccluded", cancellable = true)
@Inject(at = @At("HEAD"),
method = "isFluidOccluded(Lnet/minecraft/class_1920;IIILnet/minecraft/class_2350;Lnet/minecraft/class_2680;Lnet/minecraft/class_3611;)Z",
cancellable = true,
require = 0)
private void onIsFluidOccludedInSodium060(BlockRenderView world, int x,
int y, int z, Direction dir, BlockState state, Fluid fluid,
CallbackInfoReturnable<Boolean> cir)
{
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());
}

/**
* This mixin hides and shows fluids when using X-Ray with Sodium installed.
*
* <p>
* Works with Sodium >=0.6.1. Last tested with Sodium 0.6.1+mc1.21.3.
*/
@Inject(at = @At("HEAD"),
method = "isFluidOccluded(Lnet/minecraft/class_1920;IIILnet/minecraft/class_2350;Lnet/minecraft/class_2680;Lnet/minecraft/class_3610;)Z",
cancellable = true,
require = 0)
private void onIsFluidOccluded(BlockRenderView world, int x, int y, int z,
Direction dir, BlockState state, Fluid fluid,
Direction dir, BlockState state, FluidState fluid,
CallbackInfoReturnable<Boolean> cir)
{
BlockPos.Mutable pos = mutablePosForExposedCheck.get();
Expand Down

0 comments on commit e4822ac

Please sign in to comment.