From 0eb9d94bf3fe2a4ce22b4d048e85bd846b46642d Mon Sep 17 00:00:00 2001 From: Minecraftschurli Date: Mon, 23 Jan 2023 22:34:22 +0100 Subject: [PATCH] Fix missing hanging sign material for modded wood type (#9303) --- .../client/renderer/Sheets.java.patch | 3 +- .../debug/block/CustomSignsTest.java | 61 +++++++++++++++++- .../blockstates/test_hanging_sign.json | 5 ++ .../blockstates/test_wall_hanging_sign.json | 5 ++ .../models/block/test_hanging_sign.json | 5 ++ .../textures/entity/signs/hanging/test.png | Bin 0 -> 563 bytes 6 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 src/test/resources/assets/custom_signs_test/blockstates/test_hanging_sign.json create mode 100644 src/test/resources/assets/custom_signs_test/blockstates/test_wall_hanging_sign.json create mode 100644 src/test/resources/assets/custom_signs_test/models/block/test_hanging_sign.json create mode 100644 src/test/resources/assets/custom_signs_test/textures/entity/signs/hanging/test.png diff --git a/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch b/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch index f5981adf61..787be9d473 100644 --- a/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/Sheets.java.patch @@ -16,7 +16,7 @@ } public static Material m_173381_(WoodType p_173382_) { -@@ -190,5 +_,12 @@ +@@ -190,5 +_,13 @@ default: return p_110773_; } @@ -27,5 +27,6 @@ + */ + public static void addWoodType(WoodType woodType) { + f_110743_.put(woodType, m_173385_(woodType)); ++ f_244291_.put(woodType, m_245275_(woodType)); } } diff --git a/src/test/java/net/minecraftforge/debug/block/CustomSignsTest.java b/src/test/java/net/minecraftforge/debug/block/CustomSignsTest.java index f4eecd5509..791eddca7d 100644 --- a/src/test/java/net/minecraftforge/debug/block/CustomSignsTest.java +++ b/src/test/java/net/minecraftforge/debug/block/CustomSignsTest.java @@ -6,8 +6,13 @@ package net.minecraftforge.debug.block; import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; +import net.minecraft.client.renderer.blockentity.HangingSignRenderer; import net.minecraft.core.BlockPos; import net.minecraft.world.item.CreativeModeTabs; +import net.minecraft.world.item.HangingSignItem; +import net.minecraft.world.level.block.CeilingHangingSignBlock; +import net.minecraft.world.level.block.WallHangingSignBlock; +import net.minecraft.world.level.block.entity.HangingSignBlockEntity; import net.minecraft.world.level.material.Material; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.blockentity.SignRenderer; @@ -46,12 +51,16 @@ public class CustomSignsTest private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); public static final RegistryObject TEST_STANDING_SIGN = BLOCKS.register("test_sign", () -> new CustomStandingSignBlock(Properties.of(Material.WOOD).noCollission().strength(1.0F).sound(SoundType.WOOD), CustomSignsTest.TEST_WOOD_TYPE)); public static final RegistryObject TEST_WALL_SIGN = BLOCKS.register("test_wall_sign", () -> new CustomWallSignBlock(Properties.of(Material.WOOD).noCollission().strength(1.0F).sound(SoundType.WOOD), CustomSignsTest.TEST_WOOD_TYPE)); + public static final RegistryObject TEST_CEILING_HANGING_SIGN = BLOCKS.register("test_hanging_sign", () -> new CustomCeilingHangingSignBlock(Properties.of(Material.WOOD).noCollission().strength(1.0F).sound(SoundType.WOOD), CustomSignsTest.TEST_WOOD_TYPE)); + public static final RegistryObject TEST_WALL_HANGING_SIGN = BLOCKS.register("test_wall_hanging_sign", () -> new CustomWallHangingSignBlock(Properties.of(Material.WOOD).noCollission().strength(1.0F).sound(SoundType.WOOD), CustomSignsTest.TEST_WOOD_TYPE)); private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); public static final RegistryObject TEST_SIGN = ITEMS.register("test_sign", () -> new SignItem((new Item.Properties()).stacksTo(16), TEST_STANDING_SIGN.get(), TEST_WALL_SIGN.get())); + public static final RegistryObject TEST_HANGING_SIGN = ITEMS.register("test_hanging_sign", () -> new HangingSignItem(TEST_CEILING_HANGING_SIGN.get(), TEST_WALL_HANGING_SIGN.get(), (new Item.Properties()).stacksTo(16))); private static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MODID); public static final RegistryObject> CUSTOM_SIGN = BLOCK_ENTITIES.register("custom_sign", () -> BlockEntityType.Builder.of(CustomSignBlockEntity::new, TEST_WALL_SIGN.get(), TEST_STANDING_SIGN.get()).build(null)); + public static final RegistryObject> CUSTOM_HANGING_SIGN = BLOCK_ENTITIES.register("custom_hanging_sign", () -> BlockEntityType.Builder.of(CustomHangingSignBlockEntity::new, TEST_WALL_HANGING_SIGN.get(), TEST_CEILING_HANGING_SIGN.get()).build(null)); public CustomSignsTest() { @@ -71,12 +80,16 @@ public class CustomSignsTest private void addCreative(CreativeModeTabEvent.BuildContents event) { if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) + { event.accept(TEST_SIGN); + event.accept(TEST_HANGING_SIGN); + } } private void clientSetup(final FMLClientSetupEvent event) { BlockEntityRenderers.register(CUSTOM_SIGN.get(), SignRenderer::new); + BlockEntityRenderers.register(CUSTOM_HANGING_SIGN.get(), HangingSignRenderer::new); event.enqueueWork(() -> { Sheets.addWoodType(TEST_WOOD_TYPE); }); @@ -119,7 +132,8 @@ public class CustomSignsTest public static class CustomSignBlockEntity extends SignBlockEntity { - public CustomSignBlockEntity(BlockPos pos, BlockState state) { + public CustomSignBlockEntity(BlockPos pos, BlockState state) + { super(pos, state); } @@ -129,4 +143,49 @@ public class CustomSignsTest return CUSTOM_SIGN.get(); } } + + public static class CustomCeilingHangingSignBlock extends CeilingHangingSignBlock + { + + public CustomCeilingHangingSignBlock(Properties propertiesIn, WoodType woodTypeIn) + { + super(propertiesIn, woodTypeIn); + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) + { + return new CustomHangingSignBlockEntity(pos, state); + } + } + + public static class CustomWallHangingSignBlock extends WallHangingSignBlock + { + + public CustomWallHangingSignBlock(Properties propertiesIn, WoodType woodTypeIn) + { + super(propertiesIn, woodTypeIn); + } + + @Override + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) + { + return new CustomHangingSignBlockEntity(pos, state); + } + } + + public static class CustomHangingSignBlockEntity extends HangingSignBlockEntity + { + + public CustomHangingSignBlockEntity(BlockPos pos, BlockState state) + { + super(pos, state); + } + + @Override + public BlockEntityType getType() + { + return CUSTOM_HANGING_SIGN.get(); + } + } } diff --git a/src/test/resources/assets/custom_signs_test/blockstates/test_hanging_sign.json b/src/test/resources/assets/custom_signs_test/blockstates/test_hanging_sign.json new file mode 100644 index 0000000000..6eeaadf468 --- /dev/null +++ b/src/test/resources/assets/custom_signs_test/blockstates/test_hanging_sign.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "custom_signs_test:block/test_hanging_sign" } + } +} \ No newline at end of file diff --git a/src/test/resources/assets/custom_signs_test/blockstates/test_wall_hanging_sign.json b/src/test/resources/assets/custom_signs_test/blockstates/test_wall_hanging_sign.json new file mode 100644 index 0000000000..6eeaadf468 --- /dev/null +++ b/src/test/resources/assets/custom_signs_test/blockstates/test_wall_hanging_sign.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "custom_signs_test:block/test_hanging_sign" } + } +} \ No newline at end of file diff --git a/src/test/resources/assets/custom_signs_test/models/block/test_hanging_sign.json b/src/test/resources/assets/custom_signs_test/models/block/test_hanging_sign.json new file mode 100644 index 0000000000..164fa180ab --- /dev/null +++ b/src/test/resources/assets/custom_signs_test/models/block/test_hanging_sign.json @@ -0,0 +1,5 @@ +{ + "textures": { + "particle": "minecraft:block/oak_planks" + } +} diff --git a/src/test/resources/assets/custom_signs_test/textures/entity/signs/hanging/test.png b/src/test/resources/assets/custom_signs_test/textures/entity/signs/hanging/test.png new file mode 100644 index 0000000000000000000000000000000000000000..6f29fe5ffd8daaddff4c7593859228a3caa7ad1e GIT binary patch literal 563 zcmeAS@N?(olHy`uVBq!ia0vp^4nVBH!3-p)I`?e@QjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`RRVlMTsM7C-1$-3#Vjw-wtdGNq3s`K*FWOcl8#<+gDJ^p@!F5-K!wUN z??Gnrlmz(&|3?4@q5J2~0mV5BJR*x382Ao@Fyrz36)8ZA8$4YcLp;3ShFr`$V!*-7 zww^qN6J=wuxGi7m=f z+M(MRGR*EsYHpEy- zUz7V|ukB~GO*Z|w=fGQMcx+n2M-gA+LW z9tOue^V!DMA+N74tZ|h)g`v-Ox#siE9_u5Dek$5mxjTH~itm2vx~q3rP{{bY-hxGU z+>hr?f5*XjepYMJQ{@e}ms&fetuy>?U{jIN15#zwENR?daP2+MhMP;Rn|3yF&z#S2 z=oMH`*Ma)Z;{QMI{?xwt_LA&G-eHM-+yd>K%S!@_Whhikh{4m<&t;ucLK6U|{PYC? literal 0 HcmV?d00001