Fix missing hanging sign material for modded wood type (#9303)

This commit is contained in:
Minecraftschurli authored and GitHub committed 2023-01-23 13:34:22 -08:00
1 parent 4d57a1bec6
commit 0eb9d94bf3
6 files changed
+77 -2

No files matched your search

@@ -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));
}
}
@@ -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<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);
public static final RegistryObject<CustomStandingSignBlock> 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<CustomWallSignBlock> 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<CustomCeilingHangingSignBlock> 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<CustomWallHangingSignBlock> 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<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
public static final RegistryObject<SignItem> 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<HangingSignItem> 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<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MODID);
public static final RegistryObject<BlockEntityType<CustomSignBlockEntity>> 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<BlockEntityType<CustomHangingSignBlockEntity>> 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<CustomHangingSignBlockEntity> getType()
{
return CUSTOM_HANGING_SIGN.get();
}
}
}
@@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "custom_signs_test:block/test_hanging_sign" }
}
}
@@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "custom_signs_test:block/test_hanging_sign" }
}
}
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "minecraft:block/oak_planks"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B