public void readFromNBT(NBTTagCompound tagCompound) {
    if (tagCompound != null) {
      NBTTagList tagList = tagCompound.getTagList("Inventory", 10);
      for (int i = 0; i < tagList.tagCount(); ++i) {
        NBTTagCompound nbttagcompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
        int j = nbttagcompound.getByte("Slot") & 255;
        ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);

        if (itemstack != null) {
          this.inventory[j] = itemstack;
        }
      }
    }
  }
示例#2
0
  /** (abstract) Protected helper method to read subclass entity data from NBT. */
  public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
    direction = par1NBTTagCompound.getByte("Dir");
    xPosition = par1NBTTagCompound.getInteger("TileX");
    yPosition = par1NBTTagCompound.getInteger("TileY");
    zPosition = par1NBTTagCompound.getInteger("TileZ");
    String s = par1NBTTagCompound.getString("Motive");
    EnumArt aenumart[] = EnumArt.values();
    int i = aenumart.length;

    for (int j = 0; j < i; j++) {
      EnumArt enumart = aenumart[j];

      if (enumart.title.equals(s)) {
        art = enumart;
      }
    }

    if (art == null) {
      art = EnumArt.Kebab;
    }

    func_179_a(direction);
  }