コード例 #1
0
  public void readFromTags(NBTTagCompound par1NBTTagCompound) {
    NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("buy");
    this.itemToBuy = ItemStack.loadItemStackFromNBT(var2);
    NBTTagCompound var3 = par1NBTTagCompound.getCompoundTag("sell");
    this.itemToSell = ItemStack.loadItemStackFromNBT(var3);

    if (par1NBTTagCompound.hasKey("buyB")) {
      this.secondItemToBuy =
          ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("buyB"));
    }

    if (par1NBTTagCompound.hasKey("uses")) {
      this.toolUses = par1NBTTagCompound.getInteger("uses");
    }
  }
コード例 #2
0
ファイル: EntityItem.java プロジェクト: Busboombot/Pixelmon
  /** (abstract) Protected helper method to read subclass entity data from NBT. */
  public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
    this.health = par1NBTTagCompound.getShort("Health") & 255;
    this.age = par1NBTTagCompound.getShort("Age");
    NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("Item");
    this.item = ItemStack.loadItemStackFromNBT(var2);

    if (this.item == null) {
      this.setDead();
    }
  }
コード例 #3
0
  /** (abstract) Protected helper method to read subclass entity data from NBT. */
  public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
    this.fireworkAge = par1NBTTagCompound.getInteger("Life");
    this.lifetime = par1NBTTagCompound.getInteger("LifeTime");
    NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("FireworksItem");

    if (var2 != null) {
      ItemStack var3 = ItemStack.loadItemStackFromNBT(var2);

      if (var3 != null) {
        this.dataWatcher.updateObject(8, var3);
      }
    }
  }
コード例 #4
0
  /** Reads a tile entity from NBT. */
  public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
    super.readFromNBT(par1NBTTagCompound);
    NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
    this.combinerItemStacks = 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.combinerItemStacks.length) {
        this.combinerItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
      }
    }

    this.combinerBurnTime = par1NBTTagCompound.getShort("BurnTime");
    this.combinerCookTime = par1NBTTagCompound.getShort("CookTime");
    this.currentItemBurnTime = getItemBurnTime(this.combinerItemStacks[1]);
  }
コード例 #5
0
  /** Reads from the given tag list and fills the slots in the inventory with the correct items. */
  public void readFromNBT(NBTTagList par1NBTTagList) {
    this.mainInventory = new ItemStack[36];
    this.armorInventory = new ItemStack[4];

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

      if (var5 != null) {
        if (var4 >= 0 && var4 < this.mainInventory.length) {
          this.mainInventory[var4] = var5;
        }

        if (var4 >= 100 && var4 < this.armorInventory.length + 100) {
          this.armorInventory[var4 - 100] = var5;
        }
      }
    }
  }
コード例 #6
0
  /** Reads a tile entity from NBT. */
  public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
    super.readFromNBT(par1NBTTagCompound);
    NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
    this.brewingItemStacks = 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.brewingItemStacks.length) {
        this.brewingItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
      }
    }

    this.brewTime = par1NBTTagCompound.getShort("BrewTime");

    if (par1NBTTagCompound.hasKey("CustomName")) {
      this.field_94132_e = par1NBTTagCompound.getString("CustomName");
    }
  }
コード例 #7
0
  /** (abstract) Protected helper method to read subclass entity data from NBT. */
  protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
    minecartType = par1NBTTagCompound.getInteger("Type");

    if (minecartType == 2) {
      pushX = par1NBTTagCompound.getDouble("PushX");
      pushZ = par1NBTTagCompound.getDouble("PushZ");
      fuel = par1NBTTagCompound.getShort("Fuel");
    } else if (minecartType == 1) {
      NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items");
      cargoItems = new ItemStack[getSizeInventory()];

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

        if (j >= 0 && j < cargoItems.length) {
          cargoItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound);
        }
      }
    }
  }
コード例 #8
0
  /** (abstract) Protected helper method to read subclass entity data from NBT. */
  protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
    this.minecartType = par1NBTTagCompound.getInteger("Type");

    if (this.minecartType == 2) {
      this.pushX = par1NBTTagCompound.getDouble("PushX");
      this.pushZ = par1NBTTagCompound.getDouble("PushZ");
      this.fuel = par1NBTTagCompound.getShort("Fuel");
    } else if (this.minecartType == 1) {
      NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
      this.cargoItems = 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.cargoItems.length) {
          this.cargoItems[var5] = ItemStack.loadItemStackFromNBT(var4);
        }
      }
    }
  }