|
static boolean | savedWorldHasForcedChunkTickets (File chunkDir) |
|
static void | setForcedChunkLoadingCallback (Object mod, LoadingCallback callback) |
|
static int | ticketCountAvailableFor (Object mod, World world) |
|
static int | getMaxTicketLengthFor (String modId) |
|
static int | getMaxChunkDepthFor (String modId) |
|
static int | ticketCountAvailableFor (String username) |
|
static Ticket | requestPlayerTicket (Object mod, String player, World world, Type type) |
|
static Ticket | requestTicket (Object mod, World world, Type type) |
|
static void | releaseTicket (Ticket ticket) |
|
static void | forceChunk (Ticket ticket, ChunkCoordIntPair chunk) |
|
static void | reorderChunk (Ticket ticket, ChunkCoordIntPair chunk) |
|
static void | unforceChunk (Ticket ticket, ChunkCoordIntPair chunk) |
|
static ImmutableSetMultimap
< ChunkCoordIntPair, Ticket > | getPersistentChunksFor (World world) |
|
static void | putDormantChunk (long coords, Chunk chunk) |
|
static Chunk | fetchDormantChunk (long coords, World world) |
|
static ConfigCategory | getConfigFor (Object mod) |
|
static void | addConfigProperty (Object mod, String propertyName, String value, Property.Type type) |
|
Manages chunkloading for mods.
The basic principle is a ticket based system.
- Mods register a callback setForcedChunkLoadingCallback(Object, LoadingCallback)
- Mods ask for a ticket requestTicket(Object, World, Type) and then hold on to that ticket.
- Mods request chunks to stay loaded forceChunk(Ticket, ChunkCoordIntPair) or remove chunks from force loading unforceChunk(Ticket, ChunkCoordIntPair).
- When a world unloads, the tickets associated with that world are saved by the chunk manager.
- When a world loads, saved tickets are offered to the mods associated with the tickets. The Ticket#getModData() that is set by the mod should be used to re-register chunks to stay loaded (and maybe take other actions).
The chunkloading is configurable at runtime. The file "config/forgeChunkLoading.cfg" contains both default configuration for chunkloading, and a sample individual mod specific override section.
- Author
- cpw
static void net.minecraftforge.common.ForgeChunkManager.addConfigProperty |
( |
Object |
mod, |
|
|
String |
propertyName, |
|
|
String |
value, |
|
|
Property.Type |
type |
|
) |
| |
|
static |
static Chunk net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk |
( |
long |
coords, |
|
|
World |
world |
|
) |
| |
|
static |
static void net.minecraftforge.common.ForgeChunkManager.forceChunk |
( |
Ticket |
ticket, |
|
|
ChunkCoordIntPair |
chunk |
|
) |
| |
|
static |
Force the supplied chunk coordinate to be loaded by the supplied ticket. If the ticket's Ticket#maxDepth is exceeded, the least recently registered chunk is unforced and may be unloaded. It is safe to force the chunk several times for a ticket, it will not generate duplication or change the ordering.
- Parameters
-
ticket | The ticket registering the chunk |
chunk | The chunk to force |
static ConfigCategory net.minecraftforge.common.ForgeChunkManager.getConfigFor |
( |
Object |
mod) | |
|
|
static |
static int net.minecraftforge.common.ForgeChunkManager.getMaxChunkDepthFor |
( |
String |
modId) | |
|
|
static |
static int net.minecraftforge.common.ForgeChunkManager.getMaxTicketLengthFor |
( |
String |
modId) | |
|
|
static |
static ImmutableSetMultimap<ChunkCoordIntPair, Ticket> net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor |
( |
World |
world) | |
|
|
static |
The list of persistent chunks in the world. This set is immutable.
- Parameters
-
- Returns
- the list of persistent chunks in the world
static void net.minecraftforge.common.ForgeChunkManager.putDormantChunk |
( |
long |
coords, |
|
|
Chunk |
chunk |
|
) |
| |
|
static |
static void net.minecraftforge.common.ForgeChunkManager.releaseTicket |
( |
Ticket |
ticket) | |
|
|
static |
Release the ticket back to the system. This will also unforce any chunks held by the ticket so that they can be unloaded and/or stop ticking.
- Parameters
-
ticket | The ticket to release |
static void net.minecraftforge.common.ForgeChunkManager.reorderChunk |
( |
Ticket |
ticket, |
|
|
ChunkCoordIntPair |
chunk |
|
) |
| |
|
static |
Reorganize the internal chunk list so that the chunk supplied is at the end of the list This helps if you wish to guarantee a certain "automatic unload ordering" for the chunks in the ticket list
- Parameters
-
ticket | The ticket holding the chunk list |
chunk | The chunk you wish to push to the end (so that it would be unloaded last) |
static Ticket net.minecraftforge.common.ForgeChunkManager.requestPlayerTicket |
( |
Object |
mod, |
|
|
String |
player, |
|
|
World |
world, |
|
|
Type |
type |
|
) |
| |
|
static |
static Ticket net.minecraftforge.common.ForgeChunkManager.requestTicket |
( |
Object |
mod, |
|
|
World |
world, |
|
|
Type |
type |
|
) |
| |
|
static |
Request a chunkloading ticket of the appropriate type for the supplied mod
- Parameters
-
mod | The mod requesting a ticket |
world | The world in which it is requesting the ticket |
type | The type of ticket |
- Returns
- A ticket with which to register chunks for loading, or null if no further tickets are available
static boolean net.minecraftforge.common.ForgeChunkManager.savedWorldHasForcedChunkTickets |
( |
File |
chunkDir) | |
|
|
static |
Allows dynamically loading world mods to test if there are chunk tickets in the world Mods that add dynamically generated worlds (like Mystcraft) should call this method to determine if the world should be loaded during server starting.
- Parameters
-
- Returns
- if there are tickets outstanding for this world or not
static void net.minecraftforge.common.ForgeChunkManager.setForcedChunkLoadingCallback |
( |
Object |
mod, |
|
|
LoadingCallback |
callback |
|
) |
| |
|
static |
Set a chunkloading callback for the supplied mod object
- Parameters
-
mod | The mod instance registering the callback |
callback | The code to call back when forced chunks are loaded |
static int net.minecraftforge.common.ForgeChunkManager.ticketCountAvailableFor |
( |
Object |
mod, |
|
|
World |
world |
|
) |
| |
|
static |
Discover the available tickets for the mod in the world
- Parameters
-
mod | The mod that will own the tickets |
world | The world |
- Returns
- The count of tickets left for the mod in the supplied world
static int net.minecraftforge.common.ForgeChunkManager.ticketCountAvailableFor |
( |
String |
username) | |
|
|
static |
static void net.minecraftforge.common.ForgeChunkManager.unforceChunk |
( |
Ticket |
ticket, |
|
|
ChunkCoordIntPair |
chunk |
|
) |
| |
|
static |
Unforce the supplied chunk, allowing it to be unloaded and stop ticking.
- Parameters
-
ticket | The ticket holding the chunk |
chunk | The chunk to unforce |
The documentation for this class was generated from the following file:
- C:/Users/LazDude/Downloads/MinecraftModding/YATS/forge/mcp/src/minecraft/net/minecraftforge/common/ForgeChunkManager.java