diff --git a/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch index df0afa0a2..fbb0a95e8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FluidBlockRenderer.java.patch @@ -51,20 +51,21 @@ flag7 = true; } -@@ -222,10 +223,10 @@ +@@ -222,10 +223,9 @@ flag7 = true; BlockPos blockpos = p_228796_2_.func_177972_a(direction); TextureAtlasSprite textureatlassprite2 = atextureatlassprite[1]; - if (!flag) { -+ if (atextureatlassprite[2] != null) { - Block block = p_228796_1_.func_180495_p(blockpos).func_177230_c(); - if (block == Blocks.field_150359_w || block instanceof StainedGlassBlock) { +- Block block = p_228796_1_.func_180495_p(blockpos).func_177230_c(); +- if (block == Blocks.field_150359_w || block instanceof StainedGlassBlock) { - textureatlassprite2 = this.field_187501_d; ++ if (atextureatlassprite[2] != null) { ++ if (p_228796_1_.func_180495_p(blockpos).shouldDisplayFluidOverlay(p_228796_1_, blockpos, p_228796_4_)) { + textureatlassprite2 = atextureatlassprite[2]; } } -@@ -239,15 +240,15 @@ +@@ -239,15 +239,15 @@ float f31 = 1.0F * f30 * f; float f32 = 1.0F * f30 * f1; float f33 = 1.0F * f30 * f2; @@ -89,7 +90,7 @@ } } } -@@ -256,10 +257,15 @@ +@@ -256,10 +256,15 @@ } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java index 07cfaee77..6a45cc79f 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java @@ -35,6 +35,7 @@ import net.minecraft.block.HorizontalBlock; import net.minecraft.block.IBeaconBeamColorProvider; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.SoundType; +import net.minecraft.block.StainedGlassBlock; import net.minecraft.block.material.Material; import net.minecraft.block.BlockState; import net.minecraft.client.particle.ParticleManager; @@ -1054,4 +1055,18 @@ public interface IForgeBlock { return getBlock().isIn(BlockTags.FENCES) || getBlock().isIn(BlockTags.WALLS) || getBlock() instanceof FenceGateBlock; } + + /** + * Called to determine whether this block should use the fluid overlay texture or flowing texture when it is placed under the fluid. + * + * @param state The current state + * @param world The world + * @param pos Block position in world + * @param fluidState The state of the fluid + * @return Whether the fluid overlay texture should be used + */ + default boolean shouldDisplayFluidOverlay(BlockState state, ILightReader world, BlockPos pos, IFluidState fluidState) + { + return state.getBlock() == Blocks.GLASS || state.getBlock() instanceof StainedGlassBlock; + } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java index fca5aa956..754161cb0 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java @@ -898,4 +898,17 @@ public interface IForgeBlockState { return getBlockState().getBlock().collisionExtendsVertically(getBlockState(), world, pos, collidingEntity); } + + /** + * Called to determine whether this block should use the fluid overlay texture or flowing texture when it is placed under the fluid. + * + * @param world The world + * @param pos Block position in world + * @param fluidState The state of the fluid + * @return Whether the fluid overlay texture should be used + */ + default boolean shouldDisplayFluidOverlay(ILightReader world, BlockPos pos, IFluidState fluidState) + { + return getBlockState().getBlock().shouldDisplayFluidOverlay(getBlockState(), world, pos, fluidState); + } }