-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from TangyKiwi/master
Fix Sodium XRay compat
- Loading branch information
Showing
12 changed files
with
85 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package net.aoba.mixin; | ||
|
||
import net.aoba.Aoba; | ||
import net.aoba.AobaClient; | ||
import net.aoba.module.modules.render.XRay; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.client.render.VertexConsumer; | ||
import net.minecraft.client.render.block.FluidRenderer; | ||
import net.minecraft.fluid.FluidState; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.BlockRenderView; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(FluidRenderer.class) | ||
public class FluidRendererMixin { | ||
@Inject(method = "render", at = @At("HEAD"), cancellable = true) | ||
private void onRender(BlockRenderView world, BlockPos pos, VertexConsumer vertexConsumer, BlockState blockState, FluidState fluidState, CallbackInfo ci) { | ||
AobaClient aoba = Aoba.getInstance(); | ||
XRay xray = (XRay) aoba.moduleManager.xray; | ||
if (xray.state.getValue()) { | ||
if (!xray.isXRayBlock(blockState.getBlock()) && !xray.fluids.getValue()) { | ||
ci.cancel(); | ||
} | ||
} | ||
} | ||
} |
49 changes: 0 additions & 49 deletions
49
src/main/java/net/aoba/mixin/TerrainRenderContextMixin.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/net/aoba/mixin/sodium/SodiumFluidRendererImplMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package net.aoba.mixin.sodium; | ||
|
||
import net.aoba.Aoba; | ||
import net.aoba.AobaClient; | ||
import net.aoba.module.modules.render.XRay; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.compile.ChunkBuildBuffers; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.translucent_sorting.TranslucentGeometryCollector; | ||
import net.caffeinemc.mods.sodium.client.world.LevelSlice; | ||
import net.caffeinemc.mods.sodium.fabric.render.FluidRendererImpl; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.fluid.FluidState; | ||
import net.minecraft.util.math.BlockPos; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(value = FluidRendererImpl.class, remap = false) | ||
public abstract class SodiumFluidRendererImplMixin { | ||
@Inject(method = "render", at = @At("HEAD"), cancellable = true) | ||
private void onRender(LevelSlice level, BlockState blockState, FluidState fluidState, BlockPos blockPos, BlockPos offset, TranslucentGeometryCollector collector, ChunkBuildBuffers buffers, CallbackInfo ci) { | ||
AobaClient aoba = Aoba.getInstance(); | ||
XRay xray = (XRay) aoba.moduleManager.xray; | ||
if (xray.state.getValue()) { | ||
if (!xray.isXRayBlock(blockState.getBlock()) && !xray.fluids.getValue()) { | ||
ci.cancel(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters