This article is for Bedrock only, as Java can just use NBT or item components to give the special items directly.
Using /give
on bedrock only works for “basic” items, without any alterations like change of names or enchantments.
[!NOTE] You can use external programs (such as world editors or “hacks”) to get custom items, that are impossible to get, such as items with impossible enchantments.
Thus, a different method needs to be followed, of which there are multiple common ones.
The best method currently available, but doesn’t work for all kinds of custom entity data.
You can use loot tables to define items to be given and then use the /loot
command to give it/them to a player.
Thanks to loot table functions you can modify many things about these items, not only setting amount and data value, but name, lore, spawn eggs, enchantments, book contents and much more.
The best method currently available if you cannot use loot tables
Same as the structure block method below, but instead of loading it with a structureblock and teleporting the item, you load it using the /structure
command. It has the advantage over the block method that you don’t need to worry about the whole redstone block setting and the issues that come with that, you can just load the structure directly at the player in question and be done with it. It also is easy to use with add-ons as no blocks are needed and the structure can be distributed with the add-on by putting it into the bp/structures/
folder.
Make sure to save the structure with a structure void block inside, or the air might override whatever block the player is currently standing on.
Either use step 4 or step 6, reasons and problems see below
/setblock
or /fill
to destroy the container, making it drop its contents (and itself)/kill
the dropped container itemStep 4: requires you to either rename the container or hope the player is playing in english, because @e[type=item,name=”Chest”] only works in english. Alternatively you can change the language files for every language so all and every chest is called “Chest” in every language.
Step 6: Has the advantage that you don’t need to fiddle with the language files or renamed containers, but has the problem that the item may not be picked up instantly thus making it harder to set up properly.
Instead of storing the item in a chest, you store it in a structure block by saving a 1x1 structure that consists of just air and the item entities. So the step by step guide is:
This has the advantage that you don’t have to remove the container entity after you broke it and that the items don’t have a pickup delay anymore.
It has the disadvantage that it can take a tick or two for the structure to be loaded properly and thus for the item entity to appear, which means you need a delay in your functions.