SmartBrainLib (Forge/Fabric/Quilt)

SmartBrainLib (Forge/Fabric/Quilt)

24M Downloads

NullPointerException when setting predicate "alertAlliesWhen " on true with the "TargetOrRetaliate " behaviour

Goldocelot opened this issue ยท 1 comments

commented

Hello,

When trying to make a mob acting as a pack i got an issue with the TargetOrRetaliate behaviour causing a NullPointerException when using alertAlliesWhen set on always true.

Here is the crash report.

crash-2023-07-16_01.55.32-server.txt

And here is how i use it in my entity:

image

commented

If someone else have the issue for now, you can fix it by either

  • override the allyPredicate inside the behaviour.
  • override the isAlliedTo methode inside your entity class and just add a not null check before calling super#isAlliedTo.

I choose to fix it the second way, here is the code:

@Override
public boolean isAlliedTo(Entity pEntity) { 
    return pEntity!=null && super.isAlliedTo(pEntity); 
}