DedicatedServer

IntegratedServer
This commit is contained in:
cpw committed 2016-03-02 13:22:04 -05:00
1 parent becb0a9e0e
commit b15667a7e6
4 files changed
+76 -80

No files matched your search

@@ -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());
}
@@ -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()
{
@@ -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
@@ -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