Package net.minecraft.nbt

Examples of net.minecraft.nbt.NBTTagList


  @Override
  public void readFromNBT(NBTTagCompound nbt)
  {
    super.readFromNBT(nbt);
    NBTTagList nbttaglist = nbt.getTagList("Items");
    inventory.readFromNBT(nbttaglist);
    if (nbt.hasKey("CustomName"))
    {
      this.customName = nbt.getString("CustomName");
    }
View Full Code Here


  @Override
  public void readFromNBT(NBTTagCompound nbt)
  {
    super.readFromNBT(nbt);
    NBTTagList nbttaglist = nbt.getTagList("Items");
    inventory.readFromNBT(nbttaglist);
    if (nbt.hasKey("CustomName"))
    {
      customName = nbt.getString("CustomName");
    }
View Full Code Here

    }
  }

  public NBTTagList writeToNBT()
  {
    NBTTagList nbtList = new NBTTagList();

    for (int i = 0; i < slots.size(); ++i)
    {
      if (slots.get(i) != null)
      {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        nbttagcompound.setByte("Slot", (byte) i);
        slots.get(i).writeToNBT(nbttagcompound);
        nbtList.appendTag(nbttagcompound);
      }
    }
    return nbtList;
  }
View Full Code Here

  @Override
  public void readFromNBT(NBTTagCompound nbt)
  {
    super.readFromNBT(nbt);
    NBTTagList nbttaglist = nbt.getTagList("Items");
    inventory.readFromNBT(nbttaglist);
    if (nbt.hasKey("CustomName"))
    {
      this.customName = nbt.getString("CustomName");
    }
View Full Code Here

  @Override
  public void readFromNBT(NBTTagCompound nbt)
  {
    super.readFromNBT(nbt);
    NBTTagList nbttaglist = nbt.getTagList("Items");
    inventory.readFromNBT(nbttaglist);
    if (nbt.hasKey("CustomName"))
    {
      this.customName = nbt.getString("CustomName");
    }
View Full Code Here

    @Override
    public void readFromNBT(NBTTagCompound nbttagcompound)
    {
        super.readFromNBT(nbttagcompound);
        NBTTagList nbttaglist = nbttagcompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
        chestContents = new ItemStack[getSizeInventory()];
        for (int i = 0; i < nbttaglist.tagCount(); i++)
        {
            NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
            int j = nbttagcompound1.getByte("Slot") & 0xff;
            if (j >= 0 && j < chestContents.length)
            {
                chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
            }
View Full Code Here

    @Override
    public void writeToNBT(NBTTagCompound nbttagcompound)
    {
        super.writeToNBT(nbttagcompound);
        NBTTagList nbttaglist = new NBTTagList();
        for (int i = 0; i < chestContents.length; i++)
        {
            if (chestContents[i] != null)
            {
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                nbttagcompound1.setByte("Slot", (byte) i);
                chestContents[i].writeToNBT(nbttagcompound1);
                nbttaglist.appendTag(nbttagcompound1);
            }
        }

        nbttagcompound.setTag("Items", nbttaglist);
        nbttagcompound.setByte("facing", (byte)facing);
View Full Code Here

    craftingGrid.readFromNBT( compound );
    outputInv.readFromNBT( compound );
    subGrid.readFromNBT( compound );

    // Extra Fields
    NBTTagList list = compound.getTagList( "extraFields" );
    if( list != null ) {
      int count = list.tagCount();
      for(int i=0; i<count; i++) {
        NBTBase tag = list.tagAt( i );
        if( tag != null ) {
          Object field = Utils.readFieldFromNBT( tag );
          String name = tag.getName();
          if( field != null ) {
            extraFields.put( name, field );
View Full Code Here

    craftingGrid.writeToNBT( compound );
    outputInv.writeToNBT( compound );
    subGrid.writeToNBT( compound );

    // Extra Fields
    NBTTagList list = new NBTTagList( "extraFields" );
    for(String key : extraFields.keySet()) {
      Utils.appendFieldToNBTList( list, key, extraFields.get( key ) );
    }
  }
View Full Code Here

  public void readFromNBT(NBTTagCompound compound) {
    NBTTagCompound c = ((NBTTagCompound) compound.getTag( "inv." + name ));
    if( c == null ) return;

    NBTTagList list = c.getTagList( "inventoryContents" );
    for( int i = 0; i < list.tagCount() && i < internalInv.length; i++ ) {
      NBTTagCompound tag = (NBTTagCompound) list.tagAt( i );
      int index = tag.getInteger( "index" );
      internalInv[index] = Utils.readStackFromNBT( tag );
    }
  }
View Full Code Here

TOP

Related Classes of net.minecraft.nbt.NBTTagList

Copyright © 2018 www.massapicom. 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.