So I ran into a problem with taking items from player's inventory slots...

Started by bananarang_mods on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So I ran into a problem with taking items from player's inventory slots...
Sat, 10/16/2021 - 14:54 (edited)

I am making a mod that takes an item out of your inventory when you right-click on a block with the item (I used the [Remove [] [Item] from main inventory] block), it worked but it was always taking an item from the slot with the smallest ID instead of taking it from the stack in my hand (same with the off-hand, it takes from the smallest-ID slot that has the item rather than the off-hand). Is there an easy fix for this? Please tell me in the comments

Edited by bananarang_mods on Sat, 10/16/2021 - 14:54
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
set item in main hand of…
Sat, 10/16/2021 - 15:02

set item in main hand of event target entity to get items in|main hand of event target entity - 1 Item in main hand of event target entity

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
basically this should be…
Sat, 10/16/2021 - 15:04

basically this should be your procedure: if item in main hand of event target entity = ITEM

do Procedure Above

else remove 1 from event target entity inventory