CraftTweaker Trades change on the villager cause crash
TqLxQuanZ opened this issue ยท 6 comments
Bug description
After the script changes or editing the trades for gas station attendants, it should not crash on startup. Interestingly, if the script is removed at first and start up the server then reload the script afterward, it won't crash.
Steps to reproduce the issue
- Download Ultimate Car Mod as it has custom profession from it.
- Download CraftTweaker-forge-1.18.2-9.1.209.jar as well.
- Add the script for modifying the gas station attendant trade, any kind of works, the simplest one is just remove all trades from it.
- Launch the server and wait for it to load.
- Game crashes.
Expected behavior
It should startup the server normally without any crash.
Log files
https://gist.github.com/TqLxQuanZ/2f7f7cced03c5e66bfb40934dd0eb0d8
Versions
- Minecraft version - 1.18.2
- Forge version - 40.2.4
- Mod version - 1.18 - 1.0.1
Other mods
CraftTweaker-forge-1.18.2-9.1.209.jar
Screenshots (Optional)
Screenshots of the issue.
Linking to the other ticket:
CraftTweaker/CraftTweaker#1678
Thanks for reaching out here Jared.
@henkelmax is it possible that the fix will push toward 1.18.2 as well? Since the modpack I am working on is at that version.
This issue stems from your use of ImmutableList
when adding the trades to the event, stopping other mods (like CraftTweaker or UCM addons) from adding trades to your professions
I haven't tested the fix yet, but I was under the impression that Arrays.asList
returns a mostly immutable list (despite what the javadocs say), both:
Arrays.asList("Foo", "Bar").add("Baz");
Arrays.asList("Foo", "Bar").remove("Foo");
throw an UnsupportedOperationException
when running them.
So I suspect that this will still have the same issue.
It might depend on the JDK, I have to test that.
That isn't the ArrayList
class that you normally use, for me using temurin-17
, that is actually the java.util.Arrays.ArrayList
class, not java.util.ArrayList
.
New commit is what I would have done to fix it though, so it should be good now