public abstract class MessageWrapperAPI<PLAYER,CTX> extends java.lang.Object implements CoreStateAccessor
| Modifier and Type | Class and Description |
|---|---|
static class |
MessageWrapperAPI.Client<PLAYER,CTX>
Sent from the server during gameplay
Received on the client during gameplay
|
static class |
MessageWrapperAPI.ClientLogin<PLAYER,CTX>
Sent from the server during login
Received on the client during login
|
static class |
MessageWrapperAPI.Server<PLAYER,CTX>
Sent from the client during gameplay
Received on the server during gameplay
|
static class |
MessageWrapperAPI.ServerLogin<PLAYER,CTX>
Sent from the client during login
Received on the server during login
|
| Modifier and Type | Field and Description |
|---|---|
protected MessageDirectionInfo<?> |
info |
BOOLEAN_VALUES, FABRIC, FORGE, FORGE_OR_NEOFORGE, GAME_VERSION, JAVA_17, JAVA_21, JAVA_8, JAVA_MODULES, JAVA_VERSION, JAVA_VERSION_ASM, LEGACY, MOD_LOADER, NAMED_ENV, NEOFORGE, SRG_ENV, V12, V16, V16_OR_EARLIER, V16_OR_LATER, V18, V18_OR_EARLIER, V18_OR_LATER, V19, V19_2_OR_EARLIER, V19_4_OR_LATER, V19_OR_EARLIER, V19_OR_LATER, V20, V20_4_OR_EARLIER, V20_6_OR_LATER, V20_OR_EARLIER, V20_OR_LATER, V21, V21_OR_LATER| Modifier | Constructor and Description |
|---|---|
protected |
MessageWrapperAPI() |
protected |
MessageWrapperAPI(io.netty.buffer.ByteBuf buf) |
| Modifier and Type | Method and Description |
|---|---|
static <DIR> DIR |
classToDir(java.lang.Class<?> msgCls) |
void |
decode(io.netty.buffer.ByteBuf buf)
In the case of a decoding failure we can't easily determine how to allocate the rest of the buffer.
|
protected @Nullable MessageAPI<CTX> |
decodeMessage(io.netty.buffer.ByteBuf buf,
java.util.concurrent.atomic.AtomicBoolean failure) |
protected @Nullable MessageAPI<CTX> |
decodeMessage(io.netty.buffer.ByteBuf buf,
java.lang.Class<?> msgClass,
java.util.concurrent.atomic.AtomicBoolean failure) |
static <P,C,B extends io.netty.buffer.ByteBuf> |
decoder(java.lang.Class<?> msgClass) |
static <DIR,P,C,B extends io.netty.buffer.ByteBuf> |
decoder(MessageDirectionInfo<DIR> dir) |
protected java.lang.String |
dirName() |
void |
disableDebug() |
void |
enableDebug() |
void |
encode(io.netty.buffer.ByteBuf buf) |
static <P,C,B extends io.netty.buffer.ByteBuf> |
encoder() |
static <DIR,P,C> java.lang.Class<MessageWrapperAPI<P,C>> |
getClass(DIR dir) |
static <DIR,P,C> java.lang.Class<MessageWrapperAPI<P,C>> |
getClass(MessageDirectionInfo<DIR> dir) |
protected <DIR> DIR |
getDir()
Get the current network direction from the info field or null if the field is not set
|
static <DIR,P,C> MessageWrapperAPI<P,C> |
getInstance(DIR dir) |
static <DIR,P,C,B extends io.netty.buffer.ByteBuf> |
getInstance(DIR dir,
B buf) |
static <DIR,P,C> MessageWrapperAPI<P,C> |
getInstance(MessageDirectionInfo<DIR> dir) |
static <DIR,P,C,B extends io.netty.buffer.ByteBuf> |
getInstance(MessageDirectionInfo<DIR> dir,
B buf) |
protected @Nullable java.util.Collection<java.lang.Class<?>> |
getMissingDecoders()
Expose missing decoder collection to subclasses
|
protected <DIR> DIR |
getOppositeDir()
Get the opposite of the current network direction from the info field or null if the field is not set
|
protected java.util.Collection<java.lang.Class<?>> |
getOrInitMissingDecoders()
Expose missing decoder collection to subclasses
|
@Nullable MessageWrapperAPI<PLAYER,CTX> |
handle(CTX context) |
static <DIR,P,C,S> |
handler(DIR dir,
java.util.function.Function<S,C> contextGetter,
java.util.function.Function<C,P> playerGetter) |
static <DIR,P,C,S> |
handler(MessageDirectionInfo<DIR> dir,
java.util.function.Function<S,C> contextGetter,
java.util.function.Function<C,P> playerGetter) |
protected java.util.Collection<java.lang.Class<?>> |
initMissingDecoderCollection()
Extensible for subclasses
|
static <DIR,P,C,B extends io.netty.buffer.ByteBuf> |
innerDecoder(DIR dir) |
protected void |
markFoundMissingDecoder(java.lang.Class<?> msgClass) |
protected void |
markMissingDecoder(java.lang.Class<?> msgClass,
io.netty.buffer.ByteBuf buf,
java.util.concurrent.atomic.AtomicBoolean decodingFailure) |
void |
send() |
<DIR> MessageWrapperAPI<PLAYER,CTX> |
setMessage(DIR dir,
MessageAPI<CTX> message) |
<DIR> MessageWrapperAPI<PLAYER,CTX> |
setMessages(DIR dir,
java.util.Collection<MessageAPI<CTX>> messages) |
<DIR> MessageWrapperAPI<PLAYER,CTX> |
setMessages(DIR dir,
MessageAPI<CTX>... messages) |
MessageWrapperAPI<PLAYER,CTX> |
setPlayer(PLAYER player) |
MessageWrapperAPI<PLAYER,CTX> |
setPlayers(java.util.Collection<PLAYER> players) |
MessageWrapperAPI<PLAYER,CTX> |
setPlayers(PLAYER... players) |
protected MessageDirectionInfo<?> info
protected MessageWrapperAPI()
protected MessageWrapperAPI(io.netty.buffer.ByteBuf buf)
public static <DIR> DIR classToDir(java.lang.Class<?> msgCls)
@NotNull public static <DIR,P,C,B extends io.netty.buffer.ByteBuf> @NotNull java.util.function.Function<B,MessageWrapperAPI<P,C>> decoder(MessageDirectionInfo<DIR> dir)
@NotNull public static <P,C,B extends io.netty.buffer.ByteBuf> @NotNull java.util.function.Function<B,MessageWrapperAPI<P,C>> decoder(java.lang.Class<?> msgClass)
@NotNull public static <P,C,B extends io.netty.buffer.ByteBuf> @NotNull java.util.function.BiConsumer<MessageWrapperAPI<P,C>,B> encoder()
public static <DIR,P,C> java.lang.Class<MessageWrapperAPI<P,C>> getClass(MessageDirectionInfo<DIR> dir)
public static <DIR,P,C> java.lang.Class<MessageWrapperAPI<P,C>> getClass(DIR dir)
public static <DIR,P,C> MessageWrapperAPI<P,C> getInstance(MessageDirectionInfo<DIR> dir)
public static <DIR,P,C> MessageWrapperAPI<P,C> getInstance(DIR dir)
public static <DIR,P,C,B extends io.netty.buffer.ByteBuf> MessageWrapperAPI<P,C> getInstance(MessageDirectionInfo<DIR> dir, B buf)
public static <DIR,P,C,B extends io.netty.buffer.ByteBuf> MessageWrapperAPI<P,C> getInstance(DIR dir, B buf)
@NotNull public static <DIR,P,C,S> @NotNull java.util.function.BiConsumer<MessageWrapperAPI<P,C>,S> handler(MessageDirectionInfo<DIR> dir, java.util.function.Function<S,C> contextGetter, java.util.function.Function<C,P> playerGetter)
@NotNull public static <DIR,P,C,S> @NotNull java.util.function.BiConsumer<MessageWrapperAPI<P,C>,S> handler(DIR dir, java.util.function.Function<S,C> contextGetter, java.util.function.Function<C,P> playerGetter)
@NotNull public static <DIR,P,C,B extends io.netty.buffer.ByteBuf> @NotNull java.util.function.Function<B,MessageWrapperAPI<P,C>> innerDecoder(DIR dir)
public void decode(io.netty.buffer.ByteBuf buf)
@Nullable protected @Nullable MessageAPI<CTX> decodeMessage(io.netty.buffer.ByteBuf buf, java.util.concurrent.atomic.AtomicBoolean failure)
@Nullable protected @Nullable MessageAPI<CTX> decodeMessage(io.netty.buffer.ByteBuf buf, java.lang.Class<?> msgClass, java.util.concurrent.atomic.AtomicBoolean failure)
protected java.lang.String dirName()
public void disableDebug()
public void enableDebug()
public void encode(io.netty.buffer.ByteBuf buf)
@Nullable protected <DIR> DIR getDir()
@Nullable protected @Nullable java.util.Collection<java.lang.Class<?>> getMissingDecoders()
@Nullable protected <DIR> DIR getOppositeDir()
protected java.util.Collection<java.lang.Class<?>> getOrInitMissingDecoders()
@Nullable public @Nullable MessageWrapperAPI<PLAYER,CTX> handle(CTX context)
protected java.util.Collection<java.lang.Class<?>> initMissingDecoderCollection()
protected void markFoundMissingDecoder(java.lang.Class<?> msgClass)
protected void markMissingDecoder(java.lang.Class<?> msgClass,
io.netty.buffer.ByteBuf buf,
java.util.concurrent.atomic.AtomicBoolean decodingFailure)
public void send()
public <DIR> MessageWrapperAPI<PLAYER,CTX> setMessage(DIR dir, MessageAPI<CTX> message)
@SafeVarargs public final <DIR> MessageWrapperAPI<PLAYER,CTX> setMessages(DIR dir, MessageAPI<CTX>... messages)
public <DIR> MessageWrapperAPI<PLAYER,CTX> setMessages(DIR dir, java.util.Collection<MessageAPI<CTX>> messages)
public MessageWrapperAPI<PLAYER,CTX> setPlayer(PLAYER player)
@SafeVarargs public final MessageWrapperAPI<PLAYER,CTX> setPlayers(PLAYER... players)
public MessageWrapperAPI<PLAYER,CTX> setPlayers(java.util.Collection<PLAYER> players)