#Is it possible to find out if the player has an item in the inventory ?

1 messages · Page 1 of 1 (latest)

edgy nest
#

Not just on one slot, but on all slots ?

woven rune
#

use q.is_item_name_any but with slot.inventory

edgy nest
#

This work for slot 0 but dos'nt work for other slot :(

next saddle
#

You can do it like this "query.is_item_name_any('slot.inventory', 0, 'minecraft:golden_sword' + query.is_item_name_any('slot.inventory', 1, 'minecraft:golden_sword')

#

Etc

edgy nest
#

I've other solution

#
variable.has_sword = 0; t.i = 0; loop(9, {
  variable.has_sword = ( q.is_item_name_any('slot.hotbar', t.i, 'minecraft:golden_sword') );

  variable.has_sword ? { return variable.has_sword; };
  
  t.i = t.i + 1;
});"