MinecraftScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a custom furnace"
/* To create a custom furnace, you'll need to extend the AbstractFurnaceBlock class and create a custom TileEntity that extends AbstractFurnaceTileEntity. Here's an example of how to create a custom furnace block and its corresponding TileEntity: */ // CustomFurnaceBlock.java public class CustomFurnaceBlock extends AbstractFurnaceBlock { public CustomFurnaceBlock(AbstractBlock.Properties properties) { super(properties); } @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); } } // CustomFurnaceTileEntity.java 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 furnace block and TileEntityType in the appropriate registries. */