Files
MinecraftForge/patches/minecraft/net/minecraft/client/renderer/block/LiquidBlockRenderer.java.patch
T
4a2db246e0 1.21 Update
Co-authored-by: RealMangoRage <[email protected]>
Co-authored-by: Daniel Norris <[email protected]>
Co-authored-by: Ven <[email protected]>
2024-06-13 10:42:32 -07:00

107 lines
7.2 KiB
Diff

--- a/net/minecraft/client/renderer/block/LiquidBlockRenderer.java
+++ b/net/minecraft/client/renderer/block/LiquidBlockRenderer.java
@@ -70,8 +_,10 @@
public void tesselate(BlockAndTintGetter p_234370_, BlockPos p_234371_, VertexConsumer p_234372_, BlockState p_234373_, FluidState p_234374_) {
boolean flag = p_234374_.is(FluidTags.LAVA);
- TextureAtlasSprite[] atextureatlassprite = flag ? this.lavaIcons : this.waterIcons;
- int i = flag ? 16777215 : BiomeColors.getAverageWaterColor(p_234370_, p_234371_);
+ TextureAtlasSprite[] atextureatlassprite = net.minecraftforge.client.ForgeHooksClient.getFluidSprites(p_234370_, p_234371_, p_234374_);
+ int i = net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions.of(p_234374_).getTintColor(p_234374_, p_234370_, p_234371_);
+ float alpha = (float)(i >> 24 & 255) / 255.0F;
+
float f = (float)(i >> 16 & 0xFF) / 255.0F;
float f1 = (float)(i >> 8 & 0xFF) / 255.0F;
float f2 = (float)(i & 0xFF) / 255.0F;
@@ -181,15 +_,15 @@
float f57 = f4 * f;
float f29 = f4 * f1;
float f30 = f4 * f2;
- this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l);
- this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l);
- this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l);
- this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l);
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l, alpha);
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l, alpha);
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l, alpha);
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l, alpha);
if (p_234374_.shouldRenderBackwardUpFace(p_234370_, p_234371_.above())) {
- this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l);
- this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l);
- this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l);
- this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l);
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f8, f38 + 0.0F, f57, f29, f30, f17, f21, l, alpha);
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f7, f38 + 0.0F, f57, f29, f30, f20, f24, l, alpha);
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f9, f38 + 1.0F, f57, f29, f30, f19, f23, l, alpha);
+ this.vertex(p_234372_, f36 + 0.0F, f37 + f10, f38 + 1.0F, f57, f29, f30, f18, f22, l, alpha);
}
}
@@ -202,10 +_,10 @@
float f46 = f3 * f;
float f48 = f3 * f1;
float f50 = f3 * f2;
- this.vertex(p_234372_, f36, f37 + f16, f38 + 1.0F, f46, f48, f50, f40, f43, k);
- this.vertex(p_234372_, f36, f37 + f16, f38, f46, f48, f50, f40, f42, k);
- this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38, f46, f48, f50, f41, f42, k);
- this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38 + 1.0F, f46, f48, f50, f41, f43, k);
+ this.vertex(p_234372_, f36, f37 + f16, f38 + 1.0F, f46, f48, f50, f40, f43, k, alpha);
+ this.vertex(p_234372_, f36, f37 + f16, f38, f46, f48, f50, f40, f42, k, alpha);
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38, f46, f48, f50, f41, f42, k, alpha);
+ this.vertex(p_234372_, f36 + 1.0F, f37 + f16, f38 + 1.0F, f46, f48, f50, f41, f43, k, alpha);
}
int j = this.getLightColor(p_234370_, p_234371_);
@@ -259,10 +_,9 @@
if (flag7 && !isFaceOccludedByNeighbor(p_234370_, p_234371_, direction, Math.max(f44, f45), p_234370_.getBlockState(p_234371_.relative(direction)))) {
BlockPos blockpos = p_234371_.relative(direction);
TextureAtlasSprite textureatlassprite2 = atextureatlassprite[1];
- if (!flag) {
- Block block = p_234370_.getBlockState(blockpos).getBlock();
- if (block instanceof HalfTransparentBlock || block instanceof LeavesBlock) {
- textureatlassprite2 = this.waterOverlay;
+ if (atextureatlassprite[2] != null) {
+ if (p_234370_.getBlockState(blockpos).shouldDisplayFluidOverlay(p_234370_, blockpos, p_234374_)) {
+ textureatlassprite2 = atextureatlassprite[2];
}
}
@@ -275,15 +_,15 @@
float f33 = f4 * f32 * f;
float f34 = f4 * f32 * f1;
float f35 = f4 * f32 * f2;
- this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j);
- this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j);
- this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j);
- this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j);
+ this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j, alpha);
+ this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j, alpha);
+ this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j, alpha);
+ this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j, alpha);
if (textureatlassprite2 != this.waterOverlay) {
- this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j);
- this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j);
- this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j);
- this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j);
+ this.vertex(p_234372_, f47, f37 + f16, f49, f33, f34, f35, f56, f31, j, alpha);
+ this.vertex(p_234372_, f51, f37 + f16, f52, f33, f34, f35, f58, f31, j, alpha);
+ this.vertex(p_234372_, f51, f37 + f45, f52, f33, f34, f35, f58, f60, j, alpha);
+ this.vertex(p_234372_, f47, f37 + f44, f49, f33, f34, f35, f56, f59, j, alpha);
}
}
}
@@ -345,10 +_,11 @@
float p_343128_,
float p_344448_,
float p_344284_,
- int p_110994_
+ int p_110994_,
+ float alpha
) {
p_110985_.addVertex(p_110989_, p_110990_, p_110991_)
- .setColor(p_110992_, p_110993_, p_343128_, 1.0F)
+ .setColor(p_110992_, p_110993_, p_343128_, alpha)
.setUv(p_344448_, p_344284_)
.setLight(p_110994_)
.setNormal(0.0F, 1.0F, 0.0F);