Merge 1.19.2 into 1.19.4

This commit is contained in:
embeddedt 2023-06-26 12:59:34 -04:00
commit c23a4be440
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
3 changed files with 6 additions and 4 deletions

View File

@ -10,6 +10,7 @@ is directly derived from Sodium and used under the terms of the LGPL-3.0 license
- 1.18.2, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/1.18/Package.zip
- 1.19.2, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/1.19.2/Package.zip
- 1.19.4, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/1.19.4/Package.zip
- 1.20.1, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/1.20/Package.zip
------------

View File

@ -4,22 +4,23 @@ import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.minecraft.server.MinecraftServer;
import java.lang.ref.WeakReference;
public class ModernFixFabric implements ModInitializer {
private ModernFix commonMod;
public static MinecraftServer theServer;
public static WeakReference<MinecraftServer> theServer = new WeakReference<>(null);
@Override
public void onInitialize() {
commonMod = new ModernFix();
ServerLifecycleEvents.SERVER_STARTING.register(server -> {
theServer = server;
theServer = new WeakReference<>(server);
});
ServerLifecycleEvents.SERVER_STARTED.register(server -> {
commonMod.onServerStarted();
});
ServerLifecycleEvents.SERVER_STOPPED.register(server -> {
commonMod.onServerDead(server);
theServer = null;
});
// TODO: implement entity ID desync

View File

@ -53,7 +53,7 @@ public class ModernFixPlatformHooksImpl {
}
public static MinecraftServer getCurrentServer() {
return ModernFixFabric.theServer;
return ModernFixFabric.theServer.get();
}
public static boolean isLoadingNormally() {