Ultimate Car Mod

Ultimate Car Mod

14M Downloads

CraftTweaker Trades change on the villager cause crash

TqLxQuanZ opened this issue ยท 6 comments

commented

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

  1. Download Ultimate Car Mod as it has custom profession from it.
  2. Download CraftTweaker-forge-1.18.2-9.1.209.jar as well.
  3. Add the script for modifying the gas station attendant trade, any kind of works, the simplest one is just remove all trades from it.
  4. Launch the server and wait for it to load.
  5. 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

commented

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.

commented

No, sorry, only 1.19.2, 1.19.4 and 1.20.1 is in active development.

commented

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

commented

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.

commented

image
It might depend on the JDK, I have to test that.

commented

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