SihenZhang / CrockPot

Bring Crock Pot from Don't Starve to Minecraft.
MIT License
19 stars 7 forks source link

Skeleton horse trap event causes ConcurrentModificationException (1.15.2) #9

Closed naiski closed 3 years ago

naiski commented 3 years ago

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

SeraphJACK commented 3 years ago

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 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.

naiski commented 3 years ago

Thanks for the explanation!

3TUSK commented 3 years ago

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