Arqade Asked on January 14, 2021
.
In Java Edition, I can test for a dropped item on the floor by using NBT:
/execute if entity @e[type=item,nbt={Item:{id:"minecraft:green_wool"}}]
But in Bedrock Edition, NBT is inaccessible from commands. Is there still a way to test for a dropped item on the ground?
What about testing for a named item drop?
This would allow you to run certain commands when a specific item is dropped, for example, if the player drops a compass they could be teleported to the spawn of your world, or have a message shown to them.
Browse more workarounds for getting/setting NBT in Bedrock Edition
/testfor @e[type=item,name="Ghast Tear"]
This command will activate when a ghast tear is dropped.
/kill @e[type=item,name="Lime Wool"]
This command runs when a Lime Wool is dropped.
/testfor @e[type=item,name="Spooky Pumpkin"]
If you name an item “Spooky Pumpkin” and drop it, this runs.
This is still compatible with the color formatting codes (§
), so don’t worry!
If your item name does not contain spaces and consists only of the characters in the following line, you may type the name directly, without having to include the quotation marks:
+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz
If your name contains a character not in this list, you will need to surround your name with quotation marks "
, like in the above examples. To include a quotation mark as part of the name, escape them with a :
/testfor @e[type=item,name="some name with spaces and "quotation marks""]
/testfor
of this may not reflect the number of dropped items, because when two items with the same properties are dropped next to each other, they like to group up into a single entity representing a stack of one or more items.Correct answer by Penguin on January 14, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP