Exemplo n.º 1
0
  public void readFromNBT(NBTTagCompound compound) {
    super.readFromNBT(compound);
    NBTTagList nbttaglist = compound.getTagList("Items", 10);
    this.chestContents = new ItemStack[this.getSizeInventory()];

    if (compound.hasKey("CustomName", 8)) {
      this.customName = compound.getString("CustomName");
    }

    for (int i = 0; i < nbttaglist.tagCount(); ++i) {
      NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
      int j = nbttagcompound.getByte("Slot") & 255;

      if (j >= 0 && j < this.chestContents.length) {
        this.chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound);
      }
    }
  }
Exemplo n.º 2
0
  public void writeToNBT(NBTTagCompound compound) {
    super.writeToNBT(compound);
    NBTTagList nbttaglist = new NBTTagList();

    for (int i = 0; i < this.chestContents.length; ++i) {
      if (this.chestContents[i] != null) {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        nbttagcompound.setByte("Slot", (byte) i);
        this.chestContents[i].writeToNBT(nbttagcompound);
        nbttaglist.appendTag(nbttagcompound);
      }
    }

    compound.setTag("Items", nbttaglist);

    if (this.hasCustomName()) {
      compound.setString("CustomName", this.customName);
    }
  }
Exemplo n.º 3
0
  public void writeToNBT(NBTTagCompound compound) {
    super.writeToNBT(compound);
    compound.setShort("BurnTime", (short) this.furnaceBurnTime);
    compound.setShort("CookTime", (short) this.field_174906_k);
    compound.setShort("CookTimeTotal", (short) this.field_174905_l);
    NBTTagList var2 = new NBTTagList();

    for (int var3 = 0; var3 < this.furnaceItemStacks.length; ++var3) {
      if (this.furnaceItemStacks[var3] != null) {
        NBTTagCompound var4 = new NBTTagCompound();
        var4.setByte("Slot", (byte) var3);
        this.furnaceItemStacks[var3].writeToNBT(var4);
        var2.appendTag(var4);
      }
    }

    compound.setTag("Items", var2);

    if (this.hasCustomName()) {
      compound.setString("CustomName", this.furnaceCustomName);
    }
  }
Exemplo n.º 4
0
  public void readFromNBT(NBTTagCompound compound) {
    super.readFromNBT(compound);
    NBTTagList var2 = compound.getTagList("Items", 10);
    this.furnaceItemStacks = new ItemStack[this.getSizeInventory()];

    for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
      NBTTagCompound var4 = var2.getCompoundTagAt(var3);
      byte var5 = var4.getByte("Slot");

      if (var5 >= 0 && var5 < this.furnaceItemStacks.length) {
        this.furnaceItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
      }
    }

    this.furnaceBurnTime = compound.getShort("BurnTime");
    this.field_174906_k = compound.getShort("CookTime");
    this.field_174905_l = compound.getShort("CookTimeTotal");
    this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);

    if (compound.hasKey("CustomName", 8)) {
      this.furnaceCustomName = compound.getString("CustomName");
    }
  }
Exemplo n.º 5
0
 /** invalidates a tile entity */
 public void invalidate() {
   super.invalidate();
   this.updateContainingBlockInfo();
   this.checkForAdjacentChests();
 }
Exemplo n.º 6
0
 public void updateContainingBlockInfo() {
   super.updateContainingBlockInfo();
   this.adjacentChestChecked = false;
 }