EntityAttributeModifiers#mapify now includes a slot_group key on 1.20+ and a key key on 1.21+; the id key is in a try/catch to still supply it where possible for legacy attributes and silently fail for other ones.
EntityAttributeModifiers#modiferForMap now takes in a TagContext and has been updated for the new keys & calling #parseLegacyModifier when needed.
EntityTag.add_attribute_modifiers's "modifier already exists" message now properly shows the key on 1.21+ & uses Mecahnism#echoError.
remove_attribute_modifiers mechanisms now remove modifiers by key instead of UUID on 1.21+ (which technically back-supports legacy ones, since they get updated to minecraft:<UUID> it seems.
Removed ItemAttributeModifiers#getIdString as it wasn't used anymore.
Additions
EntityAttributeModifiers#parseLegacyModifier - parses a pre-1.21 attribute modifier from a map, optionally allowing a slot_group on 1.20+ - just to nicely split the modern and legacy code.
pre1_21AttributeFormatVerySlowWarning - deprecation warning for these attribute changes.
[!NOTE]
The way slot_groups are represented there isn't great - it works, but you can't really do anything with them other then knowing their name (e.g. mainly checking if they contain a slot); The only way I can really see to cleanly solve this is a EquipmentSlotGroup tag, but lmk what do you think.
[!NOTE]
Not sure if the tern-in-if in I did in remove_attribute_modifiers mechanisms is the best approach? seemed nicer then having both if statements.
Changes
EntityAttributeModifiers#mapify
now includes aslot_group
key on 1.20+ and akey
key on 1.21+; theid
key is in atry/catch
to still supply it where possible for legacy attributes and silently fail for other ones.EntityAttributeModifiers#modiferForMap
now takes in aTagContext
and has been updated for the new keys & calling#parseLegacyModifier
when needed.EntityTag.add_attribute_modifiers
's "modifier already exists" message now properly shows the key on 1.21+ & usesMecahnism#echoError
.remove_attribute_modifiers
mechanisms now remove modifiers by key instead of UUID on 1.21+ (which technically back-supports legacy ones, since they get updated tominecraft:<UUID>
it seems.ItemAttributeModifiers#getIdString
as it wasn't used anymore.Additions
EntityAttributeModifiers#parseLegacyModifier
- parses a pre-1.21 attribute modifier from a map, optionally allowing aslot_group
on 1.20+ - just to nicely split the modern and legacy code.pre1_21AttributeFormat
VerySlowWarning
- deprecation warning for these attribute changes.