MinecraftScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a custom furnace"
/* To create a custom furnace in Minecraft Forge, you'll need to extend the AbstractFurnaceBlock class and create a custom TileEntity for it. */ // Custom Furnace Block public class CustomFurnaceBlock extends AbstractFurnaceBlock { public CustomFurnaceBlock() { super(AbstractBlock.Properties.copy(Blocks.FURNACE)); } @Override protected void openContainer(World world, BlockPos pos, PlayerEntity player) { TileEntity tileEntity = world.getBlockEntity(pos); if (tileEntity instanceof CustomFurnaceTileEntity) { player.openMenu((INamedContainerProvider) tileEntity); } } @Override public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new CustomFurnaceTileEntity(pos, state); } } // Custom Furnace TileEntity public class CustomFurnaceTileEntity extends AbstractFurnaceTileEntity { public CustomFurnaceTileEntity(BlockPos pos, BlockState state) { super(TileEntityTypeInit.CUSTOM_FURNACE_TILE_ENTITY.get(), pos, state, IRecipeType.SMELTING); } @Override protected ITextComponent getDefaultName() { return new TranslationTextComponent("container.custom_furnace"); } @Override protected Container createMenu(int id, PlayerInventory playerInventory) { return new FurnaceContainer(id, playerInventory, this, this.dataAccess); } } /* Don't forget to register your custom block and tile entity in your mod's registry. Also, create a custom container, recipe, and GUI for the furnace if needed. */