TeamPneumatic / pnc-repressurized

A port of PneumaticCraft to MC1.12+
Other
122 stars 49 forks source link

Crash while importing code from pastebing #1338

Closed MuteTiefling closed 1 week ago

MuteTiefling commented 2 weeks ago

Describe the bug

Attempting to import this: https://pastebin.com/3g6dBxui

How to reproduce the bug

  1. Open Programmer
  2. Copy JSON code from https://pastebin.com/3g6dBxui
  3. Go to Import
  4. Import from Clipboard
  5. Crash

Expected behavior

No crash :D

Additional details

No response

Which Minecraft version are you using?

1.21

Which version of PneumaticCraft: Repressurized are you using?

pneumaticcraft-repressurized-8.0.2+mc1.21

Crash log

https://gist.github.com/MuteTiefling/1020165101a78270c34bf7416c0fc9e6

MuteTiefling commented 2 weeks ago

Also crashes when importing from the link directly. Not surprising as it appears to have some issue with a widget specifically.

desht commented 2 weeks ago

java.lang.NoSuchMethodError: 'boolean com.google.gson.JsonObject.isEmpty()'

That is one of those impossible situations, because that method is definitely a Real Thing (tm): https://www.javadoc.io/doc/com.google.code.gson/gson/latest/com.google.gson/com/google/gson/JsonObject.html#isEmpty()

So why your instance isn't finding it is a bit of a puzzle...

desht commented 2 weeks ago

For testing purposes, I loaded that URL in my dev server and it went fine. So something in your instance is definitely messing up your GSON library. I noticed that isEmpty is only added in GSON 2.10.1, which is present in my dev instance (as part of NeoForge). So something in your instance is probably loading an older version which is getting picked up by PNC here.

As a workaround, I could change the .isEmpty() calls to .size() == 0, but I would strongly recommend trying to track down why you've apparently got a old version of GSON in there, since it's likely to cause other problems down the line...

desht commented 2 weeks ago

Also, I thought I recognised that program :stuck_out_tongue:

Here's a version converted to V3 progwidget json: https://pastebin.com/zQm5DKSi

MuteTiefling commented 2 weeks ago

Hrm alright. I guess I'll see if that persists after we get everything updated to 1.21.1 first. Thanks for looking into it, I appreciate the insight.

Kanzaji commented 2 weeks ago

So, I've gone digging a bit myself, because PNC isn't the only one affected by this issue, and Long Story Short - It's the vanilla Launcher Issue.

NeoForge does indeed ship with GSON 2.10.1, and launchers like MultiMC correctly include 2.10.1 in the classpath - everything works just fine on there. However Vanilla Launcher (which CF uses), includes 2.10 GSON in the classpath, causing the entire issue...

Update: The cause of Vanilla launcher including old version of the GSON library is Neo, the installer has old version specified in the version.json file >.>

MuteTiefling commented 1 week ago

Seems they have an issue opened for it too: https://github.com/neoforged/NeoForge/issues/1380

desht commented 1 week ago

Yeah, that would explain it. In the short term, I'll use that workaround I mentioned above (.size() is definitely in 2.10).

desht commented 1 week ago

Worked around in 8.1.1