public void load(CompoundTag tag) {
        clearContent();
        ListTag list = tag.getList(TAG_ITEMS, 10);
        for (int i = 0; i < list.size(); i++) {
            CompoundTag itemTag = list.getCompound(i);
            int slot = itemTag.contains("index") ? itemTag.getInt("index") : itemTag.getInt(TAG_SLOT); //TODO remove legacy support
            if (slot >= 0 && slot < getContainerSize()) {
                setItem(slot, ItemStack.of(itemTag));
            }
        }
    }
Simple extension of default vanilla Inventory class that allows for proper saving and loading
to a CompoundNBT. Default implementation does not load items back into their original slots.
<p>
Use {@link BaseContainer#save} and {@link BaseContainer#load} instead of Inventory#createTag and Inventory#fromTag
core/src/main/java/mrtjp/projectred/core/inventory/BaseContainer.java