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 0000000000..6f29fe5ffd Binary files /dev/null and b/src/test/resources/assets/custom_signs_test/textures/entity/signs/hanging/test.png differ