I previously assumed that I would be able to reset a Player's attributes to their default via something like this:
I.e. clearing all modifiers and resetting the the base value to the default. (I my case the player's inventory is guaranteed to be empty, so there should be no issue with removing modifiers for items)
However, as it turns out attributeInstance.getDefaultValue() doesn't actually return the player's default base value for this attribute (which should be 0.1) but the 'global default' for this attribute (0.7), which different types of entities (such as players) replace with their own default value during the setup of their attributes.
This has gone unnoticed by me before. However, in MC 1.16 the player's movement speed is now controlled not only by the value of the player's walkingSpeed property, but the value of the movement speed attribute. So this has broken now.
Would it be possible expose these entity-type specific default values?
In MC 1.16 this might have become easier to do, since there is now a class 'AttributeDefaults' which provides lookups for the default attributes for a given entity type.