Clearing inventory, then returning items back

Started by sagakan912 on

Topic category: Help with modding (Java Edition)

Last seen on 00:28, 25. Jul 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Clearing inventory, then returning items back

I'va been working on a mod, where when players enters specific dimension, it's inventory is cleared, and I put new items in there. But once player gets out of this dimension all items are returned to player's inventory

I am new to mcreator so I don't know how to create code that would do this, and I would appreciate any help!

Last seen on 17:02, 25. Jun 2024
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It's possible with a global…
Sat, 12/09/2023 - 21:12

It's possible with a global variable that register each item of the inventory.

I have not used MCreator for a long time so I don't remember if you can create a list of variable or something like that, but if it's possible you can manage with a loop that check each slot of the inventory and add the item in a list.