GregTechCEu / GregTech-Modern

GregTech CE Unofficial for modern versions
GNU Lesser General Public License v3.0
268 stars 162 forks source link

Built-in ore vein edits get overwritten immediately #1435

Closed Fuyukai closed 3 months ago

Fuyukai commented 3 months ago

Checked for existing issues

Tested latest version

GregTech CEu Version

1.3.0

Recipe Viewer Installed

EMI

Environment

SSP

Cross-Mod Interaction

No

Other Installed Mods

n/a

Expected Behavior

Removing veins should remove them.

Actual Behavior

Removed veins reappear.

Steps to Reproduce

1) GTCEuServerEvents.oreVeins(event => { event.removeAll(); }) 2) Notice tthat veins are very much not removed

Additional Information

Commit efa865297b4cf153dbe2213080defe163863aeb6 introduced ore vein synch packets, including a log-out handler that restores the default registries (presumably, to prevent cross-contamination from playing on servers).

For insane mojang reasons, when the integrated server starts up, it fires a logout event after loading all data. This is then fed to the client, which will immediately re-call GTOres.init() and overwrite any changes or removals to the built-in ore veins. Oops. This behaviour is more apparant when you do a /reload in game too.

I don't think this logout handler actually does anything because registries are always unconditionally overwritten by either data loading (for the integrated server) or by the ore vein synch packet (for clients connected to a multiplayer server), so the easiest solution is to just delete the logout event handler.