Examples of Armor


Examples of net.citizensnpcs.utils.InventoryUtils.Armor

                if (npc.getItemInHand().getType() != Material.AIR) {
                    toAdd.add(items.get(0).createStack());
                }
                items.set(0, new ItemData(hand.getTypeId(), hand.getDurability()));
            } else {
                Armor armor = Armor.getArmorSlot(itemID);
                if (armor != null) {
                    ItemStack armorItem = armor.get(npcInv);
                    if (armorItem != null && armorItem.getType() == Material.getMaterial(itemID)) {
                        Messaging.sendError(player, error);
                        return;
                    }
                    slot = armor.name().toLowerCase();
                    if (armorItem != null && armorItem.getType() != Material.AIR) {
                        toAdd.add(items.get(armor.getSlot() + 1).createStack());
                    }
                    items.set(armor.getSlot() + 1, new ItemData(hand.getTypeId(), hand.getDurability()));
                } else {
                    if (Material.getMaterial(items.get(0).getID()) == Material.getMaterial(itemID)) {
                        Messaging.sendError(player, error);
                        return;
                    }
View Full Code Here

Examples of org.spout.vanilla.material.item.armor.Armor

  public void testDamageModifier() {
    ItemStack test = new ItemStack(VanillaMaterials.DIAMOND_CHESTPLATE, 1);
    Enchantment.addEnchantment(test, VanillaEnchantments.PROTECTION, 4, false);
    assertTrue(Enchantment.hasEnchantment(test, VanillaEnchantments.PROTECTION));

    Armor armor = (Armor) test.getMaterial();
    assertTrue((int) Math.ceil(.04 * (armor.getBaseProtection() + armor.getProtection(test, new NullDamageCause(DamageType.CACTUS)))) == 1);
  }
View Full Code Here

Examples of org.spout.vanilla.material.item.armor.Armor

      EntityInventory inv = getOwner().get(EntityInventory.class);
      ArmorInventory armorInv = inv.getArmor();
      // Check if this item is equipable armor and has more protection than the currently equipped item
      boolean equip = false;
      if (item.getItemStack().getMaterial() instanceof Armor) {
        Armor armor = (Armor) item.getItemStack().getMaterial();
        for (int i = 0; i < armorInv.size(); i++) {
          if (armorInv.canSet(i, item.getItemStack())) {
            ItemStack slot = armorInv.get(i);
            if (slot == null || (slot.getMaterial() instanceof Armor && ((Armor) slot.getMaterial()).getBaseProtection() < armor.getBaseProtection())) {
              getOwner().getNetwork().callProtocolEvent(new EntityCollectItemEvent(getOwner(), entity));
              if (slot != null) {
                Item.drop(getOwner().getPhysics().getPosition(), slot, Vector3f.ZERO);
              }
              armorInv.set(i, item.getItemStack(), true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.