Skip to content

ConcurrentModificationException in Entity.move caused by Create contraption interaction mixin #254

@reasure3

Description

@reasure3

Describe the bug
A ConcurrentModificationException occurs when an entity moves near Create contraptions.
The crash happens inside Create’s EntityContraptionInteractionMixin (create$onMove), during iteration over ContraptionHandler.loadedContraptions.

The exception originates from a synthetic injected mixin method:
Entity.handler$dcc000$create$onMove(Entity.java:7855)

This suggests that the HashMap that stores loaded contraptions is being modified while a stream is iterating over it.

This crash happens even when no Mobile Packages robots are placed in the world.


To Reproduce
Steps (not deterministic, but consistently reproducible over time):

  1. Load into a world with Create contraptions nearby.
  2. Walk around or allow entities to move in that area.
  3. After some movement, the game/server crashes with a ConcurrentModificationException.

So far, it always occurs during normal entity movement.


Expected behavior

  • Entity movement should not cause a CME.
  • Iterating over ContraptionHandler.loadedContraptions should be safe even if modifications occur during the same tick.
  • A snapshot copy or concurrent structure may be required.

Screenshots
N/A


Desktop (please complete the following information):

  • OS: Windows 10
  • Forge/NeoForge version: NeoForge 21.1.213
  • Minecraft version: 1.21.1
  • Create version: 6.0.6
  • Create: Mobile Packages version: 0.5.5 (MC 1.21.1)

Crash log

crash-2025-11-23_22.18.33-server.txt

latest.log

Key excerpt:

java.util.ConcurrentModificationException
at java.base/java.util.HashMap$ValueSpliterator.tryAdvance(HashMap.java:1663)
at java.base/java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:529)
at net.minecraft.world.entity.Entity.handler$dcc000$create$onMove(Entity.java:7855)
at net.minecraft.world.entity.Entity.move(Entity.java:567)

Additional context

  • No Mobile Packages robots exist in the world.
  • Crash still occurs, so this is likely not caused by Mobile Packages directly.
  • The crash aligns exactly with Create’s EntityContraptionInteractionMixin#create$onMove, especially where the mod checks contraption intersections using:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions