Record Class NetworkRegistry.EventLoopSynchronizedWorkHandler<T>
java.lang.Object
java.lang.Record
net.neoforged.neoforge.network.registration.NetworkRegistry.EventLoopSynchronizedWorkHandler<T>
- Record Components:
 eventLoop- The event loop to schedule tasks on.
- All Implemented Interfaces:
 ISynchronizedWorkHandler
- Enclosing class:
 - NetworkRegistry
 
private static record NetworkRegistry.EventLoopSynchronizedWorkHandler<T>(ReentrantBlockableEventLoop<?> eventLoop, T payload)
extends Record
implements ISynchronizedWorkHandler
An 
ISynchronizedWorkHandler that can be used to schedule tasks on the main thread of the server or client. This wrapper record is used to line up the APIs of the ReentrantBlockableEventLoop with the ISynchronizedWorkHandler.- 
Field Summary
Fields - 
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateEventLoopSynchronizedWorkHandler(ReentrantBlockableEventLoop<?> eventLoop, T payload) Creates an instance of aEventLoopSynchronizedWorkHandlerrecord class. - 
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theeventLooprecord component.voidExecutes a task on the main thread of the game.final inthashCode()Returns a hash code value for this object.payload()Returns the value of thepayloadrecord component.submitAsync(Runnable task) Submits the given work to be run synchronously on the main thread of the game.<R> CompletableFuture<R>submitAsync(Supplier<R> task) Submits the given work to be run synchronously on the main thread of the game.final StringtoString()Returns a string representation of this record class. 
- 
Field Details
- 
eventLoop
The field for theeventLooprecord component. - 
payload
The field for thepayloadrecord component. - 
LOGGER
private static final org.slf4j.Logger LOGGER 
 - 
 - 
Constructor Details
- 
EventLoopSynchronizedWorkHandler
Creates an instance of aEventLoopSynchronizedWorkHandlerrecord class.- Parameters:
 eventLoop- the value for theeventLooprecord componentpayload- the value for thepayloadrecord component
 
 - 
 - 
Method Details
- 
execute
Executes a task on the main thread of the game.The runnable task is protected against exceptions, and any exceptions thrown will be logged.
- Specified by:
 executein interfaceISynchronizedWorkHandler- Parameters:
 task- The task to run.
 - 
submitAsync
Submits the given work to be run synchronously on the main thread of the game.This method will
not be guarded against exceptions.
If you need to guard against exceptions, callCompletableFuture.exceptionally(Function),CompletableFuture.exceptionallyAsync(Function)}, or derivatives on the returned future.- Specified by:
 submitAsyncin interfaceISynchronizedWorkHandler- Parameters:
 task- The task to run.
 - 
submitAsync
Submits the given work to be run synchronously on the main thread of the game.This method will
not be guarded against exceptions.
If you need to guard against exceptions, callCompletableFuture.exceptionally(Function),CompletableFuture.exceptionallyAsync(Function)}, or derivatives on the returned future.- Specified by:
 submitAsyncin interfaceISynchronizedWorkHandler- Parameters:
 task- The task to run.- Returns:
 - A future which will complete when the task has been run.
 
 - 
toString
Returns 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. - 
hashCode
public 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. - 
equals
Indicates 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). - 
eventLoop
Returns the value of theeventLooprecord component.- Returns:
 - the value of the 
eventLooprecord component 
 - 
payload
Returns the value of thepayloadrecord component.- Returns:
 - the value of the 
payloadrecord component 
 
 -