From 073e3980eee75e39aa2d24caa1d7fa74ca9f817d Mon Sep 17 00:00:00 2001 From: Snownee <1850986885@qq.com> Date: Sun, 8 Nov 2020 16:29:58 +0800 Subject: [PATCH] Fix water rendering overlay on glass blocks --- .../data/minecraft/tags/blocks/impermeable.json | 16 ++++++++++++++++ .../content/palettes/AllPaletteBlocks.java | 3 ++- .../content/palettes/ConnectedGlassBlock.java | 8 ++++++++ .../create/foundation/data/WindowGen.java | 4 +++- 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/generated/resources/data/minecraft/tags/blocks/impermeable.json diff --git a/src/generated/resources/data/minecraft/tags/blocks/impermeable.json b/src/generated/resources/data/minecraft/tags/blocks/impermeable.json new file mode 100644 index 000000000..4c49ba81a --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/blocks/impermeable.json @@ -0,0 +1,16 @@ +{ + "replace": false, + "values": [ + "create:tiled_glass", + "create:framed_glass", + "create:horizontal_framed_glass", + "create:vertical_framed_glass", + "create:oak_window", + "create:spruce_window", + "create:birch_window", + "create:jungle_window", + "create:acacia_window", + "create:dark_oak_window", + "create:ornate_iron_window" + ] +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/content/palettes/AllPaletteBlocks.java b/src/main/java/com/simibubi/create/content/palettes/AllPaletteBlocks.java index 538c715b7..2ad7578b0 100644 --- a/src/main/java/com/simibubi/create/content/palettes/AllPaletteBlocks.java +++ b/src/main/java/com/simibubi/create/content/palettes/AllPaletteBlocks.java @@ -29,6 +29,7 @@ import net.minecraft.block.GlassBlock; import net.minecraft.block.SandBlock; import net.minecraft.block.WoodType; import net.minecraft.client.renderer.RenderType; +import net.minecraft.tags.BlockTags; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.Tags; @@ -45,7 +46,7 @@ public class AllPaletteBlocks { .addLayer(() -> RenderType::getCutoutMipped) .recipe((c, p) -> p.stonecutting(DataIngredient.tag(Tags.Items.GLASS_COLORLESS), c::get)) .blockstate(palettesCubeAll()) - .tag(Tags.Blocks.GLASS_COLORLESS) + .tag(Tags.Blocks.GLASS_COLORLESS, BlockTags.IMPERMEABLE) .item() .tag(Tags.Items.GLASS_COLORLESS) .build() diff --git a/src/main/java/com/simibubi/create/content/palettes/ConnectedGlassBlock.java b/src/main/java/com/simibubi/create/content/palettes/ConnectedGlassBlock.java index 7d37253bb..cf25eaa11 100644 --- a/src/main/java/com/simibubi/create/content/palettes/ConnectedGlassBlock.java +++ b/src/main/java/com/simibubi/create/content/palettes/ConnectedGlassBlock.java @@ -2,7 +2,10 @@ package com.simibubi.create.content.palettes; import net.minecraft.block.BlockState; import net.minecraft.block.GlassBlock; +import net.minecraft.fluid.IFluidState; import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.ILightReader; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -19,4 +22,9 @@ public class ConnectedGlassBlock extends GlassBlock { : super.isSideInvisible(state, adjacentBlockState, side); } + @Override + public boolean shouldDisplayFluidOverlay(BlockState state, ILightReader world, BlockPos pos, IFluidState fluidState) { + return true; + } + } diff --git a/src/main/java/com/simibubi/create/foundation/data/WindowGen.java b/src/main/java/com/simibubi/create/foundation/data/WindowGen.java index 5409a8f36..68a20a423 100644 --- a/src/main/java/com/simibubi/create/foundation/data/WindowGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/WindowGen.java @@ -29,6 +29,7 @@ import net.minecraft.block.Blocks; import net.minecraft.block.WoodType; import net.minecraft.client.renderer.RenderType; import net.minecraft.data.ShapedRecipeBuilder; +import net.minecraft.tags.BlockTags; import net.minecraft.util.IItemProvider; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.generators.ModelFile; @@ -77,6 +78,7 @@ public class WindowGen { .loot((t, g) -> t.registerSilkTouch(g)) .blockstate((c, p) -> p.simpleBlock(c.get(), p.models() .cubeColumn(c.getName(), sideTexture.apply(c.getName()), endTexture.apply(c.getName())))) + .tag(BlockTags.IMPERMEABLE) .simpleItem() .register(); } @@ -89,7 +91,7 @@ public class WindowGen { .loot((t, g) -> t.registerSilkTouch(g)) .recipe((c, p) -> p.stonecutting(DataIngredient.tag(Tags.Items.GLASS_COLORLESS), c::get)) .blockstate((c, p) -> BlockStateGen.cubeAll(c, p, "palettes/", "framed_glass")) - .tag(Tags.Blocks.GLASS_COLORLESS) + .tag(Tags.Blocks.GLASS_COLORLESS, BlockTags.IMPERMEABLE) .item() .tag(Tags.Items.GLASS_COLORLESS) .model((c, p) -> p.cubeColumn(c.getName(), p.modLoc(palettesDir() + c.getName()),