Client handling of unknown entity attributes is bugged
The client-side handler for entity attribute data currently has an error which will cause exceptions to be thrown in a situation where this is most likely not intended to happen.
Using MCP names, the relevant function is NetHandlerPlayClient.handleEntityProperties (handler for this client-bound packet), which has the following block of code:
IAttributeInstance iattributeinstance = abstractattributemap.getAttributeInstanceByName(spacketentityproperties$snapshot.getName()); if (iattributeinstance == null) { iattributeinstance = abstractattributemap.registerAttribute(new RangedAttribute((IAttribute)null, spacketentityproperties$snapshot.getName(), 0.0D, Double.MIN_NORMAL, Double.MAX_VALUE)); } iattributeinstance.setBaseValue(spacketentityproperties$snapshot.getBaseValue()); iattributeinstance.removeAllModifiers(); for(AttributeModifier attributemodifier : spacketentityproperties$snapshot.getModifiers()) { iattributeinstance.applyModifier(attributemodifier); }
While this appears to be intended to register a dummy attribute instance for any unknown attribute data recieved, the RangedAttribute created here is invalid and will cause an IllegalArgumentException to be thrown by the constructor:
else if (defaultValue < minimumValueIn) { throw new IllegalArgumentException("Default value cannot be lower than minimum value!"); }
This is because the minimum value specified is greater than the default of 0. The correct minimum value should probably be -Double.MAX_VALUE instead of Double.MIN_NORMAL, as negative values are allowed here (e.g. generic.luck).
2019-04-30, 09:45 PM
2020-04-08, 03:49 AM
2020-04-08, 03:49 AM
2
1