Package net.minecraft.nbt

Examples of net.minecraft.nbt.NBTTagCompound


    }

    @Override
    public NBTTagCompound dataTag(final ItemStack stack) {
        if (!stack.hasTagCompound()) {
            stack.setTagCompound(new NBTTagCompound());
        }
        final NBTTagCompound nbt = stack.getTagCompound();
        // This is the suggested key under which to store item component data.
        // You are free to change this as you please.
        if (!nbt.hasKey("oc:data")) {
            nbt.setTag("oc:data", new NBTTagCompound());
        }
        return nbt.getCompoundTag("oc:data");
    }
View Full Code Here


    }

    @Override
    public void save(final NBTTagCompound nbt) {
        if (node != null) {
            final NBTTagCompound nodeTag = new NBTTagCompound();
            node.save(nodeTag);
            nbt.setTag("node", nodeTag);
        }
    }
View Full Code Here

    @Override
    public void writeToNBT(final NBTTagCompound nbt) {
        super.writeToNBT(nbt);
        // See readFromNBT() regarding host check.
        if (node != null && node.host() == this) {
            final NBTTagCompound nodeNbt = new NBTTagCompound();
            node.save(nodeNbt);
            nbt.setTag("oc:node", nodeNbt);
        }
    }
View Full Code Here

        super.writeToNBT(nbt);
        int index = 0;
        for (Node node : nodes) {
            // See readFromNBT() regarding host check.
            if (node != null && node.host() == this) {
                final NBTTagCompound nodeNbt = new NBTTagCompound();
                node.save(nodeNbt);
                nbt.setTag("oc:node" + index, nodeNbt);
            }
            ++index;
        }
View Full Code Here

  public void readFromNBT(NBTTagCompound data) {
    readFromNBT(data, "powerProvider");
  }

  public void readFromNBT(NBTTagCompound data, String tag) {
    NBTTagCompound nbt = data.getCompoundTag(tag);
    battery.setEnergyStored(nbt.getDouble("energyStored"));
  }
View Full Code Here

  public void writeToNBT(NBTTagCompound data) {
    writeToNBT(data, "powerProvider");
  }

  public void writeToNBT(NBTTagCompound data, String tag) {
    NBTTagCompound nbt = new NBTTagCompound();
    nbt.setDouble("energyStored", battery.getEnergyStored());
    data.setTag(tag, nbt);
  }
View Full Code Here

     */
    @Override
    public void readFromNBT(NBTTagCompound tag) {
        super.readFromNBT(tag);

        NBTTagCompound data = tag.getCompoundTag("IC2BasicSource");

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

            super.writeToNBT(tag);
        } catch (RuntimeException e) {
            // happens if this is a delegate, ignore
        }

        NBTTagCompound data = new NBTTagCompound();

        data.setDouble("energy", energyStored);

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

     */
    @Override
    public void readFromNBT(NBTTagCompound tag) {
        super.readFromNBT(tag);

        NBTTagCompound data = tag.getCompoundTag("IC2BasicSink");

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

            super.writeToNBT(tag);
        } catch (RuntimeException e) {
            // happens if this is a delegate, ignore
        }

        NBTTagCompound data = new NBTTagCompound();

        data.setDouble("energy", energyStored);

        tag.setTag("IC2BasicSink", data);
    }
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.