Miniature nether portal gregtech not working

Oh sure, I’m not versed in the codebase so I’m sure I’m missing a lot here :sweat:
But I did have the same bug with portals refusing to connect on bukkit, while just using the pure forge.jar as a server made the portals work.
Debugging led me down this path.

in the event of “exit to main menu, then load a different save file”

checkSaveLocation() gets called all the time in onWorldTick()

https://github.com/GregTech6/gregtech6/blob/master/src/main/java/gregapi/GT_API_Proxy.java#L651
On vanilla/forge that call in onWorldTick passes in ./world-name no matter the dimension, so there’s no problem. But on bukkit where the getSaveHandler().getWorldDirectory gets you ./world-name for dim0 and ./world-name/DIM1 for The End, and so on, there’s a problem.

mSaveLocation might have stored ./world-name/DIM-1 (the nether) from the previous call, and now the event is from say ./world-name/DIM-42 (the outer lands).
We now have a mismatch in checkSaveFile, mSaveLocation and aSaveLocation don’t match.
https://github.com/GregTech6/gregtech6/blob/master/src/main/java/gregapi/GT_API_Proxy.java#L193

MultiTileEntityRegistry.onServerSave(mSaveLocation) gets called (every second), and ultimately (I don’t know the whole callstack) MultiTileEntityMiniportal#onServerSave() gets called which clears both portal lists.

Please correct me where I’m wrong.

1 Like