Program: 174697
Project: 174697
Buggy source:
/** 
 * Creates a new Attribute Modifier tag list and adds it to the NBTTagCompound. Overrides default vanilla implementation.
 * @param nbt
 * @param sword
 */
public static void setAttributeModifiers(NBTTagCompound nbt,ItemStack stack){
  Item item=stack.getItem();
  if (item instanceof ItemSword) {
    Multimap<String,AttributeModifier> map=item.getAttributeModifiers(EntityEquipmentSlot.MAINHAND,stack);
    Collection<AttributeModifier> damageCollection=map.get(SharedMonsterAttributes.ATTACK_DAMAGE.getName());
    Collection<AttributeModifier> speedCollection=map.get(SharedMonsterAttributes.ATTACK_SPEED.getName());
    AttributeModifier damageModifier=(AttributeModifier)damageCollection.toArray()[0];
    AttributeModifier speedModifier=(AttributeModifier)speedCollection.toArray()[0];
    double baseDamage=damageModifier.getAmount();
    double baseSpeed=speedModifier.getAmount();
    double damage=ItemGeneratorHelper.getWeightedDamage(nbt,Rarity.getRarity(nbt),baseDamage);
    double speed=ItemGeneratorHelper.getWeightedAttackSpeed(Rarity.getRarity(nbt),baseSpeed);
    ItemGeneratorHelper.setMinMaxDamage(nbt,damage);
    AttributeModifier attackDamage=new AttributeModifier(ATTACK_DAMAGE,"String_Node_Str",damage,0);
    AttributeModifier attackSpeed=new AttributeModifier(ATTACK_SPEED,"String_Node_Str",speed,0);
    NBTTagCompound damageNbt=ItemGeneratorHelper.writeAttributeModifierToNBT(SharedMonsterAttributes.ATTACK_DAMAGE,attackDamage,EntityEquipmentSlot.MAINHAND);
    NBTTagCompound speedNbt=ItemGeneratorHelper.writeAttributeModifierToNBT(SharedMonsterAttributes.ATTACK_SPEED,attackSpeed,EntityEquipmentSlot.MAINHAND);
    NBTTagList list=new NBTTagList();
    list.appendTag(damageNbt);
    list.appendTag(speedNbt);
    nbt.setTag("String_Node_Str",list);
  }
 else   if (item instanceof ItemArmor) {
    Multimap<String,AttributeModifier> map=((ItemArmor)item).getAttributeModifiers(((ItemArmor)item).armorType,stack);
    Collection<AttributeModifier> armorCollection=map.get(SharedMonsterAttributes.ARMOR.getName());
    Collection<AttributeModifier> toughnessCollection=map.get(SharedMonsterAttributes.ARMOR_TOUGHNESS.getName());
    AttributeModifier armorModifier=(AttributeModifier)armorCollection.toArray()[0];
    AttributeModifier toughnessModifier=(AttributeModifier)toughnessCollection.toArray()[0];
    double baseArmor=armorModifier.getAmount();
    double baseToughness=toughnessModifier.getAmount();
    double newArmor=ItemGeneratorHelper.getWeightedArmor(Rarity.getRarity(nbt),baseArmor);
    double newToughness=ItemGeneratorHelper.getWeightedArmorToughness(Rarity.getRarity(nbt),baseToughness);
    AttributeModifier armor=new AttributeModifier(ARMOR,"String_Node_Str",newArmor,0);
    AttributeModifier toughness=new AttributeModifier(ARMOR_TOUGHNESS,"String_Node_Str",newToughness,0);
    NBTTagCompound armorNbt=ItemGeneratorHelper.writeAttributeModifierToNBT(SharedMonsterAttributes.ARMOR,armor,((ItemArmor)item).armorType);
    NBTTagCompound toughnessNbt=ItemGeneratorHelper.writeAttributeModifierToNBT(SharedMonsterAttributes.ARMOR_TOUGHNESS,toughness,((ItemArmor)item).armorType);
    NBTTagList list=new NBTTagList();
    list.appendTag(armorNbt);
    list.appendTag(toughnessNbt);
    nbt.setTag("String_Node_Str",list);
  }
}

Fixed version (ground truth):
/** 
 * Creates a new Attribute Modifier tag list and adds it to the NBTTagCompound. Overrides default vanilla implementation.
 * @param nbt
 * @param sword
 */
public static void setAttributeModifiers(NBTTagCompound nbt,ItemStack stack){
  Item item=stack.getItem();
  if (item instanceof ItemSword) {
    @SuppressWarnings("String_Node_Str") Multimap<String,AttributeModifier> map=item.getItemAttributeModifiers(EntityEquipmentSlot.MAINHAND);
    Collection<AttributeModifier> damageCollection=map.get(SharedMonsterAttributes.ATTACK_DAMAGE.getName());
    Collection<AttributeModifier> speedCollection=map.get(SharedMonsterAttributes.ATTACK_SPEED.getName());
    AttributeModifier damageModifier=(AttributeModifier)damageCollection.toArray()[0];
    AttributeModifier speedModifier=(AttributeModifier)speedCollection.toArray()[0];
    double baseDamage=damageModifier.getAmount();
    double baseSpeed=speedModifier.getAmount();
    double damage=ItemGeneratorHelper.getWeightedDamage(nbt,Rarity.getRarity(nbt),baseDamage);
    double speed=ItemGeneratorHelper.getWeightedAttackSpeed(Rarity.getRarity(nbt),baseSpeed);
    ItemGeneratorHelper.setMinMaxDamage(nbt,damage);
    AttributeModifier attackDamage=new AttributeModifier(ATTACK_DAMAGE,"String_Node_Str",damage,0);
    AttributeModifier attackSpeed=new AttributeModifier(ATTACK_SPEED,"String_Node_Str",speed,0);
    NBTTagCompound damageNbt=ItemGeneratorHelper.writeAttributeModifierToNBT(SharedMonsterAttributes.ATTACK_DAMAGE,attackDamage,EntityEquipmentSlot.MAINHAND);
    NBTTagCompound speedNbt=ItemGeneratorHelper.writeAttributeModifierToNBT(SharedMonsterAttributes.ATTACK_SPEED,attackSpeed,EntityEquipmentSlot.MAINHAND);
    NBTTagList list=new NBTTagList();
    list.appendTag(damageNbt);
    list.appendTag(speedNbt);
    nbt.setTag("String_Node_Str",list);
  }
 else   if (item instanceof ItemArmor) {
    Multimap<String,AttributeModifier> map=((ItemArmor)item).getAttributeModifiers(((ItemArmor)item).armorType,stack);
    Collection<AttributeModifier> armorCollection=map.get(SharedMonsterAttributes.ARMOR.getName());
    Collection<AttributeModifier> toughnessCollection=map.get(SharedMonsterAttributes.ARMOR_TOUGHNESS.getName());
    AttributeModifier armorModifier=(AttributeModifier)armorCollection.toArray()[0];
    AttributeModifier toughnessModifier=(AttributeModifier)toughnessCollection.toArray()[0];
    double baseArmor=armorModifier.getAmount();
    double baseToughness=toughnessModifier.getAmount();
    double newArmor=ItemGeneratorHelper.getWeightedArmor(Rarity.getRarity(nbt),baseArmor);
    double newToughness=ItemGeneratorHelper.getWeightedArmorToughness(Rarity.getRarity(nbt),baseToughness);
    AttributeModifier armor=new AttributeModifier(ARMOR,"String_Node_Str",newArmor,0);
    AttributeModifier toughness=new AttributeModifier(ARMOR_TOUGHNESS,"String_Node_Str",newToughness,0);
    NBTTagCompound armorNbt=ItemGeneratorHelper.writeAttributeModifierToNBT(SharedMonsterAttributes.ARMOR,armor,((ItemArmor)item).armorType);
    NBTTagCompound toughnessNbt=ItemGeneratorHelper.writeAttributeModifierToNBT(SharedMonsterAttributes.ARMOR_TOUGHNESS,toughness,((ItemArmor)item).armorType);
    NBTTagList list=new NBTTagList();
    list.appendTag(armorNbt);
    list.appendTag(toughnessNbt);
    nbt.setTag("String_Node_Str",list);
  }
}