Klasse GameManager
java.lang.Object
de.luckymcdev.foundryengine.common.game.GameManager
- Alle implementierten Schnittstellen:
BundleLifecycleListener
Manages the lifecycle and tick dispatch of game sessions, scoped per world.
Lifecycle tracking (STOPPED → STARTING → RUNNING → STOPPING → STOPPED) is per-world, not per-session. All sessions in a world share the world's lifecycle.
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifikator und TypMethodeBeschreibungbooleanvoidautoStartAll(String worldName) Starts all auto-start sessions for the given world and sets its lifecycle to RUNNING.voidResets the per-tick session deduplication state.Returns all sessions across all worlds and global sessions.net.minecraft.nbt.CompoundTaggetOrCreateSessionData(net.minecraft.resources.Identifier id) Returns the persistent CompoundTag for a session ID, creating one if absent.@Nullable GameSessiongetSession(String worldName, net.minecraft.resources.Identifier id) Returns the registered session for the given world, or null if not found.getSessions(String worldName) Returns an unmodifiable collection of all sessions for the given world.booleanhasSession(String worldName, net.minecraft.resources.Identifier id) Checks if a session with the given ID is registered for the given world.voidonBundlePreUnload(Bundle bundle) voidvoidbooleanregister(GameSession session) Registers a game session for all worlds (current and future).booleanregister(String worldName, GameSession session) Registers a game session for the given world.voidsetWorldDataPath(String worldName, Path dataPath) Sets the data directory for a world, used for session persistence.booleanstartSession(String worldName, net.minecraft.resources.Identifier id) Starts the given session for the given world.voidstopAll()Stops all sessions across all worlds.voidStops all sessions for the given world and sets its lifecycle to STOPPED.booleanstopSession(String worldName, net.minecraft.resources.Identifier id) Stops the given session for the given world.voidtickClient(net.minecraft.client.Minecraft client, net.minecraft.world.level.Level level) Ticks all started sessions for the world of the given client level.voidtickCommon(net.minecraft.world.level.Level level) Ticks all started sessions for the world of the given level.voidtickServer(net.minecraft.server.MinecraftServer server, net.minecraft.server.level.ServerLevel level) Ticks all started sessions for the world of the given server level.voidunregister(String worldName, net.minecraft.resources.Identifier id) Unregisters a game session for the given world and stops it if started.worldDataPath(String worldName) Returns the data directory for a world, orCommon.GAMEif not set.worldLifecycle(String worldName) Returns the lifecycle state for the given world.Von Klasse geerbte Methoden Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitVon Schnittstelle geerbte Methoden BundleLifecycleListener
onBundleLoaded, onBundleUnloaded
-
Konstruktordetails
-
GameManager
public GameManager()
-
-
Methodendetails
-
beginServerTick
public void beginServerTick()Resets the per-tick session deduplication state. Must be called once per server tick before any level/session ticking so that each session's tick handlers run exactly once per server tick regardless of how many dimensions the world has. -
register
Registers a game session for all worlds (current and future). Returns false if a session with the same ID is already registered globally. -
register
Registers a game session for the given world. Returns false if already registered. -
unregister
Unregisters a game session for the given world and stops it if started. -
getSession
Returns the registered session for the given world, or null if not found. -
getSessions
Returns an unmodifiable collection of all sessions for the given world. -
getAllSessions
Returns all sessions across all worlds and global sessions. -
hasSession
Checks if a session with the given ID is registered for the given world. -
anySession
public boolean anySession() -
worldLifecycle
Returns the lifecycle state for the given world. -
getOrCreateSessionData
public net.minecraft.nbt.CompoundTag getOrCreateSessionData(net.minecraft.resources.Identifier id) Returns the persistent CompoundTag for a session ID, creating one if absent. The returned tag survives bundle reloads and is shared by all GameData instances with the same ID. -
setWorldDataPath
-
worldDataPath
Returns the data directory for a world, orCommon.GAMEif not set. -
autoStartAll
Starts all auto-start sessions for the given world and sets its lifecycle to RUNNING. -
startSession
Starts the given session for the given world. -
stopSession
Stops the given session for the given world. -
stopAll
Stops all sessions for the given world and sets its lifecycle to STOPPED. -
stopAll
public void stopAll()Stops all sessions across all worlds. -
tickCommon
public void tickCommon(net.minecraft.world.level.Level level) Ticks all started sessions for the world of the given level. -
tickClient
public void tickClient(net.minecraft.client.Minecraft client, net.minecraft.world.level.Level level) Ticks all started sessions for the world of the given client level. -
tickServer
public void tickServer(net.minecraft.server.MinecraftServer server, net.minecraft.server.level.ServerLevel level) Ticks all started sessions for the world of the given server level. -
onBundlePreUnload
- Angegeben von:
onBundlePreUnloadin SchnittstelleBundleLifecycleListener
-
onBundleReloadStarted
public void onBundleReloadStarted()- Angegeben von:
onBundleReloadStartedin SchnittstelleBundleLifecycleListener
-
onBundleReloadCompleted
public void onBundleReloadCompleted()- Angegeben von:
onBundleReloadCompletedin SchnittstelleBundleLifecycleListener
-