|
| 1 | +/* |
| 2 | + * Copyright 2025 Lambda |
| 3 | + * |
| 4 | + * This program is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +package com.lambda.mixin.render; |
| 19 | + |
| 20 | +import com.lambda.module.modules.render.XRay; |
| 21 | +import net.caffeinemc.mods.sodium.client.render.chunk.compile.ChunkBuildBuffers; |
| 22 | +import net.caffeinemc.mods.sodium.client.render.chunk.translucent_sorting.TranslucentGeometryCollector; |
| 23 | +import net.caffeinemc.mods.sodium.client.world.LevelSlice; |
| 24 | +import net.caffeinemc.mods.sodium.fabric.render.FluidRendererImpl; |
| 25 | +import net.minecraft.block.BlockState; |
| 26 | +import net.minecraft.fluid.FluidState; |
| 27 | +import net.minecraft.util.math.BlockPos; |
| 28 | +import org.spongepowered.asm.mixin.Mixin; |
| 29 | +import org.spongepowered.asm.mixin.injection.At; |
| 30 | +import org.spongepowered.asm.mixin.injection.Inject; |
| 31 | +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
| 32 | + |
| 33 | +@Mixin(FluidRendererImpl.class) |
| 34 | +public class SodiumFluidRendererImplMixin { |
| 35 | + @Inject(method = "render", at = @At("HEAD"), cancellable = true) |
| 36 | + private void injectRender(LevelSlice level, BlockState blockState, FluidState fluidState, BlockPos blockPos, BlockPos offset, TranslucentGeometryCollector collector, ChunkBuildBuffers buffers, CallbackInfo info) { |
| 37 | + if (XRay.INSTANCE.isEnabled() && !XRay.isSelected(blockState) && XRay.getOpacity() < 100) |
| 38 | + info.cancel(); |
| 39 | + } |
| 40 | +} |
0 commit comments