diff --git a/src/main/java/dan200/computercraft/core/computer/MainThread.java b/src/main/java/dan200/computercraft/core/computer/MainThread.java index c1658aa67..222abb274 100644 --- a/src/main/java/dan200/computercraft/core/computer/MainThread.java +++ b/src/main/java/dan200/computercraft/core/computer/MainThread.java @@ -23,8 +23,8 @@ import java.util.concurrent.atomic.AtomicLong; * {@link MainThread} starts cool, and runs as many tasks as it can in the current {@link #budget}ns. Any external tasks * (those run by tile entities, etc...) will also consume the budget * - * Next tick, we put {@link ComputerCraft#maxMainGlobalTime} into our budget (and clamp it to that value to). If we're - * still over budget, then we should not execute any work (either as part of {@link MainThread} or externally). + * Next tick, we add {@link ComputerCraft#maxMainGlobalTime} to our budget (clamp it to that value too). If we're still + * over budget, then we should not execute any work (either as part of {@link MainThread} or externally). */ public final class MainThread { diff --git a/src/main/java/dan200/computercraft/shared/CommonHooks.java b/src/main/java/dan200/computercraft/shared/CommonHooks.java index 842a8af3d..864772eba 100644 --- a/src/main/java/dan200/computercraft/shared/CommonHooks.java +++ b/src/main/java/dan200/computercraft/shared/CommonHooks.java @@ -29,7 +29,6 @@ import net.minecraftforge.event.*; import net.minecraftforge.event.entity.player.PlayerContainerEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.server.FMLServerStartedEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.event.server.FMLServerStoppedEvent; @@ -90,22 +89,21 @@ public final class CommonHooks { ComputerMBean.register(); } - } - @SubscribeEvent - public static void onServerStarted( FMLServerStartedEvent event ) - { - ComputerCraft.serverComputerRegistry.reset(); - WirelessNetwork.resetNetworks(); - Tracking.reset(); + resetState(); ComputerMBean.registerTracker(); - NetworkUtils.reset(); } @SubscribeEvent public static void onServerStopped( FMLServerStoppedEvent event ) + { + resetState(); + } + + private static void resetState() { ComputerCraft.serverComputerRegistry.reset(); + MainThread.reset(); WirelessNetwork.resetNetworks(); Tracking.reset(); NetworkUtils.reset();