Package net.minecraft.nbt

Examples of net.minecraft.nbt.NBTTagCompound


  public ItemStack[] getInventory(ItemStack item) {
    ItemStack[] stackList = new ItemStack[13 * 9];
    if (item.hasTagCompound()) {
      NBTTagList var2 = item.stackTagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
      for (int var3 = 0; var3 < var2.tagCount(); var3++) {
        NBTTagCompound var4 = var2.getCompoundTagAt(var3);
        int var5 = var4.getByte("Slot") & 0xFF;
        if (var5 >= 0 && var5 < stackList.length)
          stackList[var5] = ItemStack.loadItemStackFromNBT(var4);
      }
    }

View Full Code Here


    public BlockData(Block block, int meta, TileEntity tile, ChunkCoordinates coords) {
      this.block = block;
      this.meta = meta;

      if (tile != null) {
        NBTTagCompound cmp = new NBTTagCompound();
        tile.writeToNBT(cmp);
        this.tile = cmp;
      }
      ;
View Full Code Here

    redstone = par1NBTTagCompound.getBoolean(TAG_REDSTONE);

    NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
    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

    par1NBTTagCompound.setBoolean(TAG_REDSTONE, redstone);

    NBTTagList var2 = new NBTTagList();
    for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
      if (inventorySlots[var3] != null) {
        NBTTagCompound var4 = new NBTTagCompound();
        var4.setByte("Slot", (byte) var3);
        inventorySlots[var3].writeToNBT(var4);
        var2.appendTag(var4);
      }
    }
    par1NBTTagCompound.setTag("Items", var2);
View Full Code Here

  }

  @Override
  public S35PacketUpdateTileEntity getDescriptionPacket() {
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    writeCustomNBT(nbttagcompound);
    return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
  }
View Full Code Here

    locked = par1NBTTagCompound.getBoolean(TAG_LOCKED);

    NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
    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

    par1NBTTagCompound.setBoolean(TAG_LOCKED, locked);

    NBTTagList var2 = new NBTTagList();
    for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
      if (inventorySlots[var3] != null) {
        NBTTagCompound var4 = new NBTTagCompound();
        var4.setByte("Slot", (byte) var3);
        inventorySlots[var3].writeToNBT(var4);
        var2.appendTag(var4);
      }
    }
    par1NBTTagCompound.setTag("Items", var2);
View Full Code Here

    return itemstack.getItem() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemSkyPearl.class);
  }

  @Override
  public S35PacketUpdateTileEntity getDescriptionPacket() {
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    writeCustomNBT(nbttagcompound);
    return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound);
  }
View Full Code Here

      levels.add(i);

    NBTTagList var2 = par1NBTTagCompound.getTagList("Items", Constants.NBT.TAG_COMPOUND);
    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

  public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
    par1NBTTagCompound.setIntArray(TAG_LEVELS, ArrayUtils.toPrimitive(levels.toArray(new Integer[levels.size()])));

    par1NBTTagCompound.setIntArray(TAG_ENCHANTS, ArrayUtils.toPrimitive(enchantments.toArray(new Integer[enchantments.size()])));

    NBTTagCompound totalAspectsCmp = new NBTTagCompound();
    totalAspects.writeToNBT(totalAspectsCmp);

    NBTTagCompound currentAspectsCmp = new NBTTagCompound();
    currentAspects.writeToNBT(currentAspectsCmp);

    par1NBTTagCompound.setBoolean(TAG_WORKING, working);
    par1NBTTagCompound.setTag(TAG_TOTAL_ASPECTS, totalAspectsCmp);
    par1NBTTagCompound.setTag(TAG_CURRENT_ASPECTS, currentAspectsCmp);
    NBTTagList var2 = new NBTTagList();
    for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
      if (inventorySlots[var3] != null) {
        NBTTagCompound var4 = new NBTTagCompound();
        var4.setByte("Slot", (byte) var3);
        inventorySlots[var3].writeToNBT(var4);
        var2.appendTag(var4);
      }
    }
    par1NBTTagCompound.setTag("Items", var2);
View Full Code Here

TOP

Related Classes of net.minecraft.nbt.NBTTagCompound

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.