mirror of
https://github.com/Wurst-Imperium/Wurst7.git
synced 2024-09-19 17:02:13 +02:00
Update X-Ray to work with Sodium 0.6
This commit is contained in:
parent
7974908f8e
commit
72e280b86d
@ -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,
|
||||
|
@ -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<BlockPos.Mutable> 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<Boolean> 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<Boolean> 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());
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,8 @@
|
||||
"breaks": {
|
||||
"wi_zoom": "*",
|
||||
"wi-zoom": "*",
|
||||
"vulkanmod": "*"
|
||||
"vulkanmod": "*",
|
||||
"sodium": "<0.6.0-beta.1"
|
||||
},
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
|
Loading…
Reference in New Issue
Block a user