mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 11:05:40 +00:00
Well, it works, for a game, now.
This commit is contained in:
1 parent
06b16aaa19
commit
d0ab0e166c
208 files changed
+2328
-5883
No files matched your search
@@ -57,12 +57,17 @@ import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.WorldServerMulti;
|
||||
import net.minecraft.world.storage.ISaveHandler;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
import org.apache.logging.log4j.MarkerManager;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class DimensionManager
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger("FML");
|
||||
private static final Marker DIMMGR = MarkerManager.getMarker("DIMS");
|
||||
private static class Dimension
|
||||
{
|
||||
private final DimensionType type;
|
||||
@@ -187,11 +192,11 @@ public class DimensionManager
|
||||
int leakCount = leakedWorlds.count(System.identityHashCode(w));
|
||||
if (leakCount == 5)
|
||||
{
|
||||
FMLLog.log.debug("The world {} ({}) may have leaked: first encounter (5 occurrences).\n", Integer.toHexString(System.identityHashCode(w)), w.getWorldInfo().getWorldName());
|
||||
LOGGER.debug(DIMMGR,"The world {} ({}) may have leaked: first encounter (5 occurrences).\n", Integer.toHexString(System.identityHashCode(w)), w.getWorldInfo().getWorldName());
|
||||
}
|
||||
else if (leakCount % 5 == 0)
|
||||
{
|
||||
FMLLog.log.debug("The world {} ({}) may have leaked: seen {} times.\n", Integer.toHexString(System.identityHashCode(w)), w.getWorldInfo().getWorldName(), leakCount);
|
||||
LOGGER.debug(DIMMGR,"The world {} ({}) may have leaked: seen {} times.\n", Integer.toHexString(System.identityHashCode(w)), w.getWorldInfo().getWorldName(), leakCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,13 +215,13 @@ public class DimensionManager
|
||||
worlds.put(id, world);
|
||||
weakWorldMap.put(world, world);
|
||||
server.worldTickTimes.put(id, new long[100]);
|
||||
FMLLog.log.info("Loading dimension {} ({}) ({})", id, world.getWorldInfo().getWorldName(), world.getMinecraftServer());
|
||||
LOGGER.info(DIMMGR,"Loading dimension {} ({}) ({})", id, world.getWorldInfo().getWorldName(), world.getMinecraftServer());
|
||||
}
|
||||
else
|
||||
{
|
||||
worlds.remove(id);
|
||||
server.worldTickTimes.remove(id);
|
||||
FMLLog.log.info("Unloading dimension {}", id);
|
||||
LOGGER.info(DIMMGR,"Unloading dimension {}", id);
|
||||
}
|
||||
|
||||
ArrayList<WorldServer> tmp = new ArrayList<WorldServer>();
|
||||
@@ -253,7 +258,7 @@ public class DimensionManager
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log.error("Cannot Hotload Dim: {}", dim, e);
|
||||
LOGGER.error(DIMMGR,"Cannot Hotload Dim: {}", dim, e);
|
||||
return; // If a provider hasn't been registered then we can't hotload the dim
|
||||
}
|
||||
MinecraftServer mcServer = overworld.getMinecraftServer();
|
||||
@@ -321,7 +326,7 @@ public class DimensionManager
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log.error("An error occurred trying to create an instance of WorldProvider {} ({})",
|
||||
LOGGER.error(DIMMGR,"An error occurred trying to create an instance of WorldProvider {} ({})",
|
||||
dim, getProviderType(dim), e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -357,7 +362,7 @@ public class DimensionManager
|
||||
|
||||
if (unloadQueue.add(id))
|
||||
{
|
||||
FMLLog.log.debug("Queueing dimension {} to unload", id);
|
||||
LOGGER.debug(DIMMGR,"Queueing dimension {} to unload", id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,7 +381,7 @@ public class DimensionManager
|
||||
{
|
||||
int id = queueIterator.nextInt();
|
||||
Dimension dimension = dimensions.get(id);
|
||||
if (dimension.ticksWaited < ForgeModContainer.dimensionUnloadQueueDelay)
|
||||
if (dimension.ticksWaited < ForgeMod.dimensionUnloadQueueDelay)
|
||||
{
|
||||
dimension.ticksWaited++;
|
||||
continue;
|
||||
@@ -387,7 +392,7 @@ public class DimensionManager
|
||||
// Don't unload the world if the status changed
|
||||
if (w == null || !canUnloadWorld(w))
|
||||
{
|
||||
FMLLog.log.debug("Aborting unload for dimension {} as status changed", id);
|
||||
LOGGER.debug(DIMMGR,"Aborting unload for dimension {} as status changed", id);
|
||||
continue;
|
||||
}
|
||||
try
|
||||
@@ -396,7 +401,7 @@ public class DimensionManager
|
||||
}
|
||||
catch (MinecraftException e)
|
||||
{
|
||||
FMLLog.log.error("Caught an exception while saving all chunks:", e);
|
||||
LOGGER.error(DIMMGR,"Caught an exception while saving all chunks:", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user