/**
   * Standard method to read the fluids data of this TE from the NBTCompound that stores this TE's
   * Data.
   *
   * @param inventoryCompound A NBTBase instance in the form of a TagList containing all the Data of
   *     the fluids in this tileentity.
   */
  protected void readFluidsFromCompound(NBTBase inventoryCompound) {
    if (!(inventoryCompound instanceof NBTTagList))
      throw new IllegalArgumentException("The given store type is not compatible with this TE!");

    IFluidContainingEntity fluidContainingEntity = (IFluidContainingEntity) this;

    NBTTagList inventoryList = (NBTTagList) inventoryCompound;
    ArrayList<FluidStack> fluidStacks = new ArrayList<FluidStack>();

    for (int i = 0; i < inventoryList.tagCount(); i++) {
      NBTTagCompound fluidCompound = (NBTTagCompound) inventoryList.get(i);

      fluidStacks.add(FluidStack.loadFluidStackFromNBT(fluidCompound));
    }

    fluidContainingEntity.setAllFluids(fluidStacks);
  }
  /**
   * Standard method to read the inventory data of this TE from the NBTCompound that stores this
   * TE's Data.
   *
   * @param inventoryCompound A NBTBase instance in the form of a TagList containing all the Data of
   *     the Slots in this inventory.
   */
  protected void readInventoryFromCompound(NBTBase inventoryCompound) {
    if (inventoryCompound == null) return;

    if (!(inventoryCompound instanceof NBTTagList))
      throw new IllegalArgumentException("The given store type is not compatible with this TE!");

    IItemStorage inventory = (IItemStorage) this;
    NBTTagList inventoryList = (NBTTagList) inventoryCompound;

    ((IItemStorage) this).clearInventory();

    for (int i = 0; i < inventoryList.tagCount(); i++) {
      NBTTagCompound slotCompound = (NBTTagCompound) inventoryList.get(i);

      ItemStack newStack =
          ItemStack.loadItemStackFromNBT(
              slotCompound.getCompoundTag(CoreReferences.NBT.InventoryData.STACKDATA));

      inventory.setInventorySlotContents(
          slotCompound.getInteger(CoreReferences.NBT.InventoryData.SLOTINDEX), newStack);
    }
  }