ID System (Item & Block ids)
Minecraft has stopped using their legacy id system from the 1.13 update and up-wards. That means that legacy id's will only work for 1.8.*-1.12.* . This ID system has been created to help with this.
Last updated
Minecraft has stopped using their legacy id system from the 1.13 update and up-wards. That means that legacy id's will only work for 1.8.*-1.12.* . This ID system has been created to help with this.
Last updated
The simplest form of getting a numeric id for both legacy ids (1.8-1.12) and the flattened ids is to use the static Blocks.Instance global variable.
Example usage:
Note how GetId() returns a ushort?, this means that in cases where the passed string, in this case "minecraft:resdstone_lamp" is not a valid or a matching name, then null is returned.
This null mechanism is useful in casses where Minecraft uses different names for different versions, as in some cases you can do the following:
There are also more functions on Blocks.Instance that make it easier to work with ids. The notable ones are:
Blocks.Instance.GetIds - get an array of ids for an array of inputs, example usage:
...
Item ids work in the exact same way as the Block system, except it uses *Items*.Instance.GetId, instead of *Blocks*.Instance.GetId!
Example usage:
Note how GetId() returns a ushort?, this means that in cases where the passed string, in this case "minecraft:fishing_rod" is not a valid or a matching name, then null is returned.
This null mechanism is useful in casses where Minecraft uses different names for different versions, as in some cases you can do the following:
There are also more functions on Items.Instance that make it easier to work with ids. The notable ones are:
Items.Instance.GetIds - get an array of ids for an array of inputs, example usage:
...