@Override
  public void readFromNBT(final NBTTagCompound tag) {
    super.readFromNBT(tag);

    this.age = tag.getLong("age");

    this.inventories.clear();

    final NBTTagCompound inventoriesTag = tag.getCompoundTag("inventories");

    for (final Object key : inventoriesTag.getKeySet()) {
      final String inventoryName = (String) key;
      final NBTTagList inventoryTag = inventoriesTag.getTagList(inventoryName, tag.getId());
      final Map<Integer, ItemStack> inventory = new HashMap<>();

      for (int i = 0; i < inventoryTag.tagCount(); i++) {
        final NBTTagCompound slotTag = inventoryTag.getCompoundTagAt(i);
        final ItemStack stack = ItemStack.loadItemStackFromNBT(slotTag);

        inventory.put((int) slotTag.getByte("slot"), stack);
      }

      this.inventories.put(inventoryName, inventory);
    }

    this.setOwner(NBTUtil.readGameProfileFromNBT(tag.getCompoundTag("owner")));
  }
  public void readCustomNBT(NBTTagCompound tag) {

    NBTTagList invList = tag.getTagList("Inventory", tag.getId());

    for (int s = 0; s < invList.tagCount(); s++) {

      NBTTagCompound invComp = invList.getCompoundTagAt(s);

      int slot = invComp.getByte("Slot");

      if (slot >= 0 && slot < getSizeInventory()) {

        setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(invComp));
      }
    }
  }
 @Override
 public void readFromNBT(NBTTagCompound tag) {
   super.readFromNBT(tag);
   // read inventory from nbt
   NBTTagList tags = tag.getTagList("inventory", tag.getId());
   for (int i = 0; i < tags.tagCount(); i++) {
     NBTTagCompound compound = tags.getCompoundTagAt(i);
     short slot = compound.getShort("slot");
     if ((slot >= 0) && (slot < inventory.length)) {
       inventory[slot] = ItemStack.loadItemStackFromNBT(compound);
     }
   }
   // read base block position
   baseX = tag.getInteger("baseX");
   baseY = tag.getInteger("baseY");
   baseZ = tag.getInteger("baseZ");
   // read name
   name = tag.getString("name");
 }