Lord_Rius Posted December 8, 2015 Posted December 8, 2015 Hi! I'm trying to get an integer or double value from the current held item attack attribute, i've just found the way to get the base value from an entity using getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue() but i need the value of every held item. Any ideas? Many thanks. Quote
coolAlias Posted December 9, 2015 Posted December 9, 2015 You can get a specific modifier by passing it the correct UUID - luckily, Item uses a static one for weapon damage: AttributeModifier itemDamage = player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.attackDamage).getModifier(itemDamageUUID); Of course, with modded weapons, there is no guarantee the modder would use that, though they typically should. Not much you can do about those kinds of cases. EDIT: Forgot to mention that the Item field is private, so I made a local public static copy (you could also use Reflection if you want): /** Copy of Item#field_111210_e which is the UUID used to store weapon damage modifiers */ public static final UUID itemDamageUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); Quote http://i.imgur.com/NdrFdld.png[/img]
Recommended Posts
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.