Package net.minecraft.nbt

Examples of net.minecraft.nbt.NBTTagCompound


    public void setElectricity(ItemStack itemStack, float joules)
    {
        // Saves the frequency in the ItemStack
        if (itemStack.getTagCompound() == null)
        {
            itemStack.setTagCompound(new NBTTagCompound());
        }
       
        float electricityStored = Math.max(Math.min(joules, this.getMaxElectricityStored(itemStack)), 0);
        itemStack.getTagCompound().setFloat("electricity", electricityStored);
       
View Full Code Here


   
    public NBTTagCompound getOrCreateLinkData(ItemStack is, TileEntity te)
    {
        if (is.getTagCompound() == null || !getHasLinkData(is))
        {
            NBTTagCompound tag = new NBTTagCompound();
            tag.setCompoundTag("ElectricExpansion", new NBTTagCompound());
            tag.getCompoundTag("ElectricExpansion").setCompoundTag("link", new NBTTagCompound());
           
            NBTTagCompound link = tag.getCompoundTag("ElectricExpansion").getCompoundTag("link");
            link.setInteger("x", te.xCoord);
            link.setInteger("y", te.yCoord);
            link.setInteger("z", te.zCoord);
            link.setInteger("dimension", te.worldObj.provider.dimensionId);
           
            is.setTagCompound(tag);
            return link;
        }
       
View Full Code Here

    {
        if (!getHasLinkData(itemStack))
            currentTips.add("No Data");
        else if (Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak.keyCode))
        {
            NBTTagCompound link = itemStack.getTagCompound().getCompoundTag("ElectricExpansion").getCompoundTag("link");
            currentTips.add("X-Coordinate: " + link.getInteger("x"));
            currentTips.add("Y-Coordinate: " + link.getInteger("y"));
            currentTips.add("Z-Coordinate: " + link.getInteger("z"));
            currentTips.add("World: " + link.getInteger("dimension"));
        }
        else
        {
            currentTips.add("Hold Sneak for more information");
        }
View Full Code Here

        if (is != null && is.getItem() instanceof ItemLinkCard)
        {
            ItemLinkCard item = (ItemLinkCard) is.getItem();
            if (item.getHasLinkData(is) && !ItemLinkCard.isDataEqual(item.getOrCreateLinkData(is, this), this))
            {
                NBTTagCompound linkData = item.getOrCreateLinkData(is, this);
                int dimensionId = linkData.getInteger("dimension");
                int x = linkData.getInteger("x");
                int y = linkData.getInteger("y");
                int z = linkData.getInteger("z");
               
                if (this.worldObj.provider.dimensionId == dimensionId || this.hasUpgrade("CrossDimension"))
                {
                    if (DimensionManager.getWorld(dimensionId).getBlockTileEntity(x, y, z) instanceof TileEntityAdvancedBatteryBox)
                    {
View Full Code Here

        NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
        this.inventory = new ItemStack[OTHER_SIZE + UPGRADE_SIZE];
       
        for (int i = 0; i < var2.tagCount(); i++)
        {
            NBTTagCompound tag = (NBTTagCompound) var2.tagAt(i);
            byte var5 = tag.getByte("Slot");
           
            if (var5 >= 0 && var5 < this.inventory.length)
            {
                this.inventory[var5] = ItemStack.loadItemStackFromNBT(tag);
            }
View Full Code Here

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

   
    public boolean isLinkCardValid(ItemStack is)
    {
        if (is != null && is.getItem() instanceof ItemLinkCard)
        {
            NBTTagCompound link = ((ItemLinkCard) is.getItem()).getOrCreateLinkData(is, this);
            if (ItemLinkCard.isDataEqual(link, this))
            {
                return false;
            }
            return true;
View Full Code Here

   * Forward for the TileEntity's readFromNBT(), used for loading the state.
   *
   * @param tag Compound tag as supplied by TileEntity.readFromNBT()
   */
  public void onReadFromNbt(NBTTagCompound tag) {
    NBTTagCompound data = tag.getCompoundTag("IC2BasicSource");

    energyStored = data.getDouble("energy");
  }
View Full Code Here

   * Forward for the TileEntity's writeToNBT(), used for saving the state.
   *
   * @param tag Compound tag as supplied by TileEntity.writeToNBT()
   */
  public void onWriteToNbt(NBTTagCompound tag) {
    NBTTagCompound data = new NBTTagCompound();

    data.setDouble("energy", energyStored);

    tag.setTag("IC2BasicSource", data);
  }
View Full Code Here

   * Forward for the TileEntity's readFromNBT(), used for loading the state.
   *
   * @param tag Compound tag as supplied by TileEntity.readFromNBT()
   */
  public void onReadFromNbt(NBTTagCompound tag) {
    NBTTagCompound data = tag.getCompoundTag("IC2BasicSink");

    energyStored = data.getDouble("energy");
  }
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.