Restoring Inventories

For my sake, I'm making this. It took me forever to remember how to do this so next time I go to look I can look here :emoji_stuck_out_tongue:.

The player's inventory has 36 inventory slots, 1 offhand slot, and 4 armor slots. (As well as crafting slots and whatnot but we aren't going to touch that) The inventory slot's ids are 0-35, the armor slots are 36-39 and the offhand slot id is 40. So, with this information we can make a list variable and loop it to save and restore inventories. Just like so: