Started by
BMAgamer
on
Topic category: Help with modding (Java Edition)
So I want to make it that when the player enters a certain dimension, their inventory is cleared, but when they go back to the overworld, their original inventory is replenished. How would I do this.
There's almost certainly a better way of saving large numbers of item slots... but if you're willing to brute force it, you can make 36 player-persistent itemstack variables, one for each inventory slot. When the player enters the dimension, before you clear their inventory, set each of these variables to the item in the corresponding slot. When they return from your custom dimension, run a procedure that puts each item variable back in its corresponding slot.
You can find variables in their own tab in the main workspace. Again though, it may be worth looking into better solutions. (Though I can say I've tried stuff like this, and it will work.)