"Get current slot ID of [itemstack] if it is in an inventory" procedure block

Started by Oofeiro on

Topic category: Feature requests and ideas for MCreator

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
"Get current slot ID of [itemstack] if it is in an inventory" procedure block

My suggestion is to add a "Get current slot ID of [itemstack] if it is in an inventory" procedure block, making it easier to manage actions based on whether an item is in a specific GUI slot.

For example, I want to check if a specific item is in the player's inventory and then verify if that item is in a slot other than the offhand slot (ID = 40) before removing it. With this new block, it would be possible to check the item's slot ID and compare it to other values.


In the Blockly editor, it could look something like this:

 

if 'Has [entity] in inventory [item] (match item and data components)'

do if 'Get current slot ID of [item] if it is in an inventory' ≠ 40:

     do 'Remove 1 [item] from [entity] main inventory'

 

Maybe there’s a way to achieve this with the current procedure blocks in MCreator, but I’m not sure. I hope this suggestion reaches the Devs!