Package net.minecraft.nbt

Examples of net.minecraft.nbt.NBTTagList


      }
      else if (packetID == TilePacketType.FIELD.ordinal())
      {
        this.getCalculatedField().clear();
        NBTTagCompound nbt = PacketHandler.readNBTTagCompound(dataStream);
        NBTTagList nbtList = nbt.getTagList("blockList");

        for (int i = 0; i < nbtList.tagCount(); i++)
        {
          NBTTagCompound tagAt = (NBTTagCompound) nbtList.tagAt(i);
          this.getCalculatedField().add(new Vector3(tagAt));
        }

        this.isCalculated = true;
      }
View Full Code Here


  }

  public void sendFieldToClient()
  {
    NBTTagCompound nbt = new NBTTagCompound();
    NBTTagList nbtList = new NBTTagList();

    for (Vector3 vector : this.getCalculatedField())
    {
      nbtList.appendTag(vector.writeToNBT(new NBTTagCompound()));
    }

    nbt.setTag("blockList", nbtList);
    PacketDispatcher.sendPacketToAllPlayers(ModularForceFieldSystem.PACKET_TILE.getPacket(this, TilePacketType.FIELD.ordinal(), nbt));
  }
View Full Code Here

              if (saveNBT == null)
              {
                saveNBT = new NBTTagCompound();
              }

              NBTTagList list;

              if (saveNBT.hasKey(NBT_FIELD_BLOCK_LIST))
              {
                list = (NBTTagList) saveNBT.getTag(NBT_FIELD_BLOCK_LIST);
              }
              else
              {
                list = new NBTTagList();
              }

              for (int x = minPoint.intX(); x <= maxPoint.intX(); x++)
              {
                for (int y = minPoint.intY(); y <= maxPoint.intY(); y++)
                {
                  for (int z = minPoint.intZ(); z <= maxPoint.intZ(); z++)
                  {
                    Vector3 position = new Vector3(x, y, z);
                    Vector3 targetCheck = midPoint.clone().translate(position);
                    int blockID = targetCheck.getBlockID(world);

                    if (blockID > 0)
                    {
                      if (!nbt.getBoolean(NBT_MODE))
                      {
                        NBTTagCompound vectorTag = new NBTTagCompound();
                        position.writeToNBT(vectorTag);
                        vectorTag.setInteger(NBT_FIELD_BLOCK_ID, blockID);
                        vectorTag.setInteger(NBT_FIELD_BLOCK_METADATA, targetCheck.getBlockMetadata(world));
                        list.appendTag(vectorTag);
                      }
                      else
                      {
                        for (int i = 0; i < list.tagCount(); i++)
                        {
                          Vector3 vector = new Vector3((NBTTagCompound) list.tagAt(i));

                          if (vector.equals(position))
                          {
                            list.removeTag(i);
                          }
                        }
                      }
                    }
                  }
                }
              }

              saveNBT.setTag(NBT_FIELD_BLOCK_LIST, list);

              nbt.setInteger(NBT_FIELD_SIZE, list.tagCount());

              NBTUtility.saveData(getSaveDirectory(), NBT_FILE_SAVE_PREFIX + getModeID(itemStack), saveNBT);

              this.clearCache();
View Full Code Here

    {
      NBTTagCompound nbt = NBTUtility.loadData(this.getSaveDirectory(), NBT_FILE_SAVE_PREFIX + getModeID(itemStack));

      if (nbt != null)
      {
        NBTTagList nbtTagList = nbt.getTagList(NBT_FIELD_BLOCK_LIST);

        for (int i = 0; i < nbtTagList.tagCount(); i++)
        {
          NBTTagCompound vectorTag = (NBTTagCompound) nbtTagList.tagAt(i);
          Vector3 position = new Vector3(vectorTag);

          if (scale > 0)
          {
            position.scale(scale);
View Full Code Here

  @Override
  public void readFromNBT(NBTTagCompound nbt)
  {
    super.readFromNBT(nbt);
    NBTTagList bufferList = nbt.getTagList("BufferItems");
    NBTTagList patternList = nbt.getTagList("InventoryItems");
    bufferInventory.readFromNBT(bufferList);
    patternInventory.readFromNBT(patternList);
    if (nbt.hasKey("BufferItemsName"))
    {
      bufferInventory.customName = nbt.getString("BufferItemsName");
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 writeToNBT(NBTTagCompound nbt)
  {
    super.writeToNBT(nbt);
    NBTTagList nbttaglist = new NBTTagList();

    for (int i = 0; i < this.slots.length; ++i)
    {
      if (this.slots[i] != null)
      {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setByte("Slot", (byte) i);
        this.slots[i].writeToNBT(nbttagcompound1);
        nbttaglist.appendTag(nbttagcompound1);
      }
    }
    nbt.setTag("Items", nbttaglist);
    if (this.isInvNameLocalized())
    {
View Full Code Here

  @Override
  public void readFromNBT(NBTTagCompound nbt)
  {
    super.readFromNBT(nbt);
    NBTTagList nbttaglist = nbt.getTagList("Items");
    this.slots = new ItemStack[this.getSizeInventory()];
    if (nbt.hasKey("CustomName"))
    {
      this.customName = nbt.getString("CustomName");
    }
    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
      int j = nbttagcompound1.getByte("Slot") & 255;

      if (j >= 0 && j < this.slots.length)
      {
        this.slots[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
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

  @Override
  public void writeToNBT(NBTTagCompound nbt)
  {
    super.writeToNBT(nbt);
    NBTTagList nbttaglist = new NBTTagList();

    for (int i = 0; i < inventory.slots.size(); ++i)
    {
      if (inventory.slots.get(i) != null)
      {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setByte("Slot", (byte) i);
        inventory.slots.get(i).writeToNBT(nbttagcompound1);
        nbttaglist.appendTag(nbttagcompound1);
      }
    }
    nbt.setTag("Items", nbttaglist);
    if (getInventory().isInvNameLocalized())
    {
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.