Files
MinecraftForge/fml/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch
T

108 lines
3.4 KiB
Diff

--- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java
+++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java
@@ -4,6 +4,11 @@
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.LoaderState;
+import cpw.mods.fml.common.StartupQuery;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
@@ -333,7 +338,7 @@
public void func_71260_j()
{
- if (!this.field_71290_O)
+ if (!this.field_71290_O && Loader.instance().hasReachedState(LoaderState.SERVER_STARTED))
{
field_147145_h.info("Stopping server");
@@ -381,6 +386,7 @@
{
if (this.func_71197_b())
{
+ FMLCommonHandler.instance().handleServerStarted();
long i = func_130071_aq();
long l = 0L;
this.field_147147_p.func_151315_a(new ChatComponentText(this.field_71286_C));
@@ -425,12 +431,17 @@
Thread.sleep(1L);
this.field_71296_Q = true;
}
+ FMLCommonHandler.instance().handleServerStopping();
}
else
{
this.func_71228_a((CrashReport)null);
}
}
+ catch (StartupQuery.AbortedException e)
+ {
+ // ignore silently
+ }
catch (Throwable throwable1)
{
field_147145_h.error("Encountered an unexpected exception", throwable1);
@@ -471,6 +482,8 @@
}
finally
{
+ FMLCommonHandler.instance().handleServerStopped();
+ this.field_71316_v = true;
this.func_71240_o();
}
}
@@ -513,6 +526,7 @@
{
long i = System.nanoTime();
AxisAlignedBB.func_72332_a().func_72298_a();
+ FMLCommonHandler.instance().onPreServerTick();
++this.field_71315_w;
if (this.field_71295_T)
@@ -566,6 +580,7 @@
this.field_71304_b.func_76319_b();
this.field_71304_b.func_76319_b();
+ FMLCommonHandler.instance().onPostServerTick();
}
public void func_71190_q()
@@ -593,6 +608,7 @@
}
this.field_71304_b.func_76320_a("tick");
+ FMLCommonHandler.instance().onPreWorldTick(worldserver);
CrashReport crashreport;
try
@@ -617,6 +633,7 @@
throw new ReportedException(crashreport);
}
+ FMLCommonHandler.instance().onPostWorldTick(worldserver);
this.field_71304_b.func_76319_b();
this.field_71304_b.func_76320_a("tracker");
worldserver.func_73039_n().func_72788_a();
@@ -648,6 +665,7 @@
public void func_71256_s()
{
+ StartupQuery.reset();
(new Thread("Server thread")
{
private static final String __OBFID = "CL_00001418";
@@ -695,7 +713,7 @@
public String getServerModName()
{
- return "vanilla";
+ return FMLCommonHandler.instance().getModName();
}
public CrashReport func_71230_b(CrashReport p_71230_1_)