Implement tick rate options for OneShot behaviors#9946
Conversation
|
Near duplicate of #9946 unless I am understanding the diff wrong, just implemented on a different layer ? |
|
I could be reading #9916 wrong, but I think it is adding another setting to let you rate limit behaviours that require certain memories: jobsite, bed location, meeting point, etc. As any number of behaviours can depend on a given memory, this would rate limit a large of number of behaviours. This PR just restores the pre-1.19.3 functionality of the existing behaviour rate limit settings, which let you rate limit individual behaviours |
|
Hmmm, possibly a nicer solution then. I mean the other PR just rate limits the try trigger on the pure memory rather than the consuming behaviour. I'll have a longer look over this once home 👍 the mobile diff viewer isn't particularly great |
4c9f7a8 to
0ddcb32
Compare
|
Rebased for 1.20.4 |
TL;DR - 1.19.3 broke Paper's behaviour tick rate settings, this restores the settings' pre-1.19.3 functionality
Some entity AI behaviours were changed in 1.19.3 from having their own classes to becoming instances of the
OneShotbehaviour, includingValidateNearbyPoi. This caused the tick rate options to stop working for those behaviours, as the options use the class names as config keys.This PR re-adds tick rate option support for the behaviours that were affected by the update.
All
OneShotbehaviours are created by a call to theBehaviorBuilder.create()method, which happens in a static method in that behaviour's class, for exampleValidateNearbyPoi:To get the config key for all the
OneShotbehaviours, I've modified theBehaviorBuilder.create()method to grab the calling class of the method from the stack trace, which is then used as the config key. In the case of the snippet above, that would be theValidateNearbyPoiclass. This maintains compatibility with configs before 1.19.3. Kind of an ugly way of doing it, not sure if I'm missing an easier way.Fixes #9925