protected void b(NBTTagCompound nbttagcompound) {
    NBTTagList nbttaglist = nbttagcompound.getList("Entrances", 11);

    for (int i = 0; i < nbttaglist.size(); ++i) {
      this.a.add(new StructureBoundingBox(nbttaglist.c(i)));
    }
  }
  public static void a(Map map, ItemStack itemstack) {
    NBTTagList nbttaglist = new NBTTagList();
    Iterator iterator = map.keySet().iterator();

    while (iterator.hasNext()) {
      int i = ((Integer) iterator.next()).intValue();
      NBTTagCompound nbttagcompound = new NBTTagCompound();

      nbttagcompound.setShort("id", (short) i);
      nbttagcompound.setShort("lvl", (short) ((Integer) map.get(Integer.valueOf(i))).intValue());
      nbttaglist.add(nbttagcompound);
      if (itemstack.getItem() == Items.ENCHANTED_BOOK) {
        Items.ENCHANTED_BOOK.a(
            itemstack,
            new EnchantmentInstance(i, ((Integer) map.get(Integer.valueOf(i))).intValue()));
      }
    }

    if (nbttaglist.size() > 0) {
      if (itemstack.getItem() != Items.ENCHANTED_BOOK) {
        itemstack.a("ench", (NBTBase) nbttaglist);
      }
    } else if (itemstack.hasTag()) {
      itemstack.getTag().remove("ench");
    }
  }
Esempio n. 3
0
  public void a(NBTTagCompound nbttagcompound) {
    super.a(nbttagcompound);
    this.o(nbttagcompound.getBoolean("EatingHaystack"));
    this.k(nbttagcompound.getBoolean("Bred"));
    this.setHasChest(nbttagcompound.getBoolean("ChestedHorse"));
    this.m(nbttagcompound.getBoolean("HasReproduced"));
    this.setType(nbttagcompound.getInt("Type"));
    this.setVariant(nbttagcompound.getInt("Variant"));
    this.setTemper(nbttagcompound.getInt("Temper"));
    this.setTame(nbttagcompound.getBoolean("Tame"));
    if (nbttagcompound.hasKeyOfType("OwnerUUID", 8)) {
      this.setOwnerUUID(nbttagcompound.getString("OwnerUUID"));
    }
    // CraftBukkit start
    if (nbttagcompound.hasKey("Bukkit.MaxDomestication")) {
      this.maxDomestication = nbttagcompound.getInt("Bukkit.MaxDomestication");
    }
    // CraftBukkit end
    AttributeInstance attributeinstance = this.bb().a("Speed");

    if (attributeinstance != null) {
      this.getAttributeInstance(GenericAttributes.d).setValue(attributeinstance.b() * 0.25D);
    }

    if (this.hasChest()) {
      NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);

      this.loadChest();

      for (int i = 0; i < nbttaglist.size(); ++i) {
        NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
        int j = nbttagcompound1.getByte("Slot") & 255;

        if (j >= 2 && j < this.inventoryChest.getSize()) {
          this.inventoryChest.setItem(j, ItemStack.createStack(nbttagcompound1));
        }
      }
    }

    ItemStack itemstack;

    if (nbttagcompound.hasKeyOfType("ArmorItem", 10)) {
      itemstack = ItemStack.createStack(nbttagcompound.getCompound("ArmorItem"));
      if (itemstack != null && a(itemstack.getItem())) {
        this.inventoryChest.setItem(1, itemstack);
      }
    }

    if (nbttagcompound.hasKeyOfType("SaddleItem", 10)) {
      itemstack = ItemStack.createStack(nbttagcompound.getCompound("SaddleItem"));
      if (itemstack != null && itemstack.getItem() == Items.SADDLE) {
        this.inventoryChest.setItem(0, itemstack);
      }
    } else if (nbttagcompound.getBoolean("Saddle")) {
      this.inventoryChest.setItem(0, new ItemStack(Items.SADDLE));
    }

    this.cO();
  }
Esempio n. 4
0
  public void b(ICommandListener icommandlistener, String[] astring) {
    if (astring.length < 2) {
      throw new ExceptionUsage("commands.enchant.usage", new Object[0]);
    } else {
      EntityPlayer entityplayer = d(icommandlistener, astring[0]);
      int i = a(icommandlistener, astring[1], 0, Enchantment.byId.length - 1);
      int j = 1;
      ItemStack itemstack = entityplayer.bx();

      if (itemstack == null) {
        throw new CommandException("commands.enchant.noItem", new Object[0]);
      } else {
        Enchantment enchantment = Enchantment.byId[i];

        if (enchantment == null) {
          throw new ExceptionInvalidNumber(
              "commands.enchant.notFound", new Object[] {Integer.valueOf(i)});
        } else if (!enchantment.canEnchant(itemstack)) {
          throw new CommandException("commands.enchant.cantEnchant", new Object[0]);
        } else {
          if (astring.length >= 3) {
            j =
                a(
                    icommandlistener,
                    astring[2],
                    enchantment.getStartLevel(),
                    enchantment.getMaxLevel());
          }

          if (itemstack.hasTag()) {
            NBTTagList nbttaglist = itemstack.getEnchantments();

            if (nbttaglist != null) {
              for (int k = 0; k < nbttaglist.size(); ++k) {
                short short1 = ((NBTTagCompound) nbttaglist.get(k)).getShort("id");

                if (Enchantment.byId[short1] != null) {
                  Enchantment enchantment1 = Enchantment.byId[short1];

                  if (!enchantment1.a(enchantment)) {
                    throw new CommandException(
                        "commands.enchant.cantCombine",
                        new Object[] {
                          enchantment.c(j),
                          enchantment1.c(((NBTTagCompound) nbttaglist.get(k)).getShort("lvl"))
                        });
                  }
                }
              }
            }
          }

          itemstack.addEnchantment(enchantment, j);
          a(icommandlistener, "commands.enchant.success", new Object[0]);
        }
      }
    }
  }
  public void b(NBTTagCompound nbttagcompound) {
    super.b(nbttagcompound);
    if (nbttagcompound.hasKeyOfType("Processed", 9)) {
      NBTTagList nbttaglist = nbttagcompound.getList("Processed", 10);

      for (int i = 0; i < nbttaglist.size(); ++i) {
        NBTTagCompound nbttagcompound1 = nbttaglist.get(i);

        this.c.add(new ChunkCoordIntPair(nbttagcompound1.getInt("X"), nbttagcompound1.getInt("Z")));
      }
    }
  }
Esempio n. 6
0
  public void a(NBTTagCompound nbttagcompound) {
    this.m(nbttagcompound.getFloat("AbsorptionAmount"));
    if (nbttagcompound.hasKey("Attributes") && this.world != null && !this.world.isStatic) {
      GenericAttributes.a(
          this.aX(),
          nbttagcompound.getList("Attributes"),
          this.world == null ? null : this.world.getLogger());
    }

    if (nbttagcompound.hasKey("ActiveEffects")) {
      NBTTagList nbttaglist = nbttagcompound.getList("ActiveEffects");

      for (int i = 0; i < nbttaglist.size(); ++i) {
        NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
        MobEffect mobeffect = MobEffect.b(nbttagcompound1);

        this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect);
      }
    }

    // CraftBukkit start
    if (nbttagcompound.hasKey("Bukkit.MaxHealth")) {
      NBTBase nbtbase = nbttagcompound.get("Bukkit.MaxHealth");
      if (nbtbase.getTypeId() == 5) {
        this.getAttributeInstance(GenericAttributes.a)
            .setValue((double) ((NBTTagFloat) nbtbase).data);
      } else if (nbtbase.getTypeId() == 3) {
        this.getAttributeInstance(GenericAttributes.a)
            .setValue((double) ((NBTTagInt) nbtbase).data);
      }
    }
    // CraftBukkit end

    if (nbttagcompound.hasKey("HealF")) {
      this.setHealth(nbttagcompound.getFloat("HealF"));
    } else {
      NBTBase nbtbase = nbttagcompound.get("Health");

      if (nbtbase == null) {
        this.setHealth(this.getMaxHealth());
      } else if (nbtbase.getTypeId() == 5) {
        this.setHealth(((NBTTagFloat) nbtbase).data);
      } else if (nbtbase.getTypeId() == 2) {
        this.setHealth((float) ((NBTTagShort) nbtbase).data);
      }
    }

    this.hurtTicks = nbttagcompound.getShort("HurtTime");
    this.deathTicks = nbttagcompound.getShort("DeathTime");
    this.attackTicks = nbttagcompound.getShort("AttackTime");
  }
  private static void a(EnchantmentModifier enchantmentmodifier, ItemStack itemstack) {
    if (itemstack != null) {
      NBTTagList nbttaglist = itemstack.getEnchantments();

      if (nbttaglist != null) {
        for (int i = 0; i < nbttaglist.size(); ++i) {
          short short1 = nbttaglist.get(i).getShort("id");
          short short2 = nbttaglist.get(i).getShort("lvl");

          if (Enchantment.byId[short1] != null) {
            enchantmentmodifier.a(Enchantment.byId[short1], short2);
          }
        }
      }
    }
  }
  public void a(NBTTagList nbttaglist) {
    int i;

    for (i = 0; i < this.getSize(); ++i) {
      this.setItem(i, (ItemStack) null);
    }

    for (i = 0; i < nbttaglist.size(); ++i) {
      NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.get(i);
      int j = nbttagcompound.getByte("Slot") & 255;

      if (j >= 0 && j < this.getSize()) {
        this.setItem(j, ItemStack.createStack(nbttagcompound));
      }
    }
  }
  public void a(NBTTagCompound nbttagcompound) {
    super.a(nbttagcompound);
    NBTTagList nbttaglist = nbttagcompound.getList("Items");

    this.items = new ItemStack[this.getSize()];

    for (int i = 0; i < nbttaglist.size(); ++i) {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
      byte b0 = nbttagcompound1.getByte("Slot");

      if (b0 >= 0 && b0 < this.items.length) {
        this.items[b0] = ItemStack.a(nbttagcompound1);
      }
    }

    this.brewTime = nbttagcompound.getShort("BrewTime");
  }
Esempio n. 10
0
  public void a(NBTTagCompound nbttagcompound) {
    super.a(nbttagcompound);
    NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);

    this.items = new ItemStack[this.getSize()];
    if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
      this.p = nbttagcompound.getString("CustomName");
    }

    for (int i = 0; i < nbttaglist.size(); ++i) {
      NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
      int j = nbttagcompound1.getByte("Slot") & 255;

      if (j >= 0 && j < this.items.length) {
        this.items[j] = ItemStack.createStack(nbttagcompound1);
      }
    }
  }
Esempio n. 11
0
  public static Map a(ItemStack itemstack) {
    LinkedHashMap linkedhashmap = new LinkedHashMap();
    NBTTagList nbttaglist =
        itemstack.getItem() == Items.ENCHANTED_BOOK
            ? Items.ENCHANTED_BOOK.g(itemstack)
            : itemstack.getEnchantments();

    if (nbttaglist != null) {
      for (int i = 0; i < nbttaglist.size(); ++i) {
        short short1 = nbttaglist.get(i).getShort("id");
        short short2 = nbttaglist.get(i).getShort("lvl");

        linkedhashmap.put(Integer.valueOf(short1), Integer.valueOf(short2));
      }
    }

    return linkedhashmap;
  }
Esempio n. 12
0
  public void a(NBTTagCompound nbttagcompound) {
    super.a(nbttagcompound);
    NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);

    this.a = new ItemStack[this.getSize()];
    if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
      this.i = nbttagcompound.getString("CustomName");
    }

    this.j = nbttagcompound.getInt("TransferCooldown");

    for (int i = 0; i < nbttaglist.size(); ++i) {
      NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
      byte b0 = nbttagcompound1.getByte("Slot");

      if (b0 >= 0 && b0 < this.a.length) {
        this.a[b0] = ItemStack.createStack(nbttagcompound1);
      }
    }
  }
Esempio n. 13
0
  protected void a(NBTTagCompound nbttagcompound) {
    this.type = nbttagcompound.getInt("Type");
    if (this.type == 2) {
      this.b = nbttagcompound.getDouble("PushX");
      this.c = nbttagcompound.getDouble("PushZ");
      this.e = nbttagcompound.getShort("Fuel");
    } else if (this.type == 1) {
      NBTTagList nbttaglist = nbttagcompound.getList("Items");

      this.items = new ItemStack[this.getSize()];

      for (int i = 0; i < nbttaglist.size(); ++i) {
        NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
        int j = nbttagcompound1.getByte("Slot") & 255;

        if (j >= 0 && j < this.items.length) {
          this.items[j] = ItemStack.a(nbttagcompound1);
        }
      }
    }
  }
Esempio n. 14
0
  public void a(NBTTagCompound nbttagcompound) {
    super.a(nbttagcompound);
    NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);

    this.items = new ItemStack[this.getSize()];

    for (int i = 0; i < nbttaglist.size(); ++i) {
      NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
      byte b0 = nbttagcompound1.getByte("Slot");

      if (b0 >= 0 && b0 < this.items.length) {
        this.items[b0] = ItemStack.createStack(nbttagcompound1);
      }
    }

    this.burnTime = nbttagcompound.getShort("BurnTime");
    this.cookTime = nbttagcompound.getShort("CookTime");
    this.ticksForCurrentFuel = fuelTime(this.items[1]);
    if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
      this.o = nbttagcompound.getString("CustomName");
    }
  }
Esempio n. 15
0
  public static int getEnchantmentLevel(int i, ItemStack itemstack) {
    if (itemstack == null) {
      return 0;
    } else {
      NBTTagList nbttaglist = itemstack.getEnchantments();

      if (nbttaglist == null) {
        return 0;
      } else {
        for (int j = 0; j < nbttaglist.size(); ++j) {
          short short1 = nbttaglist.get(j).getShort("id");
          short short2 = nbttaglist.get(j).getShort("lvl");

          if (short1 == i) {
            return short2;
          }
        }

        return 0;
      }
    }
  }
Esempio n. 16
0
  public static boolean a(NBTTagCompound paramNBTTagCompound) {
    if (paramNBTTagCompound == null) {
      return false;
    }
    if (!paramNBTTagCompound.hasKey("pages")) {
      return false;
    }

    NBTTagList localNBTTagList = (NBTTagList) paramNBTTagCompound.get("pages");
    for (int i = 0; i < localNBTTagList.size(); i++) {
      NBTTagString localNBTTagString = (NBTTagString) localNBTTagList.get(i);

      if (localNBTTagString.data == null) {
        return false;
      }
      if (localNBTTagString.data.length() > 256) {
        return false;
      }
    }

    return true;
  }
Esempio n. 17
0
  public boolean d(Block block) {
    if (block == this.j) {
      return this.k;
    } else {
      this.j = block;
      if (this.hasTag() && this.tag.hasKeyOfType("CanPlaceOn", 9)) {
        NBTTagList nbttaglist = this.tag.getList("CanPlaceOn", 8);

        for (int i = 0; i < nbttaglist.size(); ++i) {
          Block block1 = Block.getByName(nbttaglist.getString(i));

          if (block1 == block) {
            this.k = true;
            return true;
          }
        }
      }

      this.k = false;
      return false;
    }
  }
Esempio n. 18
0
  public void a(NBTTagCompound nbttagcompound) {
    this.m(nbttagcompound.getFloat("AbsorptionAmount"));
    if (nbttagcompound.hasKeyOfType("Attributes", 9)
        && this.world != null
        && !this.world.isStatic) {
      GenericAttributes.a(this.bc(), nbttagcompound.getList("Attributes", 10));
    }

    if (nbttagcompound.hasKeyOfType("ActiveEffects", 9)) {
      NBTTagList nbttaglist = nbttagcompound.getList("ActiveEffects", 10);

      for (int i = 0; i < nbttaglist.size(); ++i) {
        NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
        MobEffect mobeffect = MobEffect.b(nbttagcompound1);

        if (mobeffect != null) {
          this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect);
        }
      }
    }

    if (nbttagcompound.hasKeyOfType("HealF", 99)) {
      this.setHealth(nbttagcompound.getFloat("HealF"));
    } else {
      NBTBase nbtbase = nbttagcompound.get("Health");

      if (nbtbase == null) {
        this.setHealth(this.getMaxHealth());
      } else if (nbtbase.getTypeId() == 5) {
        this.setHealth(((NBTTagFloat) nbtbase).h());
      } else if (nbtbase.getTypeId() == 2) {
        this.setHealth((float) ((NBTTagShort) nbtbase).e());
      }
    }

    this.hurtTicks = nbttagcompound.getShort("HurtTime");
    this.deathTicks = nbttagcompound.getShort("DeathTime");
    this.attackTicks = nbttagcompound.getShort("AttackTime");
  }
Esempio n. 19
0
  public Multimap B() {
    Object object;

    if (this.hasTag() && this.tag.hasKeyOfType("AttributeModifiers", 9)) {
      object = HashMultimap.create();
      NBTTagList nbttaglist = this.tag.getList("AttributeModifiers", 10);

      for (int i = 0; i < nbttaglist.size(); ++i) {
        NBTTagCompound nbttagcompound = nbttaglist.get(i);
        AttributeModifier attributemodifier = GenericAttributes.a(nbttagcompound);

        if (attributemodifier != null
            && attributemodifier.a().getLeastSignificantBits() != 0L
            && attributemodifier.a().getMostSignificantBits() != 0L) {
          ((Multimap) object).put(nbttagcompound.getString("AttributeName"), attributemodifier);
        }
      }
    } else {
      object = this.getItem().i();
    }

    return (Multimap) object;
  }