Skip to content

Crash on startup with Create 6.0.9 + Ponder 1.0.81 — thread safety race condition in SpriteShifts static initializer #262

@strieken7

Description

@strieken7

Create Deco version: 2.1.3
Create version: 6.0.9
Ponder version: 1.0.81+mc1.21.1
NeoForge version: 21.1.227
Minecraft: 1.21.1

Crash: ArrayIndexOutOfBoundsException: Index 11 out of bounds for length 10
in StitchedSprite. → ArrayList.add()

Root cause: The vault() method in SpriteShifts.java calls CTSpriteShifter.getCT()
directly inside the class static initializer. This registers StitchedSprite instances
into Ponder's non-thread-safe ALL map during NeoForge's parallel ForkJoin mod loading,
causing a race condition with Create's own sprite initialization.

Fix: Change vault() to use the same pattern as make() — construct CTSpriteShiftEntry
manually and only call entry.set() inside an isClient() check, matching the existing
safe pattern already used elsewhere in the file.

vault() should become:
return Couple.createWithContext(medium -> {
ResourceLocation small = CreateDecoMod.id(prefixed + "_small");
ResourceLocation other = CreateDecoMod.id(medium ? prefixed + "_medium" : prefixed + "_large");
CTSpriteShiftEntry entry = new CTSpriteShiftEntry(AllCTTypes.RECTANGLE);
if (CatnipServices.PLATFORM.getEnv().isClient())
entry.set(small, other);
return entry;
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions