Package com.bergerkiller.bukkit.common.nbt

Examples of com.bergerkiller.bukkit.common.nbt.CommonTagList


    File posFile = WorldConfig.get(world).getPlayerData(player.getName());
    if (!posFile.exists()) {
      return null;
    }
    CommonTagCompound data = read(posFile, player);
    CommonTagList posInfo = data.getValue(DATA_TAG_LASTPOS, CommonTagList.class);
    if (posInfo != null && posInfo.size() == 3) {
      // Apply position
      Location location = new Location(world, posInfo.getValue(0, 0.0), posInfo.getValue(1, 0.0), posInfo.getValue(2, 0.0));
      CommonTagList rotInfo = data.getValue(DATA_TAG_LASTROT, CommonTagList.class);
      if (rotInfo != null && rotInfo.size() == 2) {
        location.setYaw(rotInfo.getValue(0, 0.0f));
        location.setPitch(rotInfo.getValue(1, 0.0f));
      }
      return location;
    }
    return null;
  }
View Full Code Here


      NBTUtil.loadInventory(player.getEnderChest(), data.createList("EnderItems"));
     
      // Load Mob Effects
      HashMap<Integer, Object> effects = EntityHumanRef.mobEffects.get(playerHandle);
      if (data.containsKey("ActiveEffects")) {
        CommonTagList taglist = data.createList("ActiveEffects");
        for (int i = 0; i < taglist.size(); ++i) {
          Object mobEffect = NBTUtil.loadMobEffect((CommonTagCompound) taglist.get(i));
          effects.put(MobEffectRef.effectId.get(mobEffect), mobEffect);
        }
      }
      EntityHumanRef.updateEffects.set(playerHandle, true);
View Full Code Here

        tagcompound.putValue("XpLevel", bukkitTag.getValue("newLevel", 0));
        tagcompound.put("bukkit", bukkitTag);
      }

      // Ender inventory should not end up wiped!
      CommonTagList enderItems = savedInfo.get("EnderItems", CommonTagList.class);
      if (enderItems != null) {
        tagcompound.put("EnderItems", enderItems);
      }

      // Now, go ahead and save this data
View Full Code Here

   *
   * @param in InputStream
   * @return Tag list
   */
  public static CommonTagList createList(DataInputStream in) {
    return new CommonTagList(NBTRef.readTag(in));
  }
View Full Code Here

    if (inventoryHandle == null) {
      throw new IllegalArgumentException("This kind of inventory lacks a handle to load");
    }
    if (inventoryHandle instanceof PlayerInventory) {
      if (list == null) {
        list = new CommonTagList();
      }
      ((PlayerInventory) inventoryHandle).a((NBTTagList) list.getHandle());
    } else if (inventoryHandle instanceof InventoryEnderChest) {     
      Object handle = ((InventoryEnderChest) inventoryHandle).h();
      if (list == null) {
View Full Code Here

    if (!item1.getItemMeta().equals(item2.getItemMeta())) {
      return false;
    }

    // Not included in metadata checks: Item attributes (Bukkit needs to update)
    CommonTagList item1Attr = getMetaTag(item1).get("AttributeModifiers", CommonTagList.class);
    CommonTagList item2Attr = getMetaTag(item2).get("AttributeModifiers", CommonTagList.class);
    return LogicUtil.bothNullOrEqual(item1Attr, item2Attr);
  }
View Full Code Here

TOP

Related Classes of com.bergerkiller.bukkit.common.nbt.CommonTagList

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.