Package net.minecraft.util.thread
Interface MessageListener<Msg>
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
IntegratedServer,MinecraftClient,MinecraftDedicatedServer,MinecraftServer,ReentrantThreadExecutor,ServerChunkManager.MainThreadExecutor,SoundExecutor,TaskExecutor,ThreadExecutor
public interface MessageListener<Msg> extends AutoCloseable
-
Method Summary
Modifier and Type Method Description default <Source> CompletableFuture<Source>ask(Function<? super MessageListener<Source>,? extends Msg> messageProvider)Asks a message provider for a message.default voidclose()static <Msg> MessageListener<Msg>create(String name, Consumer<Msg> action)StringgetName()default <Source> CompletableFuture<Source>method_27918(Function<? super MessageListener<com.mojang.datafixers.util.Either<Source,Exception>>,? extends Msg> function)voidsend(Msg message)
-
Method Details
-
getName
String getName() -
send
-
close
default void close()- Specified by:
closein interfaceAutoCloseable
-
ask
default <Source> CompletableFuture<Source> ask(Function<? super MessageListener<Source>,? extends Msg> messageProvider)Asks a message provider for a message. TheCompletableFuturereturned from this function will never complete exceptionally.- Returns:
- CompletableFuture future that completes with the received message
-
method_27918
default <Source> CompletableFuture<Source> method_27918(Function<? super MessageListener<com.mojang.datafixers.util.Either<Source,Exception>>,? extends Msg> function) -
create
-