Posted January 13, 20223 yr How can I make the attributes be added only for the mainhand. Currently it adds the values for Head, Legs, Chest, Mainhand, offhand and boots. The second problem is that it overwrites the standard values of the sword. I solved this by writing the values at the very front of amountIn and adding the actual calculation to it. @Override public Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack) { Multimap<Attribute, AttributeModifier> attss = LinkedHashMultimap.create(); if (stack.hasTag()){ attss.put(Attributes.ATTACK_SPEED, new AttributeModifier(ATTACK_SPEED_MODIFIER, Soulharvest.MOD_ID + ":speed_bonus", 2+((Math.sqrt((stack.getTag().getInt("KillCounterPhobos") +stack.getTag().getInt("KillCounterPhobosMob"))*2) + (stack.getTag().getInt("KillCounterPhobos") +stack.getTag().getInt("KillCounterPhobosMob"))) / 12.5)* ATTACK_SPEED_MULTIPLY_twin.get(), AttributeModifier.Operation.ADDITION)); attss.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(ATTACK_DAMAGE_MODIFIER, Soulharvest.MOD_ID + ":damage_bonus", 4+((Math.sqrt((stack.getTag().getInt("KillCounterPhobos") + stack.getTag().getInt("KillCounterPhobosMob"))*2) + (stack.getTag().getInt("KillCounterPhobos") + stack.getTag().getInt("KillCounterPhobosMob"))) / 25)*Damage_MULTIPLY_twin.get(), AttributeModifier.Operation.ADDITION)); return attss; } return attss; }
January 13, 20223 yr Author I didn't give the EquipmentSlotType a type, thought would happen automatically with extends SwordItem
January 13, 20223 yr Could you not just wrap your attss.put method in a if statement ? e.g. if(slot == EquipmentSlotType.MAINHAND) { // DO your attss.put code here. } or even add it to your current if statement if (stack.hasTag() && slot == EquipmentSlotType.MAINHAND){ // Do Code }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.