--- ../src_base/common/net/minecraft/server/MinecraftServer.java +++ ../src_work/common/net/minecraft/server/MinecraftServer.java @@ -9,6 +9,7 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; +import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.logging.Level; @@ -58,6 +59,7 @@ import net.minecraft.src.WorldServerMulti; import net.minecraft.src.WorldSettings; import net.minecraft.src.WorldType; +import net.minecraftforge.common.DimensionManager; public abstract class MinecraftServer implements Runnable, IPlayerUsage, ICommandSender { @@ -129,7 +131,10 @@ public final long[] tickTimeArray = new long[100]; /** stats are [dimension][tick%100] system.nanoTime is stored. */ - public long[][] timeOfLastDimenstionTick; + //public long[][] timeOfLastDimenstionTick; + public List worlds = new ArrayList(); + public Hashtable worldTickTimes = new Hashtable(); + public int spawnProtectionSize = 16; private KeyPair serverKeyPair; /** Username of the server owner (for integrated servers) */ @@ -196,8 +201,6 @@ { this.convertMapIfNeeded(par1Str); this.setUserMessage("menu.loadingLevel"); - this.theWorldServer = new WorldServer[3]; - this.timeOfLastDimenstionTick = new long[this.theWorldServer.length][100]; ISaveHandler var6 = this.anvilConverterForAnvilFile.getSaveLoader(par1Str, true); WorldInfo var8 = var6.loadWorldInfo(); WorldSettings var7; @@ -216,46 +219,18 @@ var7.enableBonusChest(); } - for (int var9 = 0; var9 < this.theWorldServer.length; ++var9) - { - byte var10 = 0; - - if (var9 == 1) - { - var10 = -1; - } - - if (var9 == 2) - { - var10 = 1; - } - - if (var9 == 0) - { - if (this.isDemo()) - { - this.theWorldServer[var9] = new DemoWorldServer(this, var6, par2Str, var10, this.theProfiler); - } - else - { - this.theWorldServer[var9] = new WorldServer(this, var6, par2Str, var10, var7, this.theProfiler); - } - } - else - { - this.theWorldServer[var9] = new WorldServerMulti(this, var6, par2Str, var10, var7, this.theWorldServer[0], this.theProfiler); - } - - this.theWorldServer[var9].addWorldAccess(new WorldManager(this, this.theWorldServer[var9])); - + WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, var6, par2Str, 0, theProfiler) : new WorldServer(this, var6, par2Str, 0, var7, theProfiler)); + for (int dim : DimensionManager.getIDs()) + { + WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, var6, par2Str, dim, var7, overWorld, theProfiler)); + world.addWorldAccess(new WorldManager(this, world)); if (!this.isSinglePlayer()) { - this.theWorldServer[var9].getWorldInfo().setGameType(this.getGameType()); - } - - this.serverConfigManager.setPlayerManager(this.theWorldServer); - } - + world.getWorldInfo().setGameType(this.getGameType()); + } + } + + this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld }); this.setDifficultyForAllDimensions(this.getDifficulty()); this.initialWorldChunkLoad(); } @@ -611,13 +586,13 @@ { this.theProfiler.startSection("levels"); - for (int var1 = 0; var1 < this.theWorldServer.length; ++var1) + for (Integer id : DimensionManager.getIDs()) { long var2 = System.nanoTime(); - if (var1 == 0 || this.getAllowNether()) - { - WorldServer var4 = this.theWorldServer[var1]; + if (id == 0 || this.getAllowNether()) + { + WorldServer var4 = DimensionManager.getWorld(id); this.theProfiler.startSection(var4.getWorldInfo().getWorldName()); if (this.tickCounter % 20 == 0) @@ -648,7 +623,7 @@ } } - this.timeOfLastDimenstionTick[var1][this.tickCounter % 100] = System.nanoTime() - var2; + worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - var2; } this.theProfiler.endStartSection("connection"); @@ -697,7 +672,8 @@ public WorldServer worldServerForDimension(int par1) { - return par1 == -1 ? this.theWorldServer[1] : (par1 == 1 ? this.theWorldServer[2] : this.theWorldServer[0]); + WorldServer ret = DimensionManager.getWorld(par1); + return (ret != null ? ret : DimensionManager.getWorld(0)); } @SideOnly(Side.SERVER) @@ -786,7 +762,7 @@ public String getServerModName() { - return "vanilla"; + return "forge,fml"; } /**