Use the ItemTool(float, float, ToolMaterial, Set<Block>) constructor instead of the ItemTool(ToolMaterial, Set<Block>) constructor to set the attack damage and speed directly.
Remove the Item#getAttributeModifiers override.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Use the ItemTool(float, float, ToolMaterial, Set<Block>) constructor instead of the ItemTool(ToolMaterial, Set<Block>) constructor to set the attack damage and speed directly.
i have an error "The method getAttributeUnlocalizedName() is undefined for the type IAttribute" in this line:
final Collection<AttributeModifier> modifiers = modifierMultimap.get(attribute.getAttributeUnlocalizedName());
The only thing i can do is add cast to 'attribute'. When i did it the line that i gave u turned into:
final Collection<AttributeModifier> modifiers = modifierMultimap.get(((Object) attribute).getAttributeUnlocalizedName());
And now error is: "The method getAttributeUnlocalizedName() is undefined for the type Object"
Programming by quick-fixes won't get you anywhere, you need to have a solid understanding of Java to make a mod.
According to MCPBot, IAttribute#getAttributeUnlocalizedName was renamed to IAttribute#getName on 2016-11-16.
When you find old code with methods that don't exist any more, you can try looking in the class for similarly-named methods or look at MCPBot's history for the method.
You can look at the latest version of my code on GitHub by selecting a branch from the tree/branch dropdown near the top of the page.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
So what do I change
Use the ItemTool(float, float, ToolMaterial, Set<Block>) constructor instead of the ItemTool(ToolMaterial, Set<Block>) constructor to set the attack damage and speed directly.
Remove the Item#getAttributeModifiers override.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Thanks Choonster that works well.
i have an error "The method getAttributeUnlocalizedName() is undefined for the type IAttribute" in this line:
final Collection<AttributeModifier> modifiers = modifierMultimap.get(attribute.getAttributeUnlocalizedName());
The only thing i can do is add cast to 'attribute'. When i did it the line that i gave u turned into:
final Collection<AttributeModifier> modifiers = modifierMultimap.get(((Object) attribute).getAttributeUnlocalizedName());
And now error is: "The method getAttributeUnlocalizedName() is undefined for the type Object"
Programming by quick-fixes won't get you anywhere, you need to have a solid understanding of Java to make a mod.
According to MCPBot, IAttribute#getAttributeUnlocalizedName was renamed to IAttribute#getName on 2016-11-16.
When you find old code with methods that don't exist any more, you can try looking in the class for similarly-named methods or look at MCPBot's history for the method.
You can look at the latest version of my code on GitHub by selecting a branch from the tree/branch dropdown near the top of the page.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.