2012-08-11 01:15:10 +00:00
|
|
|
--- ../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
|
|
|
|
{
|
2012-09-16 02:36:08 +00:00
|
|
|
@@ -137,7 +139,9 @@
|
2012-08-11 01:15:10 +00:00
|
|
|
public final long[] tickTimeArray = new long[100];
|
|
|
|
|
2012-09-16 02:36:08 +00:00
|
|
|
/** Stats are [dimension][tick%100] system.nanoTime is stored. */
|
|
|
|
- public long[][] timeOfLastDimensionTick;
|
|
|
|
+ //public long[][] timeOfLastDimensionTick;
|
2012-08-11 03:30:59 +00:00
|
|
|
+ public Hashtable<Integer, long[]> worldTickTimes = new Hashtable<Integer, long[]>();
|
|
|
|
+ public int spawnProtectionSize = 16;
|
2012-08-11 01:15:10 +00:00
|
|
|
private KeyPair serverKeyPair;
|
|
|
|
|
|
|
|
/** Username of the server owner (for integrated servers) */
|
2012-09-16 02:36:08 +00:00
|
|
|
@@ -204,8 +208,6 @@
|
2012-08-11 01:15:10 +00:00
|
|
|
{
|
|
|
|
this.convertMapIfNeeded(par1Str);
|
|
|
|
this.setUserMessage("menu.loadingLevel");
|
2012-09-16 02:36:08 +00:00
|
|
|
- this.worldServers = new WorldServer[3];
|
|
|
|
- this.timeOfLastDimensionTick = new long[this.worldServers.length][100];
|
2012-08-11 01:15:10 +00:00
|
|
|
ISaveHandler var6 = this.anvilConverterForAnvilFile.getSaveLoader(par1Str, true);
|
|
|
|
WorldInfo var8 = var6.loadWorldInfo();
|
|
|
|
WorldSettings var7;
|
2012-09-16 02:36:08 +00:00
|
|
|
@@ -224,46 +226,21 @@
|
2012-08-11 01:15:10 +00:00
|
|
|
var7.enableBonusChest();
|
|
|
|
}
|
|
|
|
|
2012-09-16 02:36:08 +00:00
|
|
|
- for (int var9 = 0; var9 < this.worldServers.length; ++var9)
|
2012-08-11 01:15:10 +00:00
|
|
|
- {
|
|
|
|
- byte var10 = 0;
|
|
|
|
-
|
|
|
|
- if (var9 == 1)
|
|
|
|
- {
|
|
|
|
- var10 = -1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (var9 == 2)
|
|
|
|
- {
|
|
|
|
- var10 = 1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (var9 == 0)
|
|
|
|
- {
|
|
|
|
- if (this.isDemo())
|
|
|
|
- {
|
2012-09-16 02:36:08 +00:00
|
|
|
- this.worldServers[var9] = new DemoWorldServer(this, var6, par2Str, var10, this.theProfiler);
|
2012-08-11 01:15:10 +00:00
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
2012-09-16 02:36:08 +00:00
|
|
|
- this.worldServers[var9] = new WorldServer(this, var6, par2Str, var10, var7, this.theProfiler);
|
2012-08-11 01:15:10 +00:00
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
2012-09-16 02:36:08 +00:00
|
|
|
- this.worldServers[var9] = new WorldServerMulti(this, var6, par2Str, var10, var7, this.worldServers[0], this.theProfiler);
|
2012-08-11 01:15:10 +00:00
|
|
|
- }
|
|
|
|
-
|
2012-09-16 02:36:08 +00:00
|
|
|
- this.worldServers[var9].addWorldAccess(new WorldManager(this, this.worldServers[var9]));
|
2012-08-11 01:15:10 +00:00
|
|
|
+ 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));
|
2012-09-16 02:36:08 +00:00
|
|
|
|
2012-08-11 01:15:10 +00:00
|
|
|
if (!this.isSinglePlayer())
|
|
|
|
{
|
2012-09-16 02:36:08 +00:00
|
|
|
- this.worldServers[var9].getWorldInfo().setGameType(this.getGameType());
|
2012-08-11 01:15:10 +00:00
|
|
|
+ world.getWorldInfo().setGameType(this.getGameType());
|
2012-09-16 02:36:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
this.serverConfigManager.setPlayerManager(this.worldServers);
|
|
|
|
}
|
|
|
|
|
2012-08-11 01:15:10 +00:00
|
|
|
+ this.serverConfigManager.setPlayerManager(new WorldServer[]{ overWorld });
|
2012-09-16 02:36:08 +00:00
|
|
|
this.setDifficultyForAllWorlds(this.getDifficulty());
|
2012-08-11 01:15:10 +00:00
|
|
|
this.initialWorldChunkLoad();
|
|
|
|
}
|
2012-09-16 02:36:08 +00:00
|
|
|
@@ -622,13 +599,13 @@
|
2012-08-11 10:08:09 +00:00
|
|
|
{
|
|
|
|
this.theProfiler.startSection("levels");
|
|
|
|
|
2012-09-16 02:36:08 +00:00
|
|
|
- for (int var1 = 0; var1 < this.worldServers.length; ++var1)
|
2012-08-11 10:08:09 +00:00
|
|
|
+ for (Integer id : DimensionManager.getIDs())
|
|
|
|
{
|
|
|
|
long var2 = System.nanoTime();
|
|
|
|
|
|
|
|
- if (var1 == 0 || this.getAllowNether())
|
|
|
|
- {
|
2012-09-16 02:36:08 +00:00
|
|
|
- WorldServer var4 = this.worldServers[var1];
|
2012-08-11 10:08:09 +00:00
|
|
|
+ if (id == 0 || this.getAllowNether())
|
|
|
|
+ {
|
|
|
|
+ WorldServer var4 = DimensionManager.getWorld(id);
|
|
|
|
this.theProfiler.startSection(var4.getWorldInfo().getWorldName());
|
|
|
|
|
|
|
|
if (this.tickCounter % 20 == 0)
|
2012-09-16 02:36:08 +00:00
|
|
|
@@ -659,7 +636,7 @@
|
2012-08-11 01:15:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-16 02:36:08 +00:00
|
|
|
- this.timeOfLastDimensionTick[var1][this.tickCounter % 100] = System.nanoTime() - var2;
|
2012-08-11 10:08:09 +00:00
|
|
|
+ worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - var2;
|
2012-08-11 01:15:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
this.theProfiler.endStartSection("connection");
|
2012-09-16 02:36:08 +00:00
|
|
|
@@ -717,7 +694,8 @@
|
|
|
|
*/
|
2012-08-11 01:15:10 +00:00
|
|
|
public WorldServer worldServerForDimension(int par1)
|
|
|
|
{
|
2012-09-16 02:36:08 +00:00
|
|
|
- return par1 == -1 ? this.worldServers[1] : (par1 == 1 ? this.worldServers[2] : this.worldServers[0]);
|
2012-08-11 01:15:10 +00:00
|
|
|
+ WorldServer ret = DimensionManager.getWorld(par1);
|
|
|
|
+ return (ret != null ? ret : DimensionManager.getWorld(0));
|
|
|
|
}
|
|
|
|
|
|
|
|
@SideOnly(Side.SERVER)
|
2012-09-16 02:36:08 +00:00
|
|
|
@@ -830,7 +808,7 @@
|
2012-08-11 01:15:10 +00:00
|
|
|
|
|
|
|
public String getServerModName()
|
|
|
|
{
|
|
|
|
- return "vanilla";
|
|
|
|
+ return "forge,fml";
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|