Jump to content

TheHolyChase

Members
  • Posts

    1
  • Joined

  • Last visited

TheHolyChase's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hello, I have begun creating my first mod which I am mostly using as a testing grounds to become familiar with the different things Forge is capable of. Currently I've only created very simple blocks with crafting recipes, loot tables, texturing, etc. As of the past 24 hours or so, I've been trying to understand how to create Tile Entities, specifically chests. Through my reading of the Forge Docs, I've concluded that it requires a a TileEntity inheritance, and an implementation of IItemHandler and/or ICapabilityProvider. I feel as if I've found some or all of the correct pieces to the puzzle, but I am unsure of how they fit together. I believe I've created a block that is technically a Tile Entity but has no functionality or GUI with the following code: public class ChestBlock extends BlockBase { public ChestBlock(Properties properties, String registryName) { super(properties, registryName); } @Override public boolean hasTileEntity(BlockState state) { return true; } @Nullable @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return new TestTileEntity(); } } public class TestTileEntity extends TileEntity { private NonNullList<ItemStack> chestContents; public TestTileEntity(TileEntityType<?> tileEntityTypeIn) { super(tileEntityTypeIn); } public TestTileEntity() { this(TileEntityLibrary.TEST_CHEST); } @Override public CompoundNBT write(CompoundNBT compound) { return super.write(compound); } @Override public void read(CompoundNBT compound) { super.read(compound); } } I've looked at some open source mods for guidance, but those I have looked at are rather complex and consist of many custom classes and implementations for inventories. I would just like to know what are the absolute most basic requirements for creating a custom chest. I do not need sided, orientation, animations, modeling, or any other functionality simply than being able to right click a block, it opens a GUI, and that tile entity is able to receive an ItemStack and properly sync it. If you need any more snippets of my code, please simply ask. Thank you.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.