@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); }
protected int getPowerPerDamagePoint(@Nonnull ItemStack stack) { EnergyUpgradeHolder eu = EnergyUpgradeManager.loadFromItem(stack); if (eu != null) { return eu.getCapacity() / data.getArmorMaterial().getDurability(armorType); } else { return 1; } }
@Override public int getItemEnchantability(@Nonnull ItemStack stack) { return getMaterial(stack).getEnchantability(); }
GameRegistry.addSmelting(ModBlocks.myrmex_desert_resin_block, new ItemStack(ModBlocks.myrmex_desert_resin_glass), 1); GameRegistry.addSmelting(ModBlocks.myrmex_jungle_resin_block, new ItemStack(ModBlocks.myrmex_jungle_resin_glass), 1); ModItems.blindfoldArmor.setRepairItem(new ItemStack(Items.STRING)); ModItems.silverMetal.setRepairItem(new ItemStack(ModItems.silverIngot)); ModItems.silverTools.setRepairItem(new ItemStack(ModItems.silverIngot)); ModItems.boneTools.setRepairItem(new ItemStack(ModItems.dragonbone)); ModItems.iceBoneTools.setRepairItem(new ItemStack(ModItems.dragonbone)); for(EnumDragonArmor armor : EnumDragonArmor.values()){ armor.armorMaterial.setRepairItem(new ItemStack(EnumDragonArmor.getScaleItem(armor))); ModItems.sheep.setRepairItem(new ItemStack(Blocks.WOOL)); ModItems.earplugsArmor.setRepairItem(new ItemStack(Blocks.WOODEN_BUTTON)); ModItems.yellow_deathworm.setRepairItem(new ItemStack(ModItems.deathworm_chitin, 1, 0)); ModItems.white_deathworm.setRepairItem(new ItemStack(ModItems.deathworm_chitin, 1, 1)); ModItems.red_deathworm.setRepairItem(new ItemStack(ModItems.deathworm_chitin, 1, 2)); ModItems.trollWeapon.setRepairItem(new ItemStack(Blocks.STONE)); ModItems.troll_mountain.setRepairItem(new ItemStack(EnumTroll.MOUNTAIN.leather)); ModItems.troll_forest.setRepairItem(new ItemStack(EnumTroll.FOREST.leather)); ModItems.troll_frost.setRepairItem(new ItemStack(EnumTroll.FROST.leather)); ItemStack waterBreathingPotion = new ItemStack(Items.POTIONITEM, 1, 0); NBTTagCompound tag = new NBTTagCompound();
quantumFoldManipulator = register(new MOBaseItem("quantum_fold_manipulator")); Preconditions.checkNotNull(TOOL_MATERIAL_TRITANIUM).setRepairItem(new ItemStack(tritanium_ingot)); Preconditions.checkNotNull(ARMOR_MATERIAL_TRITANIUM).setRepairItem(new ItemStack(tritanium_ingot)); MOLog.info("Finished registering items"); MOLog.info("Registered %d items", registeredCount);
material = ((ItemArmor) stack.getItem()).getArmorMaterial().getRepairItemStack(); final EntityEquipmentSlot eq = ((ItemArmor) stack.getItem()).armorType; if (eq == EntityEquipmentSlot.CHEST)
String texture = item.getArmorMaterial().getName(); String domain = "minecraft"; int idx = texture.indexOf(':');
public static void setupShieldStats() { BAMBOO_SHIELD.setShieldType(new ShieldTypeBasic( ItemMaterials.EnumErebusMaterialsType.SHIELD_BAMBOO_FACE.createStack(), ItemMaterials.EnumErebusMaterialsType.BAMBOO.createStack(), null, null, ModMaterials.ARMOR_BAMBOO.getDurability(EntityEquipmentSlot.CHEST) * 2)); EXOSKELETON_SHIELD.setShieldType(new ShieldTypeBasic( ItemMaterials.EnumErebusMaterialsType.SHIELD_EXO_PLATE_FACE.createStack(), ItemMaterials.EnumErebusMaterialsType.PLATE_EXO.createStack(), null, null, ModMaterials.ARMOR_EXOSKELETON.getDurability(EntityEquipmentSlot.CHEST) * 2)); JADE_SHIELD.setShieldType(new ShieldTypeBasic( ItemMaterials.EnumErebusMaterialsType.SHIELD_JADE_FACE.createStack(), ItemMaterials.EnumErebusMaterialsType.JADE.createStack(), null, null, ModMaterials.ARMOR_JADE.getDurability(EntityEquipmentSlot.CHEST) * 2)); REIN_EXOSKELETON_SHIELD.setShieldType(new ShieldTypeBasic( ItemMaterials.EnumErebusMaterialsType.SHIELD_REIN_EXO_FACE.createStack(), ItemMaterials.EnumErebusMaterialsType.REINFORCED_PLATE_EXO.createStack(), null, null, ModMaterials.ARMOR_REIN_EXOSKELETON.getDurability(EntityEquipmentSlot.CHEST) * 2)); RHINO_EXOSKELETON_SHIELD.setShieldType(new ShieldTypeBasic( ItemMaterials.EnumErebusMaterialsType.SHIELD_RHINO_EXO_FACE.createStack(), ItemMaterials.EnumErebusMaterialsType.PLATE_EXO_RHINO.createStack(), null, null, ModMaterials.ARMOR_REIN_EXOSKELETON.getDurability(EntityEquipmentSlot.CHEST) * 2)); }
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); }
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); }
@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); }
private boolean isIronMaterial(ItemStack itemStack) { if (itemStack != null && itemStack.getItem() instanceof ItemArmor) { String materialName = ((ItemArmor) itemStack.getItem()).getArmorMaterial().getName(); return materialName.matches("(?i)(iron|chainmail|tritanium)"); } return false; }
@Override public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { if (getEnergyStored(armor) >= energyPerDamage) { return getArmorMaterial().getDamageReductionAmount(armorType); } return 0; }
@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); }
@Override public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { if (OreDictionary.itemMatches(this.getArmorMaterial().getRepairItemStack(), repair, false)) { return true; } return super.getIsRepairable(toRepair, repair); }
@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 boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { if (OreDictionary.itemMatches(this.getArmorMaterial().getRepairItemStack(), repair, false)) { return true; } return super.getIsRepairable(toRepair, repair); }
@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)); }