|
7 | 7 | */ |
8 | 8 | package net.wurstclient.mixin.indigo; |
9 | 9 |
|
| 10 | +import org.spongepowered.asm.mixin.Final; |
10 | 11 | import org.spongepowered.asm.mixin.Mixin; |
11 | 12 | import org.spongepowered.asm.mixin.Pseudo; |
| 13 | +import org.spongepowered.asm.mixin.Shadow; |
| 14 | +import org.spongepowered.asm.mixin.injection.At; |
| 15 | +import org.spongepowered.asm.mixin.injection.Inject; |
| 16 | +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
12 | 17 |
|
13 | | -// import |
14 | | -// net.fabricmc.fabric.impl.client.indigo.renderer.mesh.MutableQuadViewImpl; |
15 | | -// import |
16 | | -// net.fabricmc.fabric.impl.client.indigo.renderer.render.AbstractTerrainRenderContext; |
17 | | -// import |
18 | | -// net.fabricmc.fabric.impl.client.indigo.renderer.render.BlockRenderInfo; |
| 18 | +import net.fabricmc.fabric.impl.client.indigo.renderer.mesh.MutableQuadViewImpl; |
| 19 | +import net.fabricmc.fabric.impl.client.indigo.renderer.render.BlockRenderInfo; |
| 20 | +import net.wurstclient.WurstClient; |
| 21 | +import net.wurstclient.hacks.XRayHack; |
19 | 22 |
|
20 | 23 | @Pseudo |
21 | 24 | @Mixin( |
22 | 25 | targets = "net.fabricmc.fabric.impl.client.indigo.renderer.render.AbstractTerrainRenderContext", |
23 | 26 | remap = false) |
24 | 27 | public abstract class AbstractTerrainRenderContextMixin |
25 | 28 | { |
26 | | - // @Shadow |
27 | | - // @Final |
28 | | - // private BlockRenderInfo blockInfo; |
| 29 | + @Shadow |
| 30 | + @Final |
| 31 | + private BlockRenderInfo blockInfo; |
29 | 32 |
|
30 | | - // /** |
31 | | - // * Applies X-Ray's opacity mask to the block color after all the normal |
32 | | - // * coloring and shading is done, if Indigo is running. |
33 | | - // */ |
34 | | - // @Inject(at = @At("RETURN"), |
35 | | - // method = |
36 | | - // "shadeQuad(Lnet/fabricmc/fabric/impl/client/indigo/renderer/mesh/MutableQuadViewImpl;ZZZ)V", |
37 | | - // require = 0) |
38 | | - // private void onShadeQuad(MutableQuadViewImpl quad, boolean ao, |
39 | | - // boolean emissive, boolean vanillaShade, CallbackInfo ci) |
40 | | - // { |
41 | | - // XRayHack xray = WurstClient.INSTANCE.getHax().xRayHack; |
42 | | - // if(!xray.isOpacityMode() || xray |
43 | | - // .isVisible(blockInfo.blockState.getBlock(), blockInfo.blockPos)) |
44 | | - // return; |
45 | | - |
46 | | - // for(int i = 0; i < 4; i++) |
47 | | - // quad.color(i, quad.color(i) & xray.getOpacityColorMask()); |
48 | | - // } |
| 33 | + /** |
| 34 | + * Applies X-Ray's opacity mask to the block color after all the normal |
| 35 | + * coloring and shading is done, if Indigo is running. |
| 36 | + */ |
| 37 | + @Inject(at = @At("RETURN"), |
| 38 | + method = "shadeQuad(Lnet/fabricmc/fabric/impl/client/indigo/renderer/mesh/MutableQuadViewImpl;ZZZ)V", |
| 39 | + require = 0) |
| 40 | + private void onShadeQuad(MutableQuadViewImpl quad, boolean ao, |
| 41 | + boolean emissive, boolean vanillaShade, CallbackInfo ci) |
| 42 | + { |
| 43 | + XRayHack xray = WurstClient.INSTANCE.getHax().xRayHack; |
| 44 | + if(!xray.isOpacityMode() || xray |
| 45 | + .isVisible(blockInfo.blockState.getBlock(), blockInfo.blockPos)) |
| 46 | + return; |
| 47 | + |
| 48 | + for(int i = 0; i < 4; i++) |
| 49 | + quad.color(i, quad.color(i) & xray.getOpacityColorMask()); |
| 50 | + } |
49 | 51 | } |
0 commit comments