Skip to content

cape_changed packet handling causes NPE in CapeRegistry.giveRawCape (cape == null) #4405

@zerodegress

Description

@zerodegress

Checked for existing issues

  • I have checked for existing issues, and have found none.

Tested latest version

  • I have checked that this occurs on the latest version.

GregTech CEu Version

7.4.1-SNAPSHOT+e7c1073

Minecraft Version

1.21.1 NeoForge

Recipe Viewer Installed

EMI

Environment

Singleplayer

Cross-Mod Interaction

Unsure

Other Installed Mods

[✔] CodeChickenLib-1.21.1-4.6.1.526
[✔] EnderStorage-1.21.1-2.13.0.191
[✔] ExtendedAE-1.21-2.2.27-neoforge
[✔] Glodium-1.21-2.2-neoforge
[✔] Jade-1.21.1-NeoForge-15.10.3
[✔] XaerosWorldMap_1.39.12_NeoForge_1.21
[✔] Xaeros_Minimap_25.2.10_NeoForge_1.21
[✔] ae2wtlib-19.3.0
[✔] appleskin-neoforge-mc1.21-3.0.7
[✔] appliedenergistics2-19.2.17
[✔] baguettelib-1.21.1-NeoForge-1.1.5
[✔] clientsort-neoforge-2.1.5+1.21.1
[✔] cloth-config-15.0.140-neoforge
[✔] corpse-neoforge-1.21.1-1.1.13
[✔] corpsecurioscompat-1.21.1-NeoForge-3.1.3
[✔] curios-neoforge-9.5.1+1.21.1
[✔] emi-1.1.22+1.21.1+neoforge
[✔] emi_loot-0.7.8+1.21+neoforge
[✔] emiffect-neoforge-2.1.6+mc1.21.1
[✔] emixx-neoforge-1.2.3
[✔] ferritecore-7.0.2-neoforge
[✔] fzzy_config-0.7.4+1.21+neoforge
[✔] guideme-21.1.15
[✔] iris-neoforge-1.8.12+mc1.21.1
[✔] jei-1.21.1-neoforge-19.27.0.336
[✔] kotlinforforge-5.10.0-all
[✔] kubejs-neoforge-2101.7.2-build.348
[✔] modernfix-neoforge-5.25.1+mc1.21.1
[✔] polymorph-neoforge-1.1.0+1.21.1
[✔] rhino-2101.2.7-build.81
[✔] sodium-neoforge-0.6.13+mc1.21.1
[✔] sophisticatedbackpacks-1.21.1-3.25.21.1475
[✔] sophisticatedcore-1.21.1-1.3.99.1340
[✔] sophisticatedstorage-1.21.1-1.5.18.1405

Expected Behavior

If the packet contains a null/invalid cape reference, gtceu should handle it gracefully (skip, log a warning, or treat as "no cape") rather than dereferencing a null ResourceLocation and crashing the client.

Actual Behavior

NPE thrown at CapeRegistry.giveRawCape when cape == null. The NPE triggers subsequent errors (render thread concurrent modification) and a full client crash.

Steps to Reproduce

  1. Launch NeoForge client with gtceu installed.
  2. Load/enter world (integrated singleplayer server in my test).
  3. When a cape change is synchronized (payload gtceu:cape_changed), the client throws an NPE and shortly after the render thread hits a ConcurrentModificationException and the game crashes.

Additional Information

AI analysis results, with original logs attached as follows:

test_crash.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions