Example #1
0
  @Override
  public void writeToNBT(NBTTagCompound nbttagcompound) {
    super.writeToNBT(nbttagcompound);

    Utils.writeStacksToNBT(nbttagcompound, "Items", items);

    if (box.isInitialized()) {
      NBTTagCompound boxStore = new NBTTagCompound();
      box.writeToNBT(boxStore);
      nbttagcompound.setTag("box", boxStore);
    }

    if (path != null) {
      NBTTagList list = new NBTTagList();

      for (BlockIndex i : path) {
        NBTTagCompound c = new NBTTagCompound();
        i.writeTo(c);
        list.appendTag(c);
      }

      nbttagcompound.setTag("path", list);
    }

    nbttagcompound.setBoolean("done", done);
  }
 @Override
 public void writeToNBT(NBTTagCompound compound) {
   super.writeToNBT(compound);
   NBTTagList list = new NBTTagList();
   for (int i = 0; i < contents.length; i++) {
     if (contents[i] == null) continue;
     NBTTagCompound item = new NBTTagCompound();
     item.setByte("Slot", (byte) i);
     contents[i].writeToNBT(item);
     list.appendTag(item);
   }
   compound.setTag("Items", list);
   if (lock != null) compound.setCompoundTag("lock", lock.writeToNBT(new NBTTagCompound("")));
 }
  /** Writes a tile entity to NBT. */
  public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
    super.writeToNBT(par1NBTTagCompound);
    NBTTagList var2 = new NBTTagList();

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

    par1NBTTagCompound.setTag("Items", var2);
  }
 @Override
 public void writeToNBT(NBTTagCompound ntc) {
   super.writeToNBT(ntc);
   ntc.setInteger("grindingTicks", this.grindingTicks);
   NBTTagList list = new NBTTagList();
   for (int i = 0; i < inv.length; ++i) {
     if (this.inv[i] != null) {
       NBTTagCompound ntc2 = new NBTTagCompound();
       ntc2.setByte("Slot", (byte) i);
       this.inv[i].writeToNBT(ntc2);
       list.appendTag(ntc2);
     }
   }
   ntc.setTag("Items", list);
 }
Example #5
0
  public void afterWriteEntityToNBT(NBTTagCompound tags) {
    if (player.worldObj.isRemote) return;
    NBTTagCompound customData = new NBTTagCompound();
    NBTTagList unlocks = new NBTTagList();
    for (PlaneType type : FlansMod.blueprintsUnlocked) {
      unlocks.appendTag(new NBTTagString("Plane", type.shortName));
    }
    customData.setTag("Unlocks", unlocks);
    NBTTagList vehicleUnlocks = new NBTTagList();
    for (VehicleType type : FlansMod.vehicleBlueprintsUnlocked) {
      vehicleUnlocks.appendTag(new NBTTagString("Vehicle", type.shortName));
    }
    customData.setTag("VehicleUnlocks", vehicleUnlocks);
    customData.setBoolean("DoneTutorial", FlansMod.doneTutorial);

    // Store the data
    try {
      File file = new File(FlansModHandler.getSaveDirectory(player.worldObj), "Flan.dat");
      CompressedStreamTools.writeCompressed(customData, new FileOutputStream(file));
    } catch (IOException ioexception) {
      ioexception.printStackTrace();
      throw new RuntimeException("Failed to create data for Flan's mod.");
    }
  }
  /** Writes a tile entity to NBT. */
  public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
    super.writeToNBT(par1NBTTagCompound);
    par1NBTTagCompound.setShort("BurnTime", (short) this.freezerBurnTime);
    par1NBTTagCompound.setShort("CookTime", (short) this.freezerCookTime);
    NBTTagList var2 = new NBTTagList();

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

    par1NBTTagCompound.setTag("Items", var2);
  }
  public void writeToNBT(NBTTagCompound nbttagcompound) {

    super.writeToNBT(nbttagcompound);

    nbttagcompound.setInteger("usechannel", usechannel);

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

    nbttagcompound.setTag("Items", nbttaglist);
  }
  public void writeToNBT(NBTTagCompound nbttagcompound) {
    super.writeToNBT(nbttagcompound);

    nbttagcompound.setInteger("Secstation_ID", SecurtyStation_ID);
    nbttagcompound.setString("stationname", stationname);

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

    nbttagcompound.setTag("Items", nbttaglist);
  }