Farsighted Mobs (Forge & NeoForge)

Farsighted Mobs (Forge & NeoForge)

5M Downloads

Crash `onLoadConfig`: `UnsupportedOperatationException`

C0D3-M4513R opened this issue ยท 2 comments

commented

Not me that found it, but a person on the Magma discord.

Issue ticket:

  • Full Magma version: Magma-1.18.2-40.2.1-7b451705-server
  • Java version: 17
  • A detailed description of your issue: server didnt start properly
  • Logs (server-instance/logs/latest.log) - https://mclo.gs/: crash report: https://mclo.gs/A5BSBhN | server log: https://mclo.gs/ATOONow
  • Debug (server-instance/logs/debug.log): https://mclo.gs/7NLEqoI
  • Mod list: https://mclo.gs/V2SQnde
  • Plugin list: none
  • Datapack list: DawnCraft - An Adventure RPG Modpack
  • local host or hosting service: hosting service pukawka.pl
  • Operating system: Linux
  • Start-up script/flags: none

My response:
Mod issue.
This line:

mobAttributeMap.put(attribute.getKey(), Collections.singletonList(attribute.getValue()));

Puts a list into com.sindarin.farsightedmobs.Config$Server.mobAttributeMap, that cannot be changed. (https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#singletonList-T-)
This line however is not correct:
mobAttributeMap.get(attribute.getKey()).add(attribute.getValue());

because it tries to change the list, that cannot be changed.

commented

Sorry for the late reply. I see the problem indeed; I naively assumed that Collections.singletonList would simply create a "normal" list containing the one element, but as you point out, it actually creates an immutable list. Since the mod currently only includes one attribute, this was not a problem. Seems like a simple enough fix, though.

commented

I did a binary patch for that someone, that reported this btw. The change was actually simple.

(and yes I am accustomed to editing jvm bytecode by now, because many projects for 1.12.2 simply don't compile anymore... Thanks gradle for being so stable)