Ejemplo n.º 1
0
 public void beforeReadEntityFromNBT(NBTTagCompound tags) {
   if (player.worldObj.isRemote) return;
   NBTTagCompound customData = new NBTTagCompound();
   try {
     // Load the data
     File file = new File(FlansModHandler.getSaveDirectory(player.worldObj), "Flan.dat");
     customData = CompressedStreamTools.readCompressed(new FileInputStream(file));
     // Fill the unlocks list
     NBTTagList unlocks = customData.getTagList("Unlocks");
     for (int i = 0; i < unlocks.tagCount(); ++i) {
       NBTTagString string = (NBTTagString) unlocks.tagAt(i);
       FlansMod.blueprintsUnlocked = new ArrayList<PlaneType>();
       FlansMod.blueprintsUnlocked.add(PlaneType.getPlane(string.toString()));
     }
     NBTTagList vehicleUnlocks = customData.getTagList("VehicleUnlocks");
     for (int i = 0; i < vehicleUnlocks.tagCount(); ++i) {
       NBTTagString string = (NBTTagString) vehicleUnlocks.tagAt(i);
       FlansMod.vehicleBlueprintsUnlocked = new ArrayList<VehicleType>();
       FlansMod.vehicleBlueprintsUnlocked.add(VehicleType.getVehicle(string.toString()));
     }
     FlansMod.doneTutorial = customData.getBoolean("DoneTutorial");
   } catch (IOException ioexception) {
     System.out.println("Failed to read data for Flan's mod. Using defaults.");
   }
 }
 public void readFromNBT(NBTTagCompound nbttagcompound) {
   NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
   contents = new ItemStack[getSizeInventory()];
   for (int i = 0; i < nbttaglist.tagCount(); i++) {
     NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
     int j = nbttagcompound1.getByte("Slot") & 0xff;
     if (j >= 0 && j < contents.length) {
       contents[j] = new ItemStack(nbttagcompound1);
     }
   }
 }
  /** Reads a tile entity from NBT. */
  public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
    super.readFromNBT(par1NBTTagCompound);
    NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
    this.poubelleContents = new ItemStack[this.getSizeInventory()];

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

      if (var5 >= 0 && var5 < this.poubelleContents.length) {
        this.poubelleContents[var5] = ItemStack.loadItemStackFromNBT(var4);
      }
    }
  }
 @Override
 public void readFromNBT(NBTTagCompound ntc) {
   super.readFromNBT(ntc);
   this.grindingTicks = ntc.getInteger("grindingTicks");
   NBTTagList list = ntc.getTagList("Items");
   this.inv = new ItemStack[this.getSizeInventory()];
   for (int i = 0; i < list.tagCount(); ++i) {
     NBTTagCompound ntc2 = (NBTTagCompound) list.tagAt(i);
     byte b = ntc2.getByte("Slot");
     if ((b >= 0) && (b < this.inv.length)) {
       this.inv[b] = ItemStack.loadItemStackFromNBT(ntc2);
     }
   }
 }
 @Override
 public void readFromNBT(NBTTagCompound compound) {
   super.readFromNBT(compound);
   NBTTagList items = compound.getTagList("Items");
   contents = new ItemStack[getSizeInventory()];
   for (int i = 0; i < items.tagCount(); i++) {
     NBTTagCompound item = (NBTTagCompound) items.tagAt(i);
     int slot = item.getByte("Slot") & 255;
     if (slot >= 0 && slot < contents.length)
       contents[slot] = ItemStack.loadItemStackFromNBT(item);
   }
   if (compound.hasKey("lock"))
     lock = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("lock"));
 }
 public void readFromNBT(NBTTagCompound nbttagcompound) {
   super.readFromNBT(nbttagcompound);
   SecurtyStation_ID = nbttagcompound.getInteger("Secstation_ID");
   stationname = nbttagcompound.getString("stationname");
   NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
   inventory = new ItemStack[getSizeInventory()];
   for (int i = 0; i < nbttaglist.tagCount(); i++) {
     NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
     byte byte0 = nbttagcompound1.getByte("Slot");
     if (byte0 >= 0 && byte0 < inventory.length) {
       inventory[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
     }
   }
 }
  public void readFromNBT(NBTTagCompound nbttagcompound) {

    super.readFromNBT(nbttagcompound);

    usechannel = nbttagcompound.getInteger("usechannel");

    NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
    ItemStacks = new ItemStack[getSizeInventory()];
    for (int i = 0; i < nbttaglist.tagCount(); i++) {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
      byte byte0 = nbttagcompound1.getByte("Slot");
      if (byte0 >= 0 && byte0 < ItemStacks.length) {
        ItemStacks[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
      }
    }
  }
  /** Reads a tile entity from NBT. */
  public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
    super.readFromNBT(par1NBTTagCompound);
    NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
    this.freezerItemStacks = new ItemStack[this.getSizeInventory()];

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

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

    this.freezerBurnTime = par1NBTTagCompound.getShort("BurnTime");
    this.freezerCookTime = par1NBTTagCompound.getShort("CookTime");
    this.freezercurrentItemBurnTime = getItemBurnTime(this.freezerItemStacks[1]);
  }
Ejemplo n.º 9
0
  @Override
  public void readFromNBT(NBTTagCompound nbttagcompound) {
    super.readFromNBT(nbttagcompound);

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

    if (nbttagcompound.hasKey("box")) {
      box.initialize(nbttagcompound.getCompoundTag("box"));
    }

    if (nbttagcompound.hasKey("path")) {
      path = new LinkedList<BlockIndex>();
      NBTTagList list = nbttagcompound.getTagList("path");

      for (int i = 0; i < list.tagCount(); ++i) {
        path.add(new BlockIndex((NBTTagCompound) list.tagAt(i)));
      }
    }

    done = nbttagcompound.getBoolean("done");
  }