How to Make a Block Entity in Minecraft 26.3 (Fabric)
Spore Clusters on their own are just fungus. In this episode they become metal: we build the Culture Vat, a block that takes Spore Clusters and slowly grows them into Sporesteel Ingots. It is our first block entity, a block with its own inventory, timer and screen.
What you need: the Sporesteel project from episode 2, Minecraft 26.3, Fabric Loader 0.20.1, Fabric API 0.165.2+26.3 and Java 25.
The Sporesteel Ingot
First the output item, registered in ModItems exactly like the Spore Cluster in episode 1.
The Culture Vat block
The block implements EntityBlock so the game creates a block entity for it, and hands out a ticker so it can grow every tick.
The block entity
CultureVatBlockEntity holds two slots (spores in, ingot out) and a progress counter. Every tick with spores inside, progress goes up; when it is full, one Spore Cluster is used up and an ingot appears.
Saving progress
Without saving, the vat forgets everything when the chunk unloads. We write the inventory and progress in saveAdditional and read them in loadAdditional.
The screen
A menu syncs the slots and progress to the client, and a screen draws the vat with a growing progress bar.
Recap
You built your first block entity: a Culture Vat with an inventory, a timer that survives reloads and its own screen. Next episode we use the ingots to make Sporesteel tools and armor.
Frequently asked questions
What is a block entity in Minecraft?
A block entity is extra data and logic attached to one block position, such as a chest's inventory or a furnace's cooking progress. Plain blocks share one state per type; block entities store per-block data and can run code every tick.
How do you make a block entity tick in Fabric?
Make the block implement EntityBlock, return the block entity from newBlockEntity, and return a ticker from getTicker that calls your static tick method on the server side.
Why does my block entity lose its data when I reload the world?
Its values are not being saved. Write them in saveAdditional and read them back in loadAdditional, and call setChanged() whenever they change so the chunk is marked for saving.
How do you add a GUI to a block entity?
Register a MenuType, create a menu class with the slots and synced progress data, open it from the block's use method, and register a client screen for the menu type.