Fix a problem with re-entering worlds too quickly- the worlds will now *always* save before the menu re-appears.
This commit is contained in:
parent
c5f74a8ba0
commit
b82a462f64
4 changed files with 42 additions and 9 deletions
|
@ -13,6 +13,7 @@ import com.google.common.collect.ListMultimap;
|
|||
import com.google.common.collect.Maps;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.src.*;
|
||||
|
@ -107,9 +108,11 @@ public class DimensionManager
|
|||
if (world != null) {
|
||||
worlds.put(id, world);
|
||||
MinecraftServer.getServer().worldTickTimes.put(id, new long[100]);
|
||||
FMLLog.info("Loading dimension %d (%s) (%s)", id, world.getWorldInfo().getWorldName(), world.getMinecraftServer());
|
||||
} else {
|
||||
worlds.remove(id);
|
||||
MinecraftServer.getServer().worldTickTimes.remove(id);
|
||||
FMLLog.info("Unloading dimension %d", id);
|
||||
}
|
||||
|
||||
ArrayList<WorldServer> tmp = new ArrayList<WorldServer>();
|
||||
|
@ -180,6 +183,15 @@ public class DimensionManager
|
|||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Not public API: used internally to get dimensions that should load at
|
||||
* server startup
|
||||
* @return
|
||||
*/
|
||||
public static Integer[] getStaticDimensionIDs()
|
||||
{
|
||||
return dimensions.keySet().toArray(new Integer[dimensions.keySet().size()]);
|
||||
}
|
||||
public static WorldProvider createProviderFor(int dim)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
-
|
||||
- this.worldServers[var9].addWorldAccess(new WorldManager(this, this.worldServers[var9]));
|
||||
+ WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, var6, par2Str, 0, theProfiler) : new WorldServer(this, var6, par2Str, 0, var7, theProfiler));
|
||||
+ for (int dim : DimensionManager.getIDs())
|
||||
+ for (int dim : DimensionManager.getStaticDimensionIDs())
|
||||
+ {
|
||||
+ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, var6, par2Str, dim, var7, overWorld, theProfiler));
|
||||
+ world.addWorldAccess(new WorldManager(this, world));
|
||||
|
@ -95,15 +95,17 @@
|
|||
this.setDifficultyForAllWorlds(this.getDifficulty());
|
||||
this.initialWorldChunkLoad();
|
||||
}
|
||||
@@ -408,6 +388,7 @@
|
||||
@@ -408,7 +388,9 @@
|
||||
for (int var3 = 0; var3 < var2; ++var3)
|
||||
{
|
||||
WorldServer var4 = var1[var3];
|
||||
+ MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(var4));
|
||||
var4.flush();
|
||||
+ DimensionManager.setWorld(var4.provider.dimensionId, null);
|
||||
}
|
||||
|
||||
@@ -622,13 +603,13 @@
|
||||
if (this.usageSnooper != null && this.usageSnooper.isSnooperRunning())
|
||||
@@ -622,13 +604,13 @@
|
||||
{
|
||||
this.theProfiler.startSection("levels");
|
||||
|
||||
|
@ -121,7 +123,7 @@
|
|||
this.theProfiler.startSection(var4.getWorldInfo().getWorldName());
|
||||
|
||||
if (this.tickCounter % 20 == 0)
|
||||
@@ -659,9 +640,11 @@
|
||||
@@ -659,9 +641,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +138,7 @@
|
|||
this.theProfiler.endStartSection("connection");
|
||||
this.getNetworkThread().networkTick();
|
||||
this.theProfiler.endStartSection("players");
|
||||
@@ -717,7 +700,12 @@
|
||||
@@ -717,7 +701,12 @@
|
||||
*/
|
||||
public WorldServer worldServerForDimension(int par1)
|
||||
{
|
||||
|
@ -150,7 +152,7 @@
|
|||
}
|
||||
|
||||
@SideOnly(Side.SERVER)
|
||||
@@ -830,7 +818,7 @@
|
||||
@@ -830,7 +819,7 @@
|
||||
|
||||
public String getServerModName()
|
||||
{
|
||||
|
@ -159,7 +161,7 @@
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -1104,6 +1092,7 @@
|
||||
@@ -1104,6 +1093,7 @@
|
||||
|
||||
if (var2 != null)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,26 @@
|
|||
{
|
||||
this.entityRenderer.itemRenderer.func_78445_c();
|
||||
}
|
||||
@@ -2221,80 +2226,12 @@
|
||||
@@ -1917,6 +1922,18 @@
|
||||
if (this.theIntegratedServer != null)
|
||||
{
|
||||
this.theIntegratedServer.initiateShutdown();
|
||||
+ if (loadingScreen!=null)
|
||||
+ {
|
||||
+ this.loadingScreen.resetProgresAndWorkingMessage("Shutting down internal server...");
|
||||
+ }
|
||||
+ while (!theIntegratedServer.isServerStopped())
|
||||
+ {
|
||||
+ try
|
||||
+ {
|
||||
+ Thread.sleep(10);
|
||||
+ }
|
||||
+ catch (InterruptedException ie) {}
|
||||
+ }
|
||||
}
|
||||
|
||||
this.theIntegratedServer = null;
|
||||
@@ -2221,80 +2238,12 @@
|
||||
if (this.objectMouseOver != null)
|
||||
{
|
||||
boolean var1 = this.thePlayer.capabilities.isCreativeMode;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
-
|
||||
- if (var7 == 1)
|
||||
+ WorldServer overWorld = (isDemo() ? new DemoWorldServer(this, var6, par2Str, 0, theProfiler) : new WorldServer(this, var6, par2Str, 0, theWorldSettings, theProfiler));
|
||||
+ for (int dim : DimensionManager.getIDs())
|
||||
+ for (int dim : DimensionManager.getStaticDimensionIDs())
|
||||
+ {
|
||||
+ WorldServer world = (dim == 0 ? overWorld : new WorldServerMulti(this, var6, par2Str, dim, theWorldSettings, overWorld, theProfiler));
|
||||
+ world.addWorldAccess(new WorldManager(this, world));
|
||||
|
|
Loading…
Reference in a new issue