Package net.minecraft.server.v1_4_R1

Examples of net.minecraft.server.v1_4_R1.NBTTagCompound


//   
//    storage.setString(STRING_NBT_BINARY, baos.toString());
   
    String    author  = nbt.getString  (tagStringAuthor);
    String    title  = nbt.getString  (tagStringTitle);
    NBTTagList  pages  = nbt.getList  (tagStringPages);
   
    if (pages != null) {
      for (int i = 0; i < pages.size(); i++)
        setString(tagStringPagePref+i, ((NBTTagString)pages.get(i)).data);
      setInteger(tagIntegerPagesSize, pages.size());
    }
   
    if (title != null)
      setString(tagStringTitle, title);
   
View Full Code Here


    Integer pSize  = storage.getInteger(tagIntegerPagesSize);
   
    NBTTagCompound compound  = new NBTTagCompound();
   
    if (pSize != null) {
      NBTTagList  list  = new NBTTagList();
      for (int i = 0; i < pSize; i++) {
        String       page  = storage.getString(tagStringPagePref+i);
       
        if (page != null) {
          NBTTagString tag  = new NBTTagString(page);
          tag.data      = page;
          list.add(tag);
        }
      }
     
      compound.set(tagStringPages, list);
    }
View Full Code Here

      NBTTagList  list  = new NBTTagList();
      for (int i = 0; i < pSize; i++) {
        String       page  = storage.getString(tagStringPagePref+i);
       
        if (page != null) {
          NBTTagString tag  = new NBTTagString(page);
          tag.data      = page;
          list.add(tag);
        }
      }
     
View Full Code Here

    }

    @Override
    protected void handlePacketAdd(Object o, Player owner) {
        if (o instanceof Packet20NamedEntitySpawn) {
            final Packet20NamedEntitySpawn packet = ((Packet20NamedEntitySpawn) o);
            final TagInfo info = this.handler.getNameForPacket20((String) null, packet.a, packet.b, owner);
            if (info != null) {
                packet.b = info.getName();
            }
        }
View Full Code Here

    public static boolean hasCustomNBT(LivingEntity entity, String key) {
        if (entity == null) return false;
        Entity bukkitEntity = entity;
        net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity) bukkitEntity).getHandle();
        NBTTagCompound tag = new NBTTagCompound();

        // Writes the entity's NBT data to tag
        nmsEntity.c(tag);

        // Check for key
        return tag.hasKey(key);
    }
View Full Code Here

    public static String getCustomNBT(LivingEntity entity, String key) {
        if (entity == null) return null;
        Entity bukkitEntity = entity;
        net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity) bukkitEntity).getHandle();
        NBTTagCompound tag = new NBTTagCompound();

        // Writes the entity's NBT data to tag
        nmsEntity.c(tag);

        // Return contents of the tag
        return tag.getString(key);
    }
View Full Code Here

     * custom NBT.
     */

    public static boolean hasCustomNBT(ItemStack item, String key) {
        if (item == null) return false;
        NBTTagCompound tag;
        net.minecraft.server.v1_7_R4.ItemStack cis = CraftItemStack.asNMSCopy(item);
        if (!cis.hasTag()) return false;
        tag = cis.getTag();
        // dB.echoDebug(tag.toString());
        // if this item has the NBTData for 'owner', there is an engraving.
        return tag.hasKey(key);
    }
View Full Code Here

    }

    public static String getCustomNBT(ItemStack item, String key) {
        if (item == null) return null;
        net.minecraft.server.v1_7_R4.ItemStack cis = CraftItemStack.asNMSCopy(item);
        NBTTagCompound tag;
        if (!cis.hasTag())
            cis.setTag(new NBTTagCompound());
        tag = cis.getTag();
        // if this item has the NBTData for 'owner', return the value, which is the playername of the 'owner'.
        if (tag.hasKey(key)) return tag.getString(key);
        return null;

    }
View Full Code Here

    }

    public static ItemStack removeCustomNBT(ItemStack item, String key) {
        if (item == null) return null;
        net.minecraft.server.v1_7_R4.ItemStack cis = CraftItemStack.asNMSCopy(item);
        NBTTagCompound tag;
        if (!cis.hasTag())
            cis.setTag(new NBTTagCompound());
        tag = cis.getTag();
        // remove 'owner' NBTData
        tag.remove(key);
        return CraftItemStack.asCraftMirror(cis);
    }
View Full Code Here

    }

    public static ItemStack addCustomNBT(ItemStack item, String key, String value) {
        if (item == null) return null;
        net.minecraft.server.v1_7_R4.ItemStack cis = CraftItemStack.asNMSCopy(item);
        NBTTagCompound tag = null;
        // Do stuff with tag
        if (!cis.hasTag())
            cis.setTag(new NBTTagCompound());
        tag = cis.getTag();
        tag.setString(key, value);
        return CraftItemStack.asCraftMirror(cis);
    }
View Full Code Here

TOP

Related Classes of net.minecraft.server.v1_4_R1.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.