Unsupported Operation in Forge 1.20.1
lcy0x1 opened this issue ยท 0 comments
Relevant Code:
In the following lines, CuriosEventHandler::tick
retrieves the prevStack attribute multimap, and then modify it.
In the following lines, we can see that the multimap is from
CurioAttributeModifierEvent::getModifiers
. Note that it's named as unmodifiable.Curios/src/main/java/top/theillusivec4/curios/mixin/CuriosImplMixinHooks.java
Lines 183 to 186 in b1d187d
However, it's actually modifiable at the beginning
Then it becomes unmodifiable when someone attempts to modify through the event.
Here map
is assigned with a modifiable multimap when nobody attempts to modify the map through event. However, if someone attempts to modify it, then the map
will get an unmodifiable multimap. And thus, if the map contains slot modifiers, it will crash.
Steps to reproduce the event:
- Have a curios item that adds slot and one that doesn't
- Write an event that modifies that map
- Put the slot-adder in, and then use the non-adder to replace the item
- Crash