Class World
Runtime simulation world that owns one ECS Store and progresses it on a dedicated tick thread.
public sealed class World : TickingThread, IAsyncDisposable
- Inheritance
-
World
- Implements
- Inherited Members
Properties
Chunks
The world's cubic chunks (generated on demand within the config bounds).
public ChunkStorage Chunks { get; }
Property Value
Config
Gets the loaded world configuration.
public WorldConfig Config { get; }
Property Value
EntitySeed
Per-world seed the client uses for entity-visual determinism (sent via SetEntitySeed).
public int EntitySeed { get; }
Property Value
IsIdle
Allows derived loops to reduce spin timing while still processing tasks and ticks.
protected override bool IsIdle { get; }
Property Value
Name
Gets the stable world name used by the server runtime.
public string Name { get; }
Property Value
Players
Gets the exact committed players for this loaded world.
public PlayerInWorldTracker Players { get; }
Property Value
Storage
Gets storage information for the world save.
public WorldStorage Storage { get; }
Property Value
Uuid
Gets the world UUID from the loaded configuration.
public Guid Uuid { get; }
Property Value
Methods
DisposeAsyncCore()
Performs disposal once for the task published by DisposeAsync().
protected override Task DisposeAsyncCore()
Returns
Remarks
Overrides must await this implementation and release derived resources in a finally block so every caller observes the same completion.
ExecuteAsync(Action<World>)
Executes synchronous Store work on the world thread.
public Task ExecuteAsync(Action<World> callback)
Parameters
callbackAction<World>
Returns
Remarks
Use this as the cross-thread gate to world-owned ECS state. The callback must not keep Store-owned handles for later use
ExecuteAsync<T>(Func<World, T>)
Executes synchronous Store work on the world thread and returns its result.
public Task<T> ExecuteAsync<T>(Func<World, T> callback)
Parameters
callbackFunc<World, T>
Returns
- Task<T>
Type Parameters
T
Remarks
Use this as the cross-thread gate to world-owned ECS state. The callback must not keep Store-owned handles for later use
GetStoreDiagnostics()
Gets a point-in-time diagnostics snapshot for the owned Store.
public StoreDiagnostics GetStoreDiagnostics()
Returns
IsModuleEnabledAsync(string)
Gets runtime module activation on the world thread.
public Task<bool> IsModuleEnabledAsync(string moduleId)
Parameters
moduleIdstring
Returns
OnShutdown()
Runs once on the loop thread after the tick loop exits.
protected override void OnShutdown()
OnStart()
Runs once on the loop thread before the start task completes.
protected override void OnStart()
OpenTransaction()
Opens a synchronous transaction owned by this world's tick thread.
public Transaction OpenTransaction()
Returns
Exceptions
- InvalidOperationException
Thrown when called off the world thread or while the world is not running.
PublishModulePackets(World, string, IReadOnlyList<IToClientPacket>)
Publishes a module-owned packet batch from this world's current Store callback.
public void PublishModulePackets(World source, string moduleId, IReadOnlyList<IToClientPacket> packets)
Parameters
sourceWorldmoduleIdstringpacketsIReadOnlyList<IToClientPacket>
ReportPipelineFailure(Exception)
Defers a managed system exception until execution returns from Flecs.
public void ReportPipelineFailure(Exception exception)
Parameters
exceptionException
SetModuleEnabledAsync(string, bool)
Changes runtime module activation on the world thread.
public Task<bool> SetModuleEnabledAsync(string moduleId, bool enabled)
Parameters
Returns
SetTicksPerSecondAsync(int)
Queues a runtime TPS change onto the world thread.
public Task SetTicksPerSecondAsync(int ticksPerSecond)
Parameters
ticksPerSecondint
Returns
Tick(float)
Runs one measured tick on the loop thread.
protected override void Tick(float deltaSeconds)
Parameters
deltaSecondsfloat