Way of altering entity's item in hand

Started by Vision Quester on

Topic category: Feature requests and ideas for MCreator

Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Way of altering entity's item in hand
Sun, 03/22/2020 - 16:42 (edited)

Hi.  It would be nice if we could do more with an entity's item in hand.  Example: read the quantity of the item in hand, change the quantity of the item in hand, and change the item in hand for another item.  I know we can read the item in hand and remove it from the inventory.  But there's no way to find out how many he's holding in his hand so we can remove just the amount in hand.

Application: I'm trying to make a garbage can that, when right clicked on, will remove the item in hand.  All we can do now is just remove the item in hand from the inventory.  But if the player wants to keep some of the item in the inventory and just destroy the amount in his hand, I need to know how many he has in his hand.  Otherwise I have to settle for just removing 1 item at a time, meaning the player has to click 40 times to destroy a stack of 40 items in hand.  Or, if I arbitrarily write the code to destroy 64 quantity of the item in hand, when he's holding only 40, it would end up destroying more than he wants to destroy from his inventory if he wants to keep some of it.

It would also be nice to be able to change the item in hand, for example, changing an empty custom bucket for a full one and vice-versa, or changing a bucket of one custom fluid for another custom fluid, by directly affecting the item in hand.

Edited by Vision Quester on Sun, 03/22/2020 - 16:42