LookAtTarget does not work as indicated by SBLSkeleton
Thelnfamous1 opened this issue ยท 1 comments
LookAtTarget
overrides Behavior#timedOut
, which means you cannot set it to run for a set duration before terminating via ExtendedBehavior#runFor
.
In my personal use-case, I was attempting to make LookAtTarget
work more like vanilla's LookAtTargetSink
, as I was having issues with a mob never changing its look target through idle look behaviors predicated on the absence of a look target. Given the example of SBLSkeleton
, which sets a runtime duration for its LookAtTarget
via runFor
, I expected that would help fix my issue, before investigating the source and seeing the method override. I had to resort to making a new version of LookAtTarget
that allowed timing out.
There are a handful of other stock behaviors provided by this mod that override timedOut
to return false, which effectively no-ops runFor
for them. A suggestion would be to introduce a couple of builder methods in ExtendedBehavior
to disable and enable timing out, changing a boolean field that handles calling super.timedOut
in ExtendedBehavior#timedOut
. You can then call the disable method in the constructors of these stock behaviors intended to not time out by default. This would allow devs such as myself to re-enable timing out after instantiating one of these stock behaviors.