Skip to content

Instantly share code, notes, and snippets.

@mdashlw
Created June 1, 2021 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdashlw/5d14bb99a7fc86136632b193155ee373 to your computer and use it in GitHub Desktop.
Save mdashlw/5d14bb99a7fc86136632b193155ee373 to your computer and use it in GitHub Desktop.
water smooth lighting
@Mixin(value = BlockInfo.class, remap = false)
public class MixinBlockInfo {
@Redirect(
method = "updateLightMatrix",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/Block;isTranslucent()Z",
opcode = Opcodes.INVOKEVIRTUAL
)
)
public boolean updateLightMatrix__isTranslucent(final Block block) {
return !block.isVisuallyOpaque() || block.getLightOpacity() == 0;
}
}
@Mixin(targets = "net.minecraft.client.renderer.BlockModelRenderer.AmbientOcclusionFace")
public class MixinBlockModelRenderer {
@Redirect(
method = "updateVertexBrightness",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/Block;isTranslucent()Z",
opcode = Opcodes.INVOKEVIRTUAL
)
)
public boolean updateVertexBrightness__isTranslucent(final Block block) {
return !block.isVisuallyOpaque() || block.getLightOpacity() == 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment