Forum


Notifications
Clear all

MCPE/Bedrock Item name detection

McBedrock
(@mcbedrock1)
Illustrious Member Admin

Item name detection

 

Have you ever wanted to be able to detect item names with a command? Well, now you can with this addon. All item names can be detected through tags and when paired with the hasitem command this gives you so much more power to create. 

How it works:
you will receive a tag for every item in your inventory, hotbar, armor slots, mainhand, and offhand these tags have the slot name, slot index, and item name

the item slots are the same as the vanilla item slots ex: slot.armor.head, slot.armor.chest, slot.armor.legs, slot.armor.feet, slot.inventory, slot.hotbar, slot.weapon.mainhand, and slot.weapon.offhand

the second perimeter is the slot index which for items like armor defaults to 0 and for the inventory/hotbar are the same has ingame indexs ex: 0-26 and 0-8 

the last perimeter is the item name which if the item doesn't have a name it will default to the default name ex: a unnamed diamond boots defaults to Diamond Boots

and all three of the perimeters are separated by / to split up arguments 

examples:
if I wanted to test for a diamond helmet on my head named Test Helmet  I would use @p[tag="slot.armor.head/0/Test Helmet"]
if you notice I use the armor slot for the head first slot.armor.head then the index which defaults to 0 for armor and the item name Test Helmet

if I wanted to test for a diamond in my last hotbar slot named Money I would use @p[tag="slot.hotbar/8/Money"]
if you notice I use the hotbar slot first slot.hotbar then the index which for my case would be 8 and the item name Money

Command to effect me with speed when I am holding a diamond sword named Speed
 

If you would like to effect someone with speed when holding an anyitem named speed you would do /effect @a[tag="slot.weapon.mainhand/0/speed"] speed 1 1

if you still have questions or aren't super well-versed in commands feel free to join my discord server to ask questions
discord: https://discord.gg/TC7U6x9H

 

Installation

1. Turn on the experiment Beta APIs

2. Add the addon to your behavior packs 

creator: https://www.youtube.com/channel/UCUKB2Klf2Nkfi8reaxmdo0w

Downloads

Quote
Topic starter Posted : 27/04/2023 6:32 pm
Share: