|
8 | 8 | import com.llamalad7.mixinextras.injector.ModifyReturnValue; |
9 | 9 | import meteordevelopment.meteorclient.systems.modules.Modules; |
10 | 10 | import meteordevelopment.meteorclient.systems.modules.render.Xray; |
11 | | -import net.caffeinemc.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache; |
| 11 | +import net.caffeinemc.mods.sodium.client.render.model.AbstractBlockRenderContext; |
| 12 | +import net.caffeinemc.mods.sodium.client.world.LevelSlice; |
12 | 13 | import net.minecraft.block.BlockState; |
13 | 14 | import net.minecraft.util.math.BlockPos; |
14 | 15 | import net.minecraft.util.math.Direction; |
15 | | -import net.minecraft.world.BlockView; |
16 | 16 | import org.spongepowered.asm.mixin.Mixin; |
| 17 | +import org.spongepowered.asm.mixin.Shadow; |
17 | 18 | import org.spongepowered.asm.mixin.Unique; |
18 | 19 | import org.spongepowered.asm.mixin.injection.At; |
19 | 20 | import org.spongepowered.asm.mixin.injection.Inject; |
20 | 21 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
21 | 22 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; |
22 | 23 |
|
23 | | -@Mixin(value = BlockOcclusionCache.class, remap = false) |
| 24 | +@Mixin(value = AbstractBlockRenderContext.class, remap = false) |
24 | 25 | public abstract class SodiumBlockOcclusionCacheMixin { |
25 | | - @Unique |
26 | | - private Xray xray; |
| 26 | + |
| 27 | + @Shadow protected BlockState state; |
| 28 | + @Shadow protected BlockPos pos; |
| 29 | + @Shadow protected LevelSlice slice; |
| 30 | + |
| 31 | + @Unique private Xray xray; |
27 | 32 |
|
28 | 33 | @Inject(method = "<init>", at = @At("TAIL")) |
29 | 34 | private void onInit(CallbackInfo info) { |
30 | 35 | xray = Modules.get().get(Xray.class); |
31 | 36 | } |
32 | | - |
33 | 37 | // For More Culling compatibility - runs before More Culling's inject to force-render whitelisted Xray blocks |
34 | 38 | @Inject(method = "shouldDrawSide", at = @At("HEAD"), cancellable = true) |
35 | | - private void meteor$forceXrayFace(BlockState state, BlockView view, BlockPos pos, Direction facing, |
36 | | - CallbackInfoReturnable<Boolean> cir) { |
| 39 | + private void meteor$forceXrayFace(Direction facing, CallbackInfoReturnable<Boolean> cir) { |
37 | 40 | if (xray != null && xray.isActive() && !xray.isBlocked(state.getBlock(), null)) { |
38 | 41 | cir.setReturnValue(true); |
39 | 42 | } |
40 | 43 | } |
41 | 44 |
|
42 | 45 | @ModifyReturnValue(method = "shouldDrawSide", at = @At("RETURN")) |
43 | | - private boolean shouldDrawSide(boolean original, BlockState state, BlockView view, BlockPos pos, Direction facing) { |
44 | | - if (xray.isActive()) { |
45 | | - return xray.modifyDrawSide(state, view, pos, facing, original); |
46 | | - } |
47 | | - |
48 | | - return original; |
| 46 | + private boolean shouldDrawSide(boolean original, Direction facing) { |
| 47 | + if (!xray.isActive()) return original; |
| 48 | + return xray.modifyDrawSide(state, slice, pos, facing, original); |
49 | 49 | } |
50 | 50 | } |
0 commit comments