Skip to content

Instantly share code, notes, and snippets.

@bconlon1
Created June 12, 2024 19:23
Show Gist options
  • Save bconlon1/80706a1e1d15da5ee389191d6a97cf2d to your computer and use it in GitHub Desktop.
Save bconlon1/80706a1e1d15da5ee389191d6a97cf2d to your computer and use it in GitHub Desktop.
@Mixin(LiquidBlockRenderer.class)
public class LiquidBlockRendererMixin {
@Inject(method = "tesselate(Lnet/minecraft/world/level/BlockAndTintGetter;Lnet/minecraft/core/BlockPos;Lcom/mojang/blaze3d/vertex/VertexConsumer;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/material/FluidState;)V", at = @At(value = "HEAD"))
private void tesselate(BlockAndTintGetter level, BlockPos pos, VertexConsumer consumer, BlockState blockState, FluidState fluidState, CallbackInfo ci,
@Share("isSource") LocalBooleanRef isSource, @Share("atBottom") LocalBooleanRef atBottom) {
boolean source = fluidState.isSource();
boolean bottom = pos.below().getY() == level.getMinBuildHeight();
isSource.set(source);
atBottom.set(bottom);
AetherII.LOGGER.info("post " + source);
AetherII.LOGGER.info("post " + bottom);
}
@Inject(method = "vertex(Lcom/mojang/blaze3d/vertex/VertexConsumer;DDDFFFFFFI)V", at = @At(value = "HEAD"))
private void vertex(VertexConsumer consumer, double x, double y, double z, float r, float g, float b, float a, float u, float v, int light, CallbackInfo ci,
@Share("isSource") LocalBooleanRef isSource, @Share("atBottom") LocalBooleanRef atBottom) {
LiquidBlockRenderer liquidBlockRenderer = (LiquidBlockRenderer) (Object) this;
AetherII.LOGGER.info("post " + isSource);
AetherII.LOGGER.info("post " + atBottom);
AetherII.LOGGER.info("1");
if (isSource.get()) {
AetherII.LOGGER.info("2");
if (atBottom.get()) {
AetherII.LOGGER.info("3");
float trueAlpha = y == 0.001 ? 0.0F : 1.0F;
consumer.vertex(x, y, z).color(r, g, b, trueAlpha).uv(u, v).uv2(light).normal(0.0F, 1.0F, 0.0F).endVertex();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment