Record Class TicketController
java.lang.Object
java.lang.Record
net.neoforged.neoforge.common.world.chunk.TicketController
- Record Components:
- id- the ID of this controller
- callback- a callback to be called when the tickets are loaded, in order to validate whether they're still active or not.- nullshould be used when a callback needn't be provided
@ParametersAreNonnullByDefault
public record TicketController(ResourceLocation id, @Nullable LoadingValidationCallback callback)
extends Record
A class used to manage chunk loading tickets associated with a specific ID.
 
 Controllers must be registered via RegisterTicketControllersEvent. A controller that isn't registered will have all of its tickets discarded when the world is loaded, and any attempts at force-loading a chunk through it will result in an IllegalArgumentException.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final LoadingValidationCallbackThe field for thecallbackrecord component.private final ResourceLocationThe field for theidrecord component.
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a ticket controller without a validation callback.TicketController(ResourceLocation id, LoadingValidationCallback callback) Creates an instance of aTicketControllerrecord class.
- 
Method SummaryModifier and TypeMethodDescriptioncallback()Returns the value of thecallbackrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanforceChunk(ServerLevel level, UUID owner, int chunkX, int chunkZ, boolean add, boolean ticking) Forces a chunk to be loaded with the "owner" of the ticket being a given UUID.booleanforceChunk(ServerLevel level, BlockPos owner, int chunkX, int chunkZ, boolean add, boolean ticking) Forces a chunk to be loaded with the "owner" of the ticket being a given block position.booleanforceChunk(ServerLevel level, Entity owner, int chunkX, int chunkZ, boolean add, boolean ticking) Forces a chunk to be loaded with the "owner" of the ticket being the UUID of the given entity.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.final StringtoString()Returns a string representation of this record class.
- 
Field Details
- 
Constructor Details- 
TicketControllerCreates an instance of aTicketControllerrecord class.
- 
TicketControllerCreates a ticket controller without a validation callback.- Parameters:
- id- the ID of the controller
 
 
- 
- 
Method Details- 
forceChunkpublic boolean forceChunk(ServerLevel level, BlockPos owner, int chunkX, int chunkZ, boolean add, boolean ticking) Forces a chunk to be loaded with the "owner" of the ticket being a given block position.- Parameters:
- add-- trueto force the chunk,- falseto unforce the chunk.
- ticking-- trueto make the chunk receive full chunk ticks even if there is no player nearby.
 
- 
forceChunkpublic boolean forceChunk(ServerLevel level, Entity owner, int chunkX, int chunkZ, boolean add, boolean ticking) Forces a chunk to be loaded with the "owner" of the ticket being the UUID of the given entity.- Parameters:
- add-- trueto force the chunk,- falseto unforce the chunk.
- ticking-- trueto make the chunk receive full chunk ticks even if there is no player nearby.
 
- 
forceChunkpublic boolean forceChunk(ServerLevel level, UUID owner, int chunkX, int chunkZ, boolean add, boolean ticking) Forces a chunk to be loaded with the "owner" of the ticket being a given UUID.- Parameters:
- add-- trueto force the chunk,- falseto unforce the chunk.
- ticking-- trueto make the chunk receive full chunk ticks even if there is no player nearby.
 
- 
toStringReturns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
- 
hashCodepublic final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
- 
equalsIndicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object).
- 
idReturns the value of theidrecord component.- Returns:
- the value of the idrecord component
 
- 
callbackReturns the value of thecallbackrecord component.- Returns:
- the value of the callbackrecord component
 
 
-