GTNewHorizons / lwjgl3ify

A mod to run Minecraft 1.7.10 using LWJGL3 and Java 17+
GNU Lesser General Public License v3.0
171 stars 37 forks source link

Lwgl3ify breaks journeymap webmap #29

Closed mist475 closed 5 months ago

mist475 commented 1 year ago

Journeymap got a new hotfix yesterday to fix the broken webmap. Unfortunately it looks like lwg3ify somehow breaks gson calls due to some reflection schenaningans. Tested on java 8 & 11 with UniMixins, Gtnhlib, lwgl3ify (all latest) and journeymap 5.1.4p3. Usually the default journeymap web map default screen ('no world opened') does show but it doesn't get further than that.

In java 11 the following is logged:

[11:19:33] [Server thread/INFO]: Mist475 joined the game
[11:19:33] [Client thread/INFO] [FML]: [Client thread] Client side modded connection established
[11:19:33] [Server thread/INFO] [lwjgl3ify]: Dynamicized enum ahn=net.minecraft.world.EnumSkyBlock
[11:19:34] [Client thread/INFO] [lwjgl3ify]: Dynamicized enum azv=net.minecraft.util.MovingObjectPosition$MovingObjectType
[11:19:35] [Client thread/INFO] [journeymap]: Loaded 0 waypoints from C:\Users\myName\Multimc\MultiMC\instances\Journeymap test\.minecraft\journeymap\data\sp\test\waypoints
[11:19:35] [Client thread/INFO] [journeymap]: Blocks and textures are current
[11:19:35] [Client thread/INFO] [journeymap]: Mapping started in C:\Users\myName\Multimc\MultiMC\instances\Journeymap test\.minecraft\journeymap\data\sp\test\DIM0. Memory: 512MB total, 285MB free 
[11:19:35] [Client thread/INFO]: [CHAT] §eJourneyMap:§f Press [§bJ§f] or open browser to§b§n http://localhost:8080 §f
[11:19:35] [Client thread/INFO] [journeymap]: JourneyMap: Press [J] or open browser to http://localhost:8080 
WARNING: Illegal reflective access by com.google.gson.internal.bind.ReflectiveTypeAdapterFactory (jar:file:/C:/Users/myName/Multimc/MultiMC/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar!/com/google/gson/internal/bind/ReflectiveTypeAdapterFactory.class) to field java.util.concurrent.atomic.AtomicBoolean.value

In j8 nothing is logged but in both cases the browser gives the same errors/warnings:

localhost/:1 

       Tracking Prevention blocked access to storage for http://maps.google.com/maps/api/js?key=AIzaSyDeq8K0022T9N1y-7Q7GBYhwoDS2hruB3c&libraries=geometry&sensor=false.
mapapi:240 

       Google Maps JavaScript API has been loaded directly without a callback. This is not supported and can lead to race conditions and suboptimal performance. For supported loading patterns please see https://goo.gle/js-api-loading
qea @ mapapi:240
jquery-1.9.1.js:8526        

       Failed to load resource: net::ERR_EMPTY_RESPONSE
send @ jquery-1.9.1.js:8526
journeymap.js?v=@JMVERSION@:894 Server returned error: {"readyState":0,"status":0,"statusText":"NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://localhost:8080/data/world?callback=jQuery191010223145090131336_1678098069762&_=1678098069765'."}
journeymap.js?v=@JMVERSION@:925 >>> Will re-check game state in 5 seconds.
maps.googleapis.com/maps/api/mapsjs/gen_204?csp_test=true:1 

       Failed to load resource: the server responded with a status of 403 (Forbidden)
localhost/:1 

       Tracking Prevention blocked access to storage for http://maps.google.com/maps-api-v3/api/js/52/3a/intl/en_gb/common.js.
localhost/:1 

       Tracking Prevention blocked access to storage for http://maps.google.com/maps-api-v3/api/js/52/3a/intl/en_gb/util.js.

After hanging for a while the following errors are also thrown in the browser (tested with edge and chrome):

localhost/:84 

       GET http://localhost:8080/mapapi net::ERR_EMPTY_RESPONSE
richmarker-compiled.js?v=@JMVERSION@:1 

       Uncaught ReferenceError: google is not defined
    at richmarker-compiled.js?v=@JMVERSION@:1:251
    at richmarker-compiled.js?v=@JMVERSION@:20:3
(anonymous) @ richmarker-compiled.js?v=@JMVERSION@:1
(anonymous) @ richmarker-compiled.js?v=@JMVERSION@:20
VM108:1 

       Uncaught ReferenceError: google is not defined
    at eval (eval at <anonymous> (markerwithlabel_packed.js?v=@JMVERSION@:1:1), <anonymous>:1:641)
    at markerwithlabel_packed.js?v=@JMVERSION@:1:1
eval @ VM108:1
(anonymous) @ markerwithlabel_packed.js?v=@JMVERSION@:1
journeymap.js?v=@JMVERSION@:1422 

       Uncaught ReferenceError: google is not defined
    at journeymap.js?v=@JMVERSION@:1422:2
    at journeymap.js?v=@JMVERSION@:1612:3
(anonymous) @ journeymap.js?v=@JMVERSION@:1422
(anonymous) @ journeymap.js?v=@JMVERSION@:1612
localhost/:44 

       GET http://localhost:8080/theme/icon/day.png net::ERR_EMPTY_RESPONSE
localhost/:45 

       GET http://localhost:8080/theme/icon/follow.png net::ERR_EMPTY_RESPONSE
localhost/:47 

       GET http://localhost:8080/theme/icon/alert.png net::ERR_EMPTY_RESPONSE
localhost/:49 

       GET http://localhost:8080/theme/icon/options.png net::ERR_EMPTY_RESPONSE
localhost/:51 

       GET http://localhost:8080/theme/icon/actions.png net::ERR_EMPTY_RESPONSE
localhost/:65 

       GET http://localhost:8080/theme/icon/automap.png net::ERR_EMPTY_RESPONSE
localhost/:66 

       GET http://localhost:8080/theme/icon/savemap.png net::ERR_EMPTY_RESPONSE
localhost/:1 

       Unchecked runtime.lastError: The message port closed before a response was received.
eigenraven commented 1 year ago

Looks like gson is trying to serialize atomics by reflecting into their private internals, I'll see if I can just update gson or alternatively the workaround for now would be to add --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED to the jvm flags

mist475 commented 1 year ago

that fixes the logged error in the game logs but not the web map itself unfortunately

mist475 commented 1 year ago

I should note that fixing issues like this will become a lot easier soon. I was just told that journeymap 1.7 is getting relicensed to lgpl with the source code becoming available soon

mysticdrew commented 1 year ago

Journeymap dev here. Once we get 1.7.10 in a buildable state, this code has not been touched or looked at in years. I will open up the repo to the public. The hotfix yesterday was just a swap of files in the jar.

Only the 1.7.10 codebase will be open sourced for now.

AnAwesomGuy commented 7 months ago

gson breaks not only journeymap with lwjgl3ify. trying to use fromJson on pretty much any class will cause this error, as gson goes through the nested fields all the way down to the bottom, so it says random java classes cant be accessed. maybe lwjgl3ify could find a way to export/open all the java packages to gson? (is this even possible)

eigenraven commented 5 months ago

This is no longer an issue on the latest journeymap versions.