ChunkTickets
Namespace Mc.Scripting.Worlds · Kind class (sealed)
public sealed class ChunkTicketsChunk tickets of one plugin (plugin.ChunkTickets): they are released automatically when the plugin unloads or reloads.
Fields
Section titled “Fields”| Member | Description |
|---|---|
const int MaxTicketsPerPlugin = 4096 |
How many chunks one plugin may hold at once (a ticket keeps a chunk in memory and ticking: a runaway loop must not load the whole world). |
MaxTicketsPerPlugin
Section titled “MaxTicketsPerPlugin”public const int MaxTicketsPerPlugin = 4096;How many chunks one plugin may hold at once (a ticket keeps a chunk in memory and ticking: a runaway loop must not load the whole world).
Properties
Section titled “Properties”| Member | Description |
|---|---|
int ActiveCount { get; } |
How many tickets this plugin currently holds. |
ActiveCount
Section titled “ActiveCount”public int ActiveCount { get; }How many tickets this plugin currently holds.
Methods
Section titled “Methods”| Member | Description |
|---|---|
ChunkTicket Add(World world, int chunkX, int chunkZ) |
Asks for a chunk to be loaded and kept. |
IReadOnlyList<ChunkTicket> AddArea(World world, int centerX, int centerZ, int radius) |
Asks for the chunks of a square around a centre chunk (radius 0 is one chunk, 1 is 3 x 3). |
public ChunkTicket Add(World world, int chunkX, int chunkZ)Asks for a chunk to be loaded and kept.
Parameters
| Name | Type | Description |
|---|---|---|
world |
World |
The dimension. |
chunkX |
int |
The chunk x (block x >> 4). |
chunkZ |
int |
The chunk z. |
Returns ChunkTicket: The ticket. Check ChunkTicket.IsLoaded (or poll World.IsChunkLoaded): loading is asynchronous.
Throws
System.InvalidOperationException: The dimension does not exist, or the plugin already holdsChunkTickets.MaxTicketsPerPluginchunks.System.ArgumentOutOfRangeException: The chunk is outside the world border (blocks beyond +-30,000,000).
AddArea
Section titled “AddArea”public IReadOnlyList<ChunkTicket> AddArea(World world, int centerX, int centerZ, int radius)Asks for the chunks of a square around a centre chunk (radius 0 is one chunk, 1 is 3 x 3).
Parameters
| Name | Type | Description |
|---|---|---|
world |
World |
The dimension. |
centerX |
int |
The centre chunk x. |
centerZ |
int |
The centre chunk z. |
radius |
int |
The radius in chunks (at most 32). |
Returns IReadOnlyList<ChunkTicket>: The tickets, one per chunk.