Roots

Roots

24M Downloads

[FORWARDED] Roots Non-Detection Effect Causes Crash

ByThePowerOfScience opened this issue ยท 4 comments

commented

I'm assuming that, within Vanilla contexts, this piece of code would never fire is getRevengeTarget is null.

Likewise, though getRevengeTarget does change to returning null after a few seconds, so it's really just luck that they never encountered this NPE.

commented

I'm assuming that, within Vanilla contexts, this piece of code would never fire is getRevengeTarget is null.

commented

Issue is caused by this line:

if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null
                && (
                        !(this.taskOwner instanceof EntityTameable)
                        || ((EntityTameable)this.taskOwner).getOwner() == ((EntityTameable)entitycreature).getOwner())
                && !entitycreature.isOnSameTeam(this.taskOwner.getRevengeTarget()))

where this.taskOwner.getRevengeTarget() is null. The method is marked as nullable, but the isOnSameTeam method doesn't account for that.
I can't see a way to resolve this short of patching the isOnSameTeam method via ASM.

commented

I tried doing an ASM-only implementation, but I forgot how much I hate coremods in 1.12. I'm adding Mixin as an optional dependency to patch this bug specifically.