Crash when rendering large WanderWand selection (ConcurrentModificationException in WanderWandClusterRenderer)
Description:
While using the WanderWand to designate a large area, the game crashed with a ConcurrentModificationException in the renderDesignator method. The crash appears to occur when the selected area is large enough that rendering takes longer, increasing the chance of concurrent updates.
My guess is that the mod is accessing a shared data structure (likely a HashMap or similar) during rendering while it is being modified on another thread — for example, while extending or editing the selection.
Reproduction steps:
Use the WanderWand to select a large area (many chunks wide). While the area is being designated, continue modifying or extending it. The game will eventually crash during rendering with a ConcurrentModificationException.
Crash Report:
Attached.
Environment:
Minecraft: 1.20.1 (Fabric)
fabric-api-0.92.5+1.20.1
clockwork-1.20.1-0.1.16-fabric-b3b22e39fe
valkyrienskies-120-2.3.0-beta.5
(Full mod list attached.)
Suggested fix:
I’m no expert, but, fwiw, my guess would be to wrap the relevant collection access in renderDesignator with a defensive copy (e.g., new HashMap<>(…)) or use a thread-safe structure like ConcurrentHashMap to prevent concurrent modification. Synchronization may also help if appropriate.
Additional context:
This crash appears to be more likely with large selections, due to longer render iterations increasing the chance of update overlap. However, the issue may still occur in smaller selections under the right timing conditions.