Crock Pot

Crock Pot

328k Downloads

Skeleton horse trap event causes ConcurrentModificationException (1.15.2)

naiski opened this issue ยท 3 comments

commented

Summary:

When a skeleton horse trap event triggers the game crashes with a ConcurrentModificationException after adding a new TemptGoal to the SkeletonHorseEntity inside CrockPot.java:onAnimalAppear.

Steps to reproduce:

  1. Enter creative mode.
  2. Execute the command /summon skeleton_horse ~ ~ ~ {SkeletonTrap:1}.

Potential fix:

I was able to avoid this crash by modifying the logic at CrockPot.java:102 and adding an extra check to ensure that the entity is not a skeleton horse:

if (((animalEntity.getNavigator() instanceof GroundPathNavigator) || (animalEntity.getNavigator() instanceof FlyingPathNavigator)) && !(animalEntity instanceof SkeletonHorseEntity))

I'm not sure if this will cover all possible issues that might arise here but it seems to at least handle this particular problem with skeleton horse traps. Hopefully you can figure out a more robust fix.

Crash report:

crash-2020-09-28_02.14.52-server.txt

commented

Sorry for the late reply.

After investigating (thanks to @ustc-zzzz ), we find out that it's probably a vanilla bug, and here are the details about it:

  • The skeleton horse trap deserializes and calls setTrap(true) which will add TriggerSkeletonTrapGoal to the GoalSelector
  • The GoalSelector traverses its goals and call the tick method
  • The TriggerSkeletonTrapGoal is being ticked and calls setTrap(false), which will remove itself from the GoalSelector
  • ConcurrentModificationException

The vanilla game doesn't run into this issue, probably because the TriggerSkeletonTrapGoal is the last goal, so it doesn't matter. But here we added another, and the issue appears.

After all these investigations, I think your dirty fix is "robust" enough for this issue.

commented

Thanks for the explanation!

commented

Follow up, turns out this is a vanilla bug. See MinecraftForge/MinecraftForge#7509 for more info.