Skeleton horse trap event causes ConcurrentModificationException (1.15.2)
naiski opened this issue ยท 3 comments
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:
- Enter creative mode.
- 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:
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 addTriggerSkeletonTrapGoal
to theGoalSelector
- The
GoalSelector
traverses its goals and call thetick
method - The
TriggerSkeletonTrapGoal
is being ticked and callssetTrap(false)
, which will remove itself from theGoalSelector
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.
Follow up, turns out this is a vanilla bug. See MinecraftForge/MinecraftForge#7509 for more info.