@Override public @Nonnull Multimap<String, AttributeModifier> getAttributeModifiers(@Nonnull EntityEquipmentSlot equipmentSlot, @Nonnull ItemStack stack) { Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier> create(); if (equipmentSlot == this.armorType) { ArmorMaterial armorMaterial = getMaterial(stack); multimap.put(SharedMonsterAttributes.ARMOR.getName(), new AttributeModifier(ARMOR_MODIFIERS.get(equipmentSlot), "Armor modifier", armorMaterial.getDamageReductionAmount(equipmentSlot), 0)); multimap.put(SharedMonsterAttributes.ARMOR_TOUGHNESS.getName(), new AttributeModifier(ARMOR_MODIFIERS.get(equipmentSlot), "Armor toughness", armorMaterial.getToughness(), 0)); } return multimap; }
@Override public int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int slot) { NBTTagCompound plateNBT = getPlateNBT(armor); if (plateNBT != null) { return UtilPlates.getPlate(plateNBT.getString("ID")).getDamageReductionAmount(armorType, DamageSource.GENERIC); } return ArmorMaterial.LEATHER.getDamageReductionAmount(armorType); }
@Override public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) { double ratio = 0d; // percentage of damage that is removed before normal armor calculations are done. This is actually bad for armor with a high // toughness... if (!source.isUnblockable()) { ArmorMaterial armorMaterial = getMaterial(armor); int damageReductionAmount = armorMaterial.getDamageReductionAmount(armorType) - ArmorMaterial.DIAMOND.getDamageReductionAmount(armorType); if (damageReductionAmount > 0) { // Reduce the damage by 5% for each point of armor we have more than diamond ratio = damageReductionAmount * .05d; // This is just to counter the maximum effective armor (80%) vanilla enforces for normal armor calculations } } return new ArmorProperties(0, ratio, Integer.MAX_VALUE); }
private static void registerEmeraldMaterial() { MaterialRegistry.emeraldArmorMaterial = EnumHelper.addArmorMaterial(emeraldName, Const.MODRES + emeraldName, diamondDurability + 30, //was -2 affects DURABILITY new int[] { ArmorMaterial.DIAMOND.getDamageReductionAmount(EntityEquipmentSlot.FEET), ArmorMaterial.DIAMOND.getDamageReductionAmount(EntityEquipmentSlot.LEGS), ArmorMaterial.DIAMOND.getDamageReductionAmount(EntityEquipmentSlot.CHEST), ArmorMaterial.DIAMOND.getDamageReductionAmount(EntityEquipmentSlot.HEAD) }, ArmorMaterial.GOLD.getEnchantability(), ArmorMaterial.DIAMOND.getSoundEvent(), ArmorMaterial.DIAMOND.getToughness() + 1);//was / 2 MaterialRegistry.emeraldArmorMaterial.repairMaterial = new ItemStack(Items.EMERALD); //max uses is durability ex The number of uses this material allows. //as of 1.9.4 : (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32) MaterialRegistry.emeraldToolMaterial = EnumHelper.addToolMaterial(emeraldName, ToolMaterial.DIAMOND.getHarvestLevel(), ToolMaterial.DIAMOND.getMaxUses(), //was - 261 ToolMaterial.DIAMOND.getEfficiency(), ToolMaterial.DIAMOND.getAttackDamage(), //was - 0.25F ToolMaterial.GOLD.getEnchantability()); MaterialRegistry.emeraldToolMaterial.setRepairItem(MaterialRegistry.emeraldArmorMaterial.repairMaterial); }
private static void registerPurpleMaterial() { ArmorMaterial mimicArmor = ArmorMaterial.DIAMOND; MaterialRegistry.powerArmorMaterial = EnumHelper.addArmorMaterial(MATERIALNAME, Const.MODRES + MATERIALNAME, diamondDurability * 2, // affects DURABILITY . 15 is the same as iron new int[] { mimicArmor.getDamageReductionAmount(EntityEquipmentSlot.FEET) + 1, mimicArmor.getDamageReductionAmount(EntityEquipmentSlot.LEGS) + 1, mimicArmor.getDamageReductionAmount(EntityEquipmentSlot.CHEST) + 1, mimicArmor.getDamageReductionAmount(EntityEquipmentSlot.HEAD) + 2 }, mimicArmor.getEnchantability() / 4, mimicArmor.getSoundEvent(), mimicArmor.getToughness() + 2); MaterialRegistry.powerArmorMaterial.repairMaterial = new ItemStack(Blocks.OBSIDIAN); //now the tool material MaterialRegistry.powerToolMaterial = EnumHelper.addToolMaterial(MATERIALNAME, ToolMaterial.DIAMOND.getHarvestLevel(), ToolMaterial.DIAMOND.getMaxUses() * 4, //was - 261 ToolMaterial.DIAMOND.getEfficiency(), ToolMaterial.DIAMOND.getAttackDamage() * 8, //best draconic evolution sword is 35 base, so this is not that crazy ToolMaterial.GOLD.getEnchantability() * 2); MaterialRegistry.powerToolMaterial.setRepairItem(MaterialRegistry.powerArmorMaterial.repairMaterial); }
@Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { // TODO: Re-implement when Forge fixes this thing. // if (source.damageType.equals("flux")) { // return FLUX; // } else if (source.damageType.equals("fall")) { // if (slot == 0) { // int absorbMax = energyPerDamage > 0 ? 25 * getEnergyStored(armor) / energyPerDamage : 0; // return new ArmorProperties(0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.25, absorbMax); // } // return FALL; // } else if (source.isUnblockable()) { // int absorbMax = energyPerDamage > 0 ? 25 * getEnergyStored(armor) / energyPerDamage : 0; // return new ArmorProperties(0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.025, absorbMax); // } int absorbMax = energyPerDamage > 0 ? 25 * getEnergyStored(armor) / energyPerDamage : 0; return new ArmorProperties(0, absorbRatio * getArmorMaterial().getDamageReductionAmount(armorType) * 0.05, absorbMax); // 0.05 = 1 / 20 (max armor) }
private static void registerGlowingMaterials() { ArmorMaterial mimicArmor = ArmorMaterial.IRON; MaterialRegistry.glowingArmorMaterial = EnumHelper.addArmorMaterial(GLOWING, Const.MODRES + GLOWING, ironDurability, // affects DURABILITY new int[] { mimicArmor.getDamageReductionAmount(EntityEquipmentSlot.FEET), mimicArmor.getDamageReductionAmount(EntityEquipmentSlot.LEGS), mimicArmor.getDamageReductionAmount(EntityEquipmentSlot.CHEST), mimicArmor.getDamageReductionAmount(EntityEquipmentSlot.HEAD) }, mimicArmor.getEnchantability() + 1, mimicArmor.getSoundEvent(), mimicArmor.getToughness() + 1); MaterialRegistry.glowingArmorMaterial.repairMaterial = new ItemStack(Blocks.GLOWSTONE); }
@Override public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { if (getEnergyStored(armor) >= energyPerDamage) { return getArmorMaterial().getDamageReductionAmount(armorType); } return 0; }
@Override public int getArmorDisplay(EntityPlayer player, @Nonnull ItemStack armor, int slot) { if (armor.hasTagCompound()) { if (armor.getTagCompound().hasKey("Plate")) { ExosuitPlate plate = UtilPlates.getPlate(armor.getTagCompound().getString("Plate")); return plate.getDamageReductionAmount(armorType, DamageSource.GENERIC); } } return ItemArmor.ArmorMaterial.LEATHER.getDamageReductionAmount(armorType); }
@Override public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) { if (armor.hasTagCompound()) { if (armor.getTagCompound().hasKey("Plate")) { ExosuitPlate plate = UtilPlates.getPlate(armor.getTagCompound().getString("Plate")); return new ArmorProperties(0, plate.getDamageReductionAmount(armorType, source) / 25.0D, ItemArmor.ArmorMaterial.IRON.getDurability(armorType)); } } return new ArmorProperties(0, ItemArmor.ArmorMaterial.IRON.getDamageReductionAmount(armorType) / 25.0D, ItemArmor.ArmorMaterial.IRON.getDurability(armorType)); }
@Override public int getDamageReductionAmount(EntityEquipmentSlot slot, DamageSource source) { if (source.isExplosion()) { return ItemArmor.ArmorMaterial.DIAMOND.getDamageReductionAmount(slot); } return super.getDamageReductionAmount(slot, source); } }
@Override public int getDamageReductionAmount(EntityEquipmentSlot slot, DamageSource source) { if (source.isProjectile()) { return ItemArmor.ArmorMaterial.DIAMOND.getDamageReductionAmount(slot) - 1; } return super.getDamageReductionAmount(slot, source); }
private static int armorSlotAndToughnessCompare(ItemStack stack1, ItemStack stack2) { ItemArmor armor1 = (ItemArmor) stack1.getItem(); ItemArmor armor2 = (ItemArmor) stack2.getItem(); EntityEquipmentSlot slot1 = armor1.armorType; EntityEquipmentSlot slot2 = armor2.armorType; if(slot1 == slot2) return armor2.getArmorMaterial().getDamageReductionAmount(slot2) - armor2.getArmorMaterial().getDamageReductionAmount(slot1); return slot2.getIndex() - slot1.getIndex(); }
@Override public int getDamageReductionAmount(EntityEquipmentSlot slot, DamageSource source) { if (source.isFireDamage()) { return ItemArmor.ArmorMaterial.DIAMOND.getDamageReductionAmount(slot); } return super.getDamageReductionAmount(slot, source); } }
@Override public int getDamageReductionAmount(EntityEquipmentSlot slot, DamageSource source) { if (source.isProjectile()) { return ItemArmor.ArmorMaterial.DIAMOND.getDamageReductionAmount(slot); } return super.getDamageReductionAmount(slot, source); } }