You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently had an issue where stopping a goal of an entity, cause a stack trace in the console (and then the entity vanished).
The goal specifically was the FollowParentGoal.
The error states that this.parent is null.
After doing some digging I came to the realization that the PaperVanillaGoal had wrapped the goal itself, and not the (NMS)WrappedGoal.
Issue here is WrappedGoal#stop stops the goal from running and also stops the goal itself.
But Paper isn't returning the WrappedGoal therefor the WrappedGoal still thinks its running.
As seen here (in PaperMobGoals):
Inside FollowParentGoal:
Inside WrappedGoal:
(This is what we're missing access to)
When Minecraft attempts to tick the goal, it first checks if it's running.
Since the WrappedGoal isn't stopped properly, it'll continue thinking its running, and therefor error.
Suggested Change:
(In PaperMobGoals return the WrappedGoal instead of the goal itself directly)
[12:49:13 ERROR]: Entity threw exception at world:-763.4517434552514,67.0,57948.012728867085
java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.Entity.blockPosition()" because "entity" is null
at net.minecraft.world.entity.ai.navigation.GroundPathNavigation.createPath(GroundPathNavigation.java:85) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.entity.ai.navigation.PathNavigation.moveTo(PathNavigation.java:228) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.entity.ai.goal.FollowParentGoal.tick(FollowParentGoal.java:80) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.entity.ai.goal.WrappedGoal.tick(WrappedGoal.java:63) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.entity.ai.goal.GoalSelector.tickRunningGoals(GoalSelector.java:128) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.entity.ai.goal.GoalSelector.tick(GoalSelector.java:119) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.entity.Mob.serverAiStep(Mob.java:874) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.entity.LivingEntity.aiStep(LivingEntity.java:3396) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.entity.Mob.aiStep(Mob.java:616) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.entity.AgeableMob.aiStep(AgeableMob.java:148) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.entity.animal.Animal.aiStep(Animal.java:65) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.entity.LivingEntity.tick(LivingEntity.java:3148) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.entity.Mob.tick(Mob.java:398) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.server.level.ServerLevel.tickNonPassenger(ServerLevel.java:1269) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.level.Level.guardEntityTick(Level.java:1499) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.server.level.ServerLevel.lambda$tick$4(ServerLevel.java:817) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.world.level.entity.EntityTickList.forEach(EntityTickList.java:39) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:799) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1724) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1529) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1251) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:310) ~[paper-1.21.4.jar:1.21.4-100-86c6308]
at java.base/java.lang.Thread.run(Thread.java:1570) ~[?:?]
Steps/models to reproduce
Just a little something:
privatevoidstopPigFollowingParent(Mobmob) {
if (mobinstanceofAnimalsanimal && !animal.isAdult()) {
Goal<Animals> goal = Bukkit.getMobGoals().getGoal(animal, VanillaGoal.FOLLOW_PARENT);
if (goal != null)
goal.stop();
}
}
Stop the goal of a baby pig following an adult pig.
You should see an error in the console and the pig will most likely vanish.
> datapack list
[13:00:11 INFO]: There are 3 data pack(s) enabled: [vanilla (built-in)], [file/bukkit (world)], [paper (built-in)]
[13:00:11 INFO]: There are no more data packs available
Paper version
running Paper version 1.21.4-100-main@86c6308 (2025-01-12T17:10:40Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
Other
No response
The text was updated successfully, but these errors were encountered:
Expected behavior
No errors and no vanishing piggy would be nice 😊
Observed/Actual behavior
I recently had an issue where stopping a goal of an entity, cause a stack trace in the console (and then the entity vanished).
The goal specifically was the FollowParentGoal.
The error states that
this.parent
is null.After doing some digging I came to the realization that the PaperVanillaGoal had wrapped the goal itself, and not the (NMS)WrappedGoal.
Issue here is
WrappedGoal#stop
stops the goal from running and also stops the goal itself.But Paper isn't returning the WrappedGoal therefor the WrappedGoal still thinks its running.
As seen here (in PaperMobGoals):
Inside FollowParentGoal:
Inside WrappedGoal:
(This is what we're missing access to)
When Minecraft attempts to tick the goal, it first checks if it's running.
Since the WrappedGoal isn't stopped properly, it'll continue thinking its running, and therefor error.
Suggested Change:
(In PaperMobGoals return the WrappedGoal instead of the goal itself directly)
The error in question:
Steps/models to reproduce
Just a little something:
Stop the goal of a baby pig following an adult pig.
You should see an error in the console and the pig will most likely vanish.
Plugin and Datapack List
Paper version
Other
No response
The text was updated successfully, but these errors were encountered: