Package net.minecraft.nbt

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


    if (tag.hasKey("DropItems"))
    {
      List<ItemStack> drops = new ArrayList<ItemStack>();
      NBTTagList nbttaglist = tag.getTagList("DropItems");
      for (int i = nbttaglist.tagCount(); i --> 0; )
      {
        NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i);
        ItemStack item = ItemStack.loadItemStackFromNBT(nbttagcompound1);
        if (item != null && item.stackSize > 0)
        {
View Full Code Here


      if(tag.hasKey("size"))
        slotsCount = tag.getInteger("size");

      NBTTagList nbttaglist = tag.getTagList("Items", 10);
      inventoryContents = new ItemStack[slotsCount];
      for(int i = 0; i < nbttaglist.tagCount(); i++) {
        NBTTagCompound stacktag = nbttaglist.getCompoundTagAt(i);
        int j = stacktag.getByte("Slot");
        if(j >= 0 && j < inventoryContents.length)
          inventoryContents[j] = ItemStack.loadItemStackFromNBT(stacktag);
      }
View Full Code Here

  public void readFromNBT(NBTTagCompound tag) {
    super.readFromNBT(tag);
    _inventories = new ItemStack[getSizeInventory()];
    if(tag.hasKey("Items")) {
      NBTTagList tagList = tag.getTagList("Items", 10);
      for(int i = 0; i < tagList.tagCount(); i++) {
        NBTTagCompound itemTag = (NBTTagCompound)tagList.getCompoundTagAt(i);
        int slot = itemTag.getByte("Slot") & 0xff;
        if(slot >= 0 && slot <= _inventories.length) {
          ItemStack itemStack = new ItemStack((Block)null,0,0);
          itemStack.readFromNBT(itemTag);
View Full Code Here

        _inventories[i].writeToNBT(itemTag);
        tagList.appendTag(itemTag);
      }
    }
   
    if(tagList.tagCount() > 0) {
      tag.setTag("Items", tagList);
    }
   
    tag.setBoolean("isInlet", isInlet);
  }
View Full Code Here

    destination.setTag("redNetConfig", tagArray);
  }
 
  protected void decodeSettings(NBTTagCompound source) {
    NBTTagList tagArray = source.getTagList("redNetConfig", 10);
    for(int i = 0; i < tagArray.tagCount(); i++) {
      decodeSetting( (NBTTagCompound)tagArray.getCompoundTagAt(i) );
    }
  }
 
  /**
 
View Full Code Here

      tanks[i].setFluid(null);
    }

    if(tag.hasKey("fluids")) {
      NBTTagList tagList = tag.getTagList("fluids", 10);
      for(int i = 0; i < tagList.tagCount(); i++) {
        NBTTagCompound fluidTag = tagList.getCompoundTagAt(i);
        int fluidIdx = fluidTag.getInteger("tagIdx");
        FluidStack newFluid = FluidStack.loadFluidStackFromNBT(fluidTag);
        tanks[fluidIdx].setFluid(newFluid);
      }
View Full Code Here

        tanks[i].getFluid().writeToNBT(fluidTag);
        fluidTagList.appendTag(fluidTag);
      }
    }
   
    if(fluidTagList.tagCount() > 0) {
      tag.setTag("fluids", fluidTagList);
    }
  }
 
  // TileEntity overrides
View Full Code Here

   
    // Inventories
    _inventories = new ItemStack[getSizeInventory()];
    if(tag.hasKey("Items")) {
      NBTTagList tagList = tag.getTagList("Items", 10);
      for(int i = 0; i < tagList.tagCount(); i++) {
        NBTTagCompound itemTag = (NBTTagCompound)tagList.getCompoundTagAt(i);
        int slot = itemTag.getByte("Slot") & 0xff;
        if(slot >= 0 && slot <= _inventories.length) {
          ItemStack itemStack = new ItemStack((Block)null,0,0);
          itemStack.readFromNBT(itemTag);
View Full Code Here

        _inventories[i].writeToNBT(itemTag);
        tagList.appendTag(itemTag);
      }
    }
   
    if(tagList.tagCount() > 0) {
      tag.setTag("Items", tagList);
    }
  }
 
  // IInventory
View Full Code Here

    this.tileEntities.clear();

    NBTTagList tileEntitiesList = tagCompound.getTagList("TileEntities");

    for (int i = 0; i < tileEntitiesList.tagCount(); i++) {
      TileEntity tileEntity = TileEntity.createAndLoadEntity((NBTTagCompound) tileEntitiesList.tagAt(i));
      if (tileEntity != null) {
        tileEntity.worldObj = this;
        this.tileEntities.add(tileEntity);
      }
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.