I have an issue with my backpack

Started by nicotron100 on

Topic category: Troubleshooting, bugs, and solutions

Last seen on 21:20, 4. Jan 2023
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have an issue with my backpack

I tried to create a backpack and it worked, but then I realized that when I put an item, close the gui and move the backpack from slot and inventory when trying to reopen it, the items are deleted, I'm in version of mcreator 2022.2 please any help is welcome, thanks

 

Icono de Validado por la comunidad


 

Last seen on 20:08, 17. Apr 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Did you make the item have…
Mon, 01/02/2023 - 16:55

Did you make the item have entity data so it can hold items? If you just made an item that opens a GUI when it's in the correct slot, then the GUI won't save items in it by default. Here's my recommendation for a backpack:

  • Add a custom GUI that opens next to the inventory when the backpack is in the correct armor slot.
  • Add itemstack variables for each slot of the backpack. When an item is added to a slot, update the item variables to that item. When an item is removed, reset the item variable to an empty itemstack. This way, the items will be deleted when the GUI is closed, but placed back in when the GUI is opened. 
  • When the backpack is removed, or the player is killed, make a procedure that drops each of the items inside it, and resets the item variables for that player.

It's a bit more complicated, but I'd say that's a good basis. If you're just trying to create an item that holds other items, it won't be any different from a Shulker Box.

Last seen on 21:20, 4. Jan 2023
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
yes, im trying to make an…
Wed, 01/04/2023 - 14:23

yes, im trying to make an item like a shulkerbox but without placing anything