LacerationEffect causes crash when applied via code due to unregistered MobEffect istance
Elaski6573 opened this issue · 1 comments
Steps to Reproduce
Attack any Entity with Flame-Bladed sword
Expected Behavior
Flame-Bladed sword should apply the Laceration effect normally without crashing the game
Actual Behavior
The game crashes with an java.lang.IllegalStateException when trying to apply the Laceration effect.
Your Minecraft version
Minecraft 1.21.1 NeoForge-21.1.174
Your error log
https://gist.github.com/Elaski6573/72831b9cfb94ca486637043f3988048b
Additional Comments
The error message Unregistered holder in ResourceKey[minecraft:mob_effect]:minecraft:mob_effect@magistuarmory:laceration occurs because an unregistered MobEffect is being referenced in code:
LacerationEffect.java (lines 60–77).
The INSTANCE object is directly constructed using new LacerationEffect() and is not the same instance registered in the Registry. Therefore, it is treated as a different, unregistered object.
The effect itself is properly registered through ModEffects.java, so commands like the following work as expected:
/effect give @s magistuarmory:laceration
However, the Flame-Bladed Sword applies the Laceration effect using the instance reference from LacerationEffect.java, instead of the registered effect. You can find this usage in MedievalWeaponItem.java.
This issue appears to be the same as #49 and #56.
It is likely solvable by replacing LacerationEffect.INSTANCE with ModEffects.LACERATION.get()
Conclusion
- I agree that I am inattentively reading the description, just filling out everything