Created
June 12, 2024 19:23
-
-
Save bconlon1/7589bb727cce0f72418eb5f78ff310fc to your computer and use it in GitHub Desktop.
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
@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