Package net.minecraft.nbt

Examples of net.minecraft.nbt.NBTTagList.tagCount()


        super.readFromNBT(par1NBTTagCompound);      

        NBTTagList occupantsTagList = par1NBTTagCompound.getTagList("occupants");
        this.occupants = new LinkedList<EntityCitizen>();

        for (int var3 = 0; var3 < occupantsTagList.tagCount(); ++var3)
        {
            NBTTagCompound var4 = (NBTTagCompound)occupantsTagList.tagAt(var3);

            this.occupants.add(EntityCitizen.loadEntityCitizenFromNBT(var4));
        }
View Full Code Here


       
       
        NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
        this.chestContents = 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.chestContents.length)
View Full Code Here

    {
        super.readFromNBT(par1NBTTagCompound);
        NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
        this.furnaceItemStacks = 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.furnaceItemStacks.length)
View Full Code Here

                inventory[i] = null;
            }
        }

        NBTTagList inventoryList = backpackSave.getInventory(inventoryName);
        for(int i = 0; i < inventoryList.tagCount(); i++) {
            NBTTagCompound slotEntry = inventoryList.getCompoundTagAt(i);
            int slot = slotEntry.getByte(Constants.NBT.SLOT) & 0xff;

            if(slot >= 0 && slot < inventory.length) {
                inventory[slot] = ItemStack.loadItemStackFromNBT(slotEntry);
View Full Code Here

                        " " +
                        (itemStack.getItemDamage() / 100 + 1)
                );
                BackpackSave backpackSave = new BackpackSave(itemStack);
                NBTTagList itemList = backpackSave.getInventory(Constants.NBT.INVENTORY_BACKPACK);
                int used = itemList.tagCount();
                int size = backpackSave.getSize();
                information.add(used + "/" + size + ' ' + StatCollector.translateToLocal(Localizations.SLOTS_USED));
            }
        } else {
            information.add(StatCollector.translateToLocal(Localizations.MORE_INFORMATION));
View Full Code Here

    if(count > 0 && !worldObj.isRemote) {
      for(EntityItem entity : items) {
        ItemStack item = entity.getEntityItem();
        if(item.getItem() == Items.enchanted_book) {
          NBTTagList enchants = Items.enchanted_book.func_92110_g(item);
          if(enchants != null && enchants.tagCount() > 0) {
            NBTTagCompound enchant = enchants.getCompoundTagAt(0);
            short id = enchant.getShort("id");
            if(isEnchantmentValid(id)) {
              advanceStage();
              return;
View Full Code Here

        if(count > 0 && !worldObj.isRemote) {
          for(EntityItem entity : items) {
            ItemStack item = entity.getEntityItem();
            if(item.getItem() == Items.enchanted_book) {
              NBTTagList enchants = Items.enchanted_book.func_92110_g(item);
              if(enchants != null && enchants.tagCount() > 0) {
                NBTTagCompound enchant = enchants.getCompoundTagAt(0);
                short enchantId = enchant.getShort("id");
                short enchantLvl = enchant.getShort("lvl");
                if(!hasEnchantAlready(enchantId) && isEnchantmentValid(enchantId)) {
                  this.enchants.add(new EnchantmentData(enchantId, enchantLvl));
View Full Code Here

  @Override
  public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
    NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10);
    inventorySlots = new ItemStack[getSizeInventory()];
    for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
      NBTTagCompound var4 = var2.getCompoundTagAt(var3);
      byte var5 = var4.getByte("Slot");
      if (var5 >= 0 && var5 < inventorySlots.length)
        inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
    }
View Full Code Here

    if(nbtTags.hasKey("stacks"))
    {
      NBTTagList tagList = nbtTags.getTagList("stacks", NBT.TAG_COMPOUND);

      for(int i = 0; i < tagList.tagCount(); i++)
      {
        TransporterStack stack = TransporterStack.readFromNBT((NBTTagCompound)tagList.getCompoundTagAt(i));

        transit.add(stack);
        TransporterManager.add(stack);
View Full Code Here

      NBTTagCompound tagCompound = new NBTTagCompound();
      stack.write(tagCompound);
      stacks.appendTag(tagCompound);
    }

    if(stacks.tagCount() != 0)
    {
      nbtTags.setTag("stacks", stacks);
    }
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.