From b15667a7e6e5ee32d0713314ae8417aaefd0a5fb Mon Sep 17 00:00:00 2001 From: cpw Date: Wed, 2 Mar 2016 08:59:31 -0500 Subject: [PATCH] DedicatedServer IntegratedServer --- .../dedicated/DedicatedServer.java.patch | 20 ++++++- .../integrated/IntegratedServer.java.patch | 60 ++++++++++++++++++- .../dedicated/DedicatedServer.java.patch.rej | 18 ------ .../IntegratedServer.java.patch.rej | 58 ------------------ 4 files changed, 76 insertions(+), 80 deletions(-) delete mode 100644 rejects/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch.rej delete mode 100644 rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej diff --git a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch index f2415104a2..d945032b47 100644 --- a/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -25,7 +25,23 @@ logger.info("Loading properties"); this.settings = new PropertyManager(new File("server.properties")); this.eula = new ServerEula(new File("eula.txt")); -@@ -282,7 +286,7 @@ +@@ -205,6 +209,7 @@ + } + else + { ++ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); + this.func_184105_a(new DedicatedPlayerList(this)); + long j = System.nanoTime(); + +@@ -254,6 +259,7 @@ + TileEntitySkull.func_184293_a(this.getPlayerProfileCache()); + TileEntitySkull.func_184294_a(this.getMinecraftSessionService()); + PlayerProfileCache.func_187320_a(this.isServerInOnlineMode()); ++ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; + logger.info("Preparing level \"" + this.getFolderName() + "\""); + this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); + long i1 = System.nanoTime() - j; +@@ -282,7 +288,7 @@ thread1.start(); } @@ -34,7 +50,7 @@ } } } -@@ -580,6 +584,9 @@ +@@ -580,6 +586,9 @@ return this.settings.getIntProperty("network-compression-threshold", super.getNetworkCompressionTreshold()); } diff --git a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch index 51bc84dfe0..e83ac8ccbd 100644 --- a/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches.mcp/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -9,7 +9,63 @@ ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); this.setResourcePackFromWorld(this.getFolderName(), isavehandler); WorldInfo worldinfo = isavehandler.loadWorldInfo(); -@@ -138,9 +136,10 @@ +@@ -83,44 +81,23 @@ + worldinfo.setWorldName(p_71247_2_); + } + +- for (int i = 0; i < this.worldServers.length; ++i) ++ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : ++ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); ++ overWorld.initialize(this.theWorldSettings); ++ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) + { +- int j = 0; +- +- if (i == 1) ++ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); ++ world.addWorldAccess(new WorldManager(this, world)); ++ if (!this.isSinglePlayer()) + { +- j = -1; ++ world.getWorldInfo().setGameType(getGameType()); + } +- +- if (i == 2) +- { +- j = 1; +- } +- +- if (i == 0) +- { +- if (this.isDemo()) +- { +- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); +- } +- +- this.worldServers[i].initialize(this.theWorldSettings); +- } +- else +- { +- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); +- } +- +- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); + } + +- this.func_184103_al().setPlayerManager(this.worldServers); ++ this.func_184103_al().setPlayerManager(new WorldServer[]{ overWorld }); + +- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) ++ if (overWorld.getWorldInfo().getDifficulty() == null) + { + this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); + } +@@ -138,9 +115,10 @@ this.setAllowFlight(true); logger.info("Generating keypair"); this.setKeyPair(CryptManager.generateKeyPair()); @@ -21,7 +77,7 @@ } public void tick() -@@ -213,6 +212,7 @@ +@@ -213,6 +191,7 @@ public EnumDifficulty getDifficulty() { diff --git a/rejects/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch.rej deleted file mode 100644 index 5a4f31b4c5..0000000000 --- a/rejects/minecraft/net/minecraft/server/dedicated/DedicatedServer.java.patch.rej +++ /dev/null @@ -1,18 +0,0 @@ -++++ REJECTED PATCH 4 - } - else - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onServerStarted(); - this.setConfigManager(new DedicatedPlayerList(this)); - long j = System.nanoTime(); - -++++ END PATCH -++++ REJECTED PATCH 5 - this.setBuildLimit((this.getBuildLimit() + 8) / 16 * 16); - this.setBuildLimit(MathHelper.clamp_int(this.getBuildLimit(), 64, 256)); - this.settings.setProperty("max-build-height", Integer.valueOf(this.getBuildLimit())); -+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; - logger.info("Preparing level \"" + this.getFolderName() + "\""); - this.loadAllWorlds(this.getFolderName(), this.getFolderName(), k, worldtype, s2); - long i1 = System.nanoTime() - j; -++++ END PATCH diff --git a/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej b/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej deleted file mode 100644 index 621619af0a..0000000000 --- a/rejects/minecraft/net/minecraft/server/integrated/IntegratedServer.java.patch.rej +++ /dev/null @@ -1,58 +0,0 @@ -++++ REJECTED PATCH 2 - worldinfo.setWorldName(p_71247_2_); - } - -- for (int i = 0; i < this.worldServers.length; ++i) -- { -- int j = 0; -+ WorldServer overWorld = (isDemo() ? (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init() : -+ (WorldServer)(new WorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()); -+ overWorld.initialize(this.theWorldSettings); - -- if (i == 1) -+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) -+ { -+ WorldServer world = (dim == 0 ? overWorld : (WorldServer)(new WorldServerMulti(this, isavehandler, dim, overWorld, this.theProfiler)).init()); -+ world.addWorldAccess(new WorldManager(this, world)); -+ if (!this.isSinglePlayer()) - { -- j = -1; -+ world.getWorldInfo().setGameType(getGameType()); - } -- -- if (i == 2) -- { -- j = 1; -- } -- -- if (i == 0) -- { -- if (this.isDemo()) -- { -- this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); -- } -- -- this.worldServers[i].initialize(this.theWorldSettings); -- } -- else -- { -- this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); -- } -- -- this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); - } - -- this.getConfigurationManager().setPlayerManager(this.worldServers); -+ this.getConfigurationManager().setPlayerManager(new WorldServer[]{ overWorld }); - -- if (this.worldServers[0].getWorldInfo().getDifficulty() == null) -+ if (overWorld.getWorldInfo().getDifficulty() == null) - { - this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); - } -++++ END PATCH