Save inventory to paste back later

Started by kolokythi on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Save inventory to paste back later

So i'm trying to copy a players inventory and then be able to paste it back in the same space with the same durability later how do I do this
(or if space is taken up with an item to have it be put in a random slot or dropped on the ground)

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could always create…
Sun, 02/09/2025 - 11:03

You could always create several global variables corresponding to the player's inventory slot.

For example:

Adding Variables

Make a new global variable, name it whatever, set it to "itemstack" and "player persistent"

Then:

Procedure for setting custom variable

set up your procedure like this.

 

What this does here is it sets the global variable for the item slot to the item we selected.

 

For pasting:

Variable procedure 2

this will set the item with the saved item using the variable.

There is likely a more efficient way, this is what came to mind first.

I hope this helps.

Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
okay im gonna try this  
Sun, 02/09/2025 - 11:52

okay im gonna try this

 

Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i dont have access to the …
Sun, 02/09/2025 - 11:56

i dont have access to the "set itemstack _ to: _ for entity _" block

Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i also cant put "event…
Sun, 02/09/2025 - 11:59

i also cant put "event/target entity" in the "get copy of item from slot _ of _ if it has inventory"

 

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Your global variable needs…
Sun, 02/09/2025 - 20:52

Your global variable needs to be a "player persistent" variable for this to work.

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also I modified the blocks…
Sun, 02/09/2025 - 20:53

Also I modified the blocks using data blocks, so look through everything until you can find what you need to recreate it.

I am willing to help more if you need it.