i have been having problems with modding tool attack speeds in minecraft 1.11.2. I was able to edit all the tools successfully, but swords here is the codes i have been having a problem with
/**
* Gets a map of item attribute modifiers, used by ItemSword to increase hit damage.
*/
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
{
Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);
if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
{
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double)this.attackDamage, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0));
}
return multimap;
}
this code is located in the ItemsSword. here is what i have tried and no success
1. i copped the ItemsSword and put it in its own class edited the code above. it changes the speed but the sweep attack dose not work and game dose not think my item it is a sword.
2.i put the code above in my items base class and even with the @Override it didn't work. i think it is to do with super.getItemAttributeModifiers(equipmentSlot) because my item base class is extends ItemSword and it pulls the same code in that class making mine not work. i have tried replacing super to Item but i get an error
i had no problems editing the other tools because they extends ItemTool which sword just extends Item
"If you don't understand the bigger picture, writitng a program is difficult. That's true with any computer programming language, not just java. If you're typing code without knowing what it's about, and the code doesn't do exactly what you want it to do, then your just plain stuck." - Dr Burd
Owner/Admin of the amazing and awesome super custom modded Ninjacat Server!
fill free to see what is wrong. the sword class one its own is the one i made its own ItemSword Class (speed change works but the sweep attack is gone). all the ones in the slot1 folder just extends the minecraft ItemSword. (can't changes speed But sweep attack works)
i want to be able to change the speed and keep the sweep attack.
i have been having problems with modding tool attack speeds in minecraft 1.11.2. I was able to edit all the tools successfully, but swords here is the codes i have been having a problem with
/**
* Gets a map of item attribute modifiers, used by ItemSword to increase hit damage.
*/
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot)
{
Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);
if (equipmentSlot == EntityEquipmentSlot.MAINHAND)
{
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double)this.attackDamage, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0));
}
return multimap;
}
this code is located in the ItemsSword. here is what i have tried and no success
1. i copped the ItemsSword and put it in its own class edited the code above. it changes the speed but the sweep attack dose not work and game dose not think my item it is a sword.
2.i put the code above in my items base class and even with the @Override it didn't work. i think it is to do with super.getItemAttributeModifiers(equipmentSlot) because my item base class is extends ItemSword and it pulls the same code in that class making mine not work. i have tried replacing super to Item but i get an error
i had no problems editing the other tools because they extends ItemTool which sword just extends Item
I hope anyone can help me with this problem
Whats the full code for your sword?
here is my full code of my mod so far https://github.com/nate1989/My-Mod/tree/master/metalgemcraft/Items/copper/tools/sword
fill free to see what is wrong. the sword class one its own is the one i made its own ItemSword Class (speed change works but the sweep attack is gone). all the ones in the slot1 folder just extends the minecraft ItemSword. (can't changes speed But sweep attack works)
i want to be able to change the speed and keep the sweep attack.