Skip to content

Commit

Permalink
Mixin fixes pt 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Moondarker committed Feb 29, 2024
1 parent 56d7bc8 commit e946261
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
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;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(value = BlockRenderer.class, remap = false)
public class SodiumBlockRendererMixin {
@Inject(method = "renderModel", at = @At("HEAD"), cancellable = true)
private void onRenderModel(BlockRenderContext ctx, ChunkModelBuilder buffers, CallbackInfo info) {
private void onRenderModel(BlockRenderContext ctx, ChunkModelBuilder buffers, CallbackInfoReturnable<Boolean> cir) {
int alpha = Xray.getAlpha(ctx.state(), ctx.pos());

if (alpha == 0) info.cancel();
if (alpha == 0) cir.setReturnValue(false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.Arrays;

Expand All @@ -43,10 +44,10 @@ private void onInit(CallbackInfo info) {
}

@Inject(method = "render", at = @At("HEAD"), cancellable = true)
private void onRender(BlockRenderView world, FluidState fluidState, BlockPos blockPos, BlockPos offset, ChunkModelBuilder buffers, CallbackInfo info) {
private void onRender(BlockRenderView world, FluidState fluidState, BlockPos blockPos, BlockPos offset, ChunkModelBuilder buffers, CallbackInfoReturnable<Boolean> cir) {
int alpha = Xray.getAlpha(fluidState.getBlockState(), blockPos);

if (alpha == 0) info.cancel();
if (alpha == 0) cir.setReturnValue(false);
}

@Inject(method = "updateQuad", at = @At("TAIL"))
Expand Down

0 comments on commit e946261

Please sign in to comment.