Block and Item Id¶
This page will explain the id system of block and item.
Overview¶
In Minecraft: Bedrock Edition, all blocks must have a correspond hard block item
. But not every item have a correspond block.
If an item does not have a correspond block, then we call it pure item
. The texture of hard block item
is decided by the block's
texture and cannot be changed. To solve this problem, the vanilla also registered extra block item for some blocks (e.g. cake,
cauldron, grass, kelp, bed, sugar cane, etc.). We called these extra block items actual block item
.
When a block only have one correspond block item, hard block item
is equal to actual block item
. Most of the blocks in vanilla
are like this.
How Blocks & Items are Registered and How the Order Affect the Id¶
The register order of blocks and items in vanilla:
- Register all
pure item
andactual block item
. - Register all blocks, and try to register
hard block item
with the same id of block for each block, and there are two cases:- There is no
actual block item
that already registered with the same id, which means that this block only have one correspond block item. We can say that thehard block item
is equal to theactual block item
of this block. - There is an
actual block item
that already registered with the same id, which means that thehard block item
andactual block item
of this block is different. However, thehard block item
will still be registered, and to solve the conflict, a perfixitem.
will be added to the path of the id.
- There is no
Here, we will take cake (whose hard block item
is different from its actual block item
) as an example:
- Register the
actual block item
:minecraft:cake
. - Register the block:
minecarft:cake
. - Try to register the
hard block item
with the same id of block:minecraft:cake
. But there is already anactual block item
with the same id, so thehard block item
will be registered with the idminecraft:item.cake
.
Special Cases¶
Normally, for a block, you can find an item of the same block ID. But there are special cases here (for historical reasons):
Block Id | Actual Block Item Id | Hard Block Item Id |
---|---|---|
minecraft:reeds | minecraft:item.reeds |
How Allay Handles Block and Item Id¶
To unify naming and reduce confusion. In Allay, we ensure that the hard block item
's id of the registered block is the same as the block's id
without an id conflict. If you want to register extra block item for your block, please make sure that it has the same id of the block you want
to register extra block item for. Later when registering the block, Allay will consider the item you registered as the actual block item
, and
register the hard block item
with a item.
prefix.
The return value of BlockType#getItemType()
will be the actual block item
instead of the hard block item
if the block has extra block item.