diff options
Diffstat (limited to 'src/main/java/moe/nea/funnyteleporters/FunnyRegistry.java')
-rw-r--r-- | src/main/java/moe/nea/funnyteleporters/FunnyRegistry.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/main/java/moe/nea/funnyteleporters/FunnyRegistry.java b/src/main/java/moe/nea/funnyteleporters/FunnyRegistry.java index 87f2c4f..7b3e3c2 100644 --- a/src/main/java/moe/nea/funnyteleporters/FunnyRegistry.java +++ b/src/main/java/moe/nea/funnyteleporters/FunnyRegistry.java @@ -1,31 +1,35 @@ package moe.nea.funnyteleporters; +import eu.pb4.polymer.core.api.block.PolymerBlockUtils; +import eu.pb4.polymer.core.api.item.PolymerBlockItem; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; +import net.minecraft.item.Items; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; public class FunnyRegistry { - public static final String MODID = "funny_teleporters"; - public static Block COLOURED_CHEST = registerBlock("coloured_chest", new ColouredChestBlock(AbstractBlock.Settings.create())); + public static Block COLOURED_CHEST = registerBlock("coloured_chest", new ColouredChestBlock(AbstractBlock.Settings.create()), Items.RED_WOOL); public static BlockEntityType<ColouredChestBlockEntity> COLOURED_CHEST_ENTITY = registerBlockEntity("coloured_chest", BlockEntityType.Builder.create(ColouredChestBlockEntity::new, COLOURED_CHEST)); private static <T extends BlockEntity> BlockEntityType<T> registerBlockEntity(String name, BlockEntityType.Builder<T> builder, Block... blocks) { - return Registry.register(Registries.BLOCK_ENTITY_TYPE, - Identifier.of(MODID, name), - builder.build() + var be = Registry.register(Registries.BLOCK_ENTITY_TYPE, + Identifier.of(FunnyTeleporters.MOD_ID, name), + builder.build() ); + PolymerBlockUtils.registerBlockEntity(be); + return be; } - private static <T extends Block> T registerBlock(String name, T block) { - var id = Identifier.of(MODID, name); - Registry.register(Registries.ITEM, id, new BlockItem(block, new Item.Settings())); + private static <T extends Block> T registerBlock(String name, T block, Item blockItem) { + var id = Identifier.of(FunnyTeleporters.MOD_ID, name); + Registry.register(Registries.ITEM, id, new PolymerBlockItem(block, new Item.Settings(), blockItem)); return Registry.register(Registries.BLOCK, id, block); } |