public class DimensionManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
DimensionManager.Data |
private static class |
DimensionManager.NoopChunkStatusListener |
static class |
DimensionManager.SavedEntry |
Modifier and Type | Field and Description |
---|---|
private static it.unimi.dsi.fastutil.ints.Int2ObjectMap<DimensionManager.Data> |
dimensions |
private static org.apache.logging.log4j.Marker |
DIMMGR |
private static java.util.List<java.lang.String> |
foldersScheduledForDeletion |
private static com.google.common.collect.Multiset<java.lang.Integer> |
leakedWorlds |
private static org.apache.logging.log4j.Logger |
LOGGER |
private static java.util.Set<World> |
playerWorlds |
private static ClearableRegistry<DimensionType> |
REGISTRY |
private static java.util.Map<ResourceLocation,DimensionManager.SavedEntry> |
savedEntries |
private static it.unimi.dsi.fastutil.ints.IntSet |
unloadQueue |
private static java.util.concurrent.ConcurrentMap<World,World> |
weakWorldMap |
Constructor and Description |
---|
DimensionManager() |
Modifier and Type | Method and Description |
---|---|
private static boolean |
canUnloadWorld(ServerWorld world) |
static void |
fireRegister() |
private static DimensionManager.Data |
getData(DimensionType dim) |
static MutableRegistry<DimensionType> |
getRegistry()
Deprecated.
|
static ServerWorld |
getWorld(MinecraftServer server,
DimensionType dim,
boolean resetUnloadDelay,
boolean forceLoad)
Retrieves the world from the server allowing for null return, and optionally resetting it's unload timer.
|
static ServerWorld |
initWorld(MinecraftServer server,
DimensionType dim) |
static boolean |
keepLoaded(DimensionType dim)
Determines if the dimension will stay loaded in memory even if all chunks are unloaded.
|
static boolean |
keepLoaded(DimensionType dim,
boolean value)
Configures if the dimension will stay loaded in memory even if all chunks are unloaded.
|
static void |
markForDeletion(DimensionType dim)
Marks the given dimension for deletion upon next reload of the save.
|
static void |
processScheduledDeletions(SaveHandler saveHandler) |
static void |
readRegistry(CompoundNBT data) |
static boolean |
rebuildPlayerMap(PlayerList players,
boolean changed) |
static DimensionType |
registerDimension(ResourceLocation name,
ModDimension type,
PacketBuffer data,
boolean hasSkyLight)
Registers a real unique dimension, Should be called on server init, or when the dimension is created.
|
static DimensionType |
registerDimensionInternal(int id,
ResourceLocation name,
ModDimension type,
PacketBuffer data,
boolean hasSkyLight) |
static DimensionType |
registerOrGetDimension(ResourceLocation name,
ModDimension type,
PacketBuffer data,
boolean hasSkyLight)
Register or get the existing dimension type for the given dimtype name.
|
static void |
unloadWorld(ServerWorld world)
Queues a dimension to unload, if it can be unloaded.
|
static void |
unloadWorlds(MinecraftServer server,
boolean checkLeaks) |
static void |
unregisterDimension(int id)
Deprecated.
|
static void |
writeRegistry(CompoundNBT data) |
private static final org.apache.logging.log4j.Logger LOGGER
private static final org.apache.logging.log4j.Marker DIMMGR
private static final ClearableRegistry<DimensionType> REGISTRY
private static final it.unimi.dsi.fastutil.ints.Int2ObjectMap<DimensionManager.Data> dimensions
private static final it.unimi.dsi.fastutil.ints.IntSet unloadQueue
private static final com.google.common.collect.Multiset<java.lang.Integer> leakedWorlds
private static final java.util.Map<ResourceLocation,DimensionManager.SavedEntry> savedEntries
private static final java.util.List<java.lang.String> foldersScheduledForDeletion
private static volatile java.util.Set<World> playerWorlds
public static DimensionType registerOrGetDimension(ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight)
RegisterDimensionsEvent
is fired.
You can use this helper to get your existing dimension, or create it if it is not found.name
- Registry nametype
- ModDimension type datadata
- Extra data for the ModDimensionhasSkyLight
- does this dimension have a skylight?magnifier
- The biome generation processorpublic static DimensionType registerDimension(ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight)
name
- Registry name for this new dimension.type
- Dimension Type.data
- Configuration data for this dimension, passed intohasSkyLight
- skylight for this dimensionmagnifier
- The biome generation processorpublic static boolean keepLoaded(DimensionType dim, boolean value)
dim
- The dimensionvalue
- True to keep loaded, false to allow unloadingpublic static boolean keepLoaded(DimensionType dim)
dim
- The dimension@Nullable public static ServerWorld getWorld(MinecraftServer server, DimensionType dim, boolean resetUnloadDelay, boolean forceLoad)
server
- The server that controls this world.dim
- Dimension to load.resetUnloadDelay
- True to reset the unload timer, which is a delay that is used to prevent constant world loading/unloading cycle.forceLoad
- True to attempt to load the dimension if the server has it unloaded.public static void markForDeletion(DimensionType dim)
dim
- the dimension to delete@Deprecated public static void unregisterDimension(int id)
markForDeletion(DimensionType)
public static DimensionType registerDimensionInternal(int id, ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight)
public static ServerWorld initWorld(MinecraftServer server, DimensionType dim)
private static boolean canUnloadWorld(ServerWorld world)
public static void unloadWorld(ServerWorld world)
world
- The world to unloadpublic static void unloadWorlds(MinecraftServer server, boolean checkLeaks)
public static void writeRegistry(CompoundNBT data)
public static void readRegistry(CompoundNBT data)
public static void processScheduledDeletions(SaveHandler saveHandler)
public static void fireRegister()
@Deprecated public static MutableRegistry<DimensionType> getRegistry()
private static DimensionManager.Data getData(DimensionType dim)
public static boolean rebuildPlayerMap(PlayerList players, boolean changed)