Make mixin info clearing work on Fabric
This commit is contained in:
parent
e3944d7879
commit
58eaf44d89
|
|
@ -76,10 +76,6 @@ public class ModernFix {
|
||||||
ClassInfoManager.clear();
|
ClassInfoManager.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLoadComplete() {
|
|
||||||
ClassInfoManager.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onServerDead(MinecraftServer server) {
|
public void onServerDead(MinecraftServer server) {
|
||||||
/* Clear as much data from the integrated server as possible, in case a mod holds on to it */
|
/* Clear as much data from the integrated server as possible, in case a mod holds on to it */
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import org.embeddedt.modernfix.api.entrypoint.ModernFixClientIntegration;
|
||||||
import org.embeddedt.modernfix.core.ModernFixMixinPlugin;
|
import org.embeddedt.modernfix.core.ModernFixMixinPlugin;
|
||||||
import org.embeddedt.modernfix.packet.EntityIDSyncPacket;
|
import org.embeddedt.modernfix.packet.EntityIDSyncPacket;
|
||||||
import org.embeddedt.modernfix.platform.ModernFixPlatformHooks;
|
import org.embeddedt.modernfix.platform.ModernFixPlatformHooks;
|
||||||
|
import org.embeddedt.modernfix.util.ClassInfoManager;
|
||||||
import org.embeddedt.modernfix.world.IntegratedWatchdog;
|
import org.embeddedt.modernfix.world.IntegratedWatchdog;
|
||||||
|
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
|
|
@ -66,6 +67,7 @@ public class ModernFixClient {
|
||||||
gameStartTimeSeconds = ManagementFactory.getRuntimeMXBean().getUptime() / 1000f;
|
gameStartTimeSeconds = ManagementFactory.getRuntimeMXBean().getUptime() / 1000f;
|
||||||
ModernFix.LOGGER.warn("Game took " + gameStartTimeSeconds + " seconds to start");
|
ModernFix.LOGGER.warn("Game took " + gameStartTimeSeconds + " seconds to start");
|
||||||
ModernFixPlatformHooks.onLaunchComplete();
|
ModernFixPlatformHooks.onLaunchComplete();
|
||||||
|
ClassInfoManager.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import net.minecraft.server.MinecraftServer;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
public class ModernFixFabric implements ModInitializer {
|
public class ModernFixFabric implements ModInitializer {
|
||||||
private ModernFix commonMod;
|
public static ModernFix commonMod;
|
||||||
public static WeakReference<MinecraftServer> theServer = new WeakReference<>(null);
|
public static WeakReference<MinecraftServer> theServer = new WeakReference<>(null);
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import net.minecraftforge.fml.*;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.config.ModConfig;
|
import net.minecraftforge.fml.config.ModConfig;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
|
|
||||||
import net.minecraftforge.fml.event.server.FMLServerStartedEvent;
|
import net.minecraftforge.fml.event.server.FMLServerStartedEvent;
|
||||||
import net.minecraftforge.fml.event.server.FMLServerStoppedEvent;
|
import net.minecraftforge.fml.event.server.FMLServerStoppedEvent;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
|
|
@ -39,7 +38,6 @@ public class ModernFixForge {
|
||||||
// Register ourselves for server and other game events we are interested in
|
// Register ourselves for server and other game events we are interested in
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup);
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup);
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onLoadComplete);
|
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Item.class, this::registerItems);
|
FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Item.class, this::registerItems);
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> MinecraftForge.EVENT_BUS.register(new ModernFixClientForge()));
|
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> MinecraftForge.EVENT_BUS.register(new ModernFixClientForge()));
|
||||||
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.DISPLAYTEST, () -> Pair.of(() -> FMLNetworkConstants.IGNORESERVERONLY, (a, b) -> true));
|
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.DISPLAYTEST, () -> Pair.of(() -> FMLNetworkConstants.IGNORESERVERONLY, (a, b) -> true));
|
||||||
|
|
@ -92,10 +90,6 @@ public class ModernFixForge {
|
||||||
commonMod.onServerDead(event.getServer());
|
commonMod.onServerDead(event.getServer());
|
||||||
}
|
}
|
||||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||||
public void onLoadComplete(FMLLoadCompleteEvent event) {
|
|
||||||
commonMod.onLoadComplete();
|
|
||||||
}
|
|
||||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
|
||||||
public void onServerStarted(FMLServerStartedEvent event) {
|
public void onServerStarted(FMLServerStartedEvent event) {
|
||||||
commonMod.onServerStarted();
|
commonMod.onServerStarted();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user