Question ConcurrentModificationException on ChunkGenerator

civious

New member
Jan 11, 2024
3
0
1
Hey, I'm currently working on a world generator and today I randomly got this error generating a world :

This is the first time I've gotten it in over 300 generations with the same class, it happened completely randomly. In my opinion this seems to come from the (paper) spigot api.

I'm not sure if it comes from either PaperSpigot, Spigot or my version of PaperSpigot.
The version I'm currently using that received the error is is git-Paper-241 (MC: 1.20.2).
And since I can't reproduce it because it's totally random, I'm looking for help to solve this because I have no idea where it could come from.

This is my code, what I'm doing basically here is placing dripstones in my world, really simple code :

Java:
// Dripstone
if(rand < 0.015) {
int dripstoneSize = 2+random.nextInt(3);
for (int i = 0; i < dripstoneSize; i++) {
PointedDripstone dripstone = (PointedDripstone) Bukkit.createBlockData(Material.POINTED_DRIPSTONE);
dripstone.setVerticalDirection(BlockFace.DOWN);
PointedDripstone.Thickness thickness = null;
if(i == dripstoneSize - 1) thickness = PointedDripstone.Thickness.TIP;
if(i == dripstoneSize - 2) thickness = PointedDripstone.Thickness.FRUSTUM;
if(i == dripstoneSize - 3) thickness = PointedDripstone.Thickness.MIDDLE;
if(i == dripstoneSize - 4) thickness = PointedDripstone.Thickness.BASE;
dripstone.setThickness(thickness); # line 105 CaveDecoration.java
chunkData.setBlock(x,y-1-i,z, dripstone);
}
}

Thanks for your help.
 

Machine Maker

Paper Developer
Staff member
Dec 17, 2021
132
6
19
18
California
Yeah, looks like a legit bug to me. The map that is used to convert between API enums (like PointedDripstone$Thickness) and their nms counterparts was just a regular HashMap so it's conceivable that this could happen. I've opened a PR that should resolve it.
 
  • Like
Reactions: civious

civious

New member
Jan 11, 2024
3
0
1
Yeah, looks like a legit bug to me. The map that is used to convert between API enums (like PointedDripstone$Thickness) and their nms counterparts was just a regular HashMap so it's conceivable that this could happen. I've opened a PR that should resolve it.
Thanks! This is basically because Paper is doing the job async right ? So it's related to Paper and would not happen on Spigot ?
 

electronicboy

Administrator
Staff member
Dec 11, 2021
231
10
40
28
chunk generation is async in vanilla too, though spigot may have disable that?