Interface FabricNetwork<N,DIR>
- All Superinterfaces:
mods.thecomputerizer.theimpossiblelibrary.api.network.NetworkAPI<N,DIR>
public interface FabricNetwork<N,DIR>
extends mods.thecomputerizer.theimpossiblelibrary.api.network.NetworkAPI<N,DIR>
Abusing interfaces to abstract the hell out of fabric network stuff
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Objectstatic final Objectstatic final Stringstatic final Class<?> static final Stringstatic final Class<?> static final Stringstatic final Class<?> static final Class<?> static final Stringstatic final Class<?> static final Class<?> static final Objectstatic final Objectstatic final net.minecraft.nbt.NbtAccounterstatic final mods.thecomputerizer.theimpossiblelibrary.api.wrappers.MutableWrapped<Class<?>> -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic booleandefault @Nullable ObjectcreateHandlerProxy(DIR dir, boolean newType) default @Nullable ObjectcreateHandlerProxy(Object dir, boolean newType, boolean client, @Nullable Class<?> c) default InvocationHandlercreateInvoker(Object dir, boolean client, Class<?> c) default InvocationHandlercreateInvokerCustomPayload(Object dir, boolean client, Class<?> c) Network registration stuff is a bit different in 1.20.6+ and needs a different InvocationHandlerdefault net.minecraft.network.FriendlyByteBufencodeMessage(mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?, ?> message) static Stringdefault DIRgetCheckedDir(mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageDirectionInfo<DIR> info) Unwraps MessageDirectionInfo with checks to ensure it is able to get unwrapped on the current sidestatic @Nullable Class<?> getClassIfClient(String className) default DIRgetDirFromName(String name) default DIRdefault DIRdefault DIRdefault DIRstatic @Nullable Class<?> getHandlerClassIfClient(String baseClass, String oldHandler, String newHandler) default StringgetNameFromDir(DIR dir) default Ndefault DIRgetOppositeDir(DIR dir) default net.minecraft.resources.ResourceLocationgetRegistryName(mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?, ?> message) default net.minecraft.resources.ResourceLocationstatic @Nullable ObjectgetStaticField(@Nullable Class<?> c, String fieldName) default <CTX> mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?, CTX> getWrapper(Object dir) static Class<?> static Class<?> initWrapperClass(mods.thecomputerizer.theimpossiblelibrary.api.core.CoreAPI core) default booleanisDirLogin(DIR dir) default booleanisDirToClient(DIR dir) default mods.thecomputerizer.theimpossiblelibrary.api.resource.ResourceLocationAPI<?> readResourceLocation(io.netty.buffer.ByteBuf buf) default mods.thecomputerizer.theimpossiblelibrary.api.tag.CompoundTagAPI<?> readTag(io.netty.buffer.ByteBuf buf) default <P, CTX, M extends mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<P,CTX>>
voidreceiveAndRespond(Object dir, Object buf, CTX ctx, P player) default <P, CTX, M extends mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<P,CTX>>
voidreceiveAndRespond(M wrapper, CTX ctx, P player) default voidregisterMessage(mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageDirectionInfo<DIR> directionInfo, int id) default voidregisterMessageCustomPayload(mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageDirectionInfo<DIR> directionInfo, Function<DIR, Object> codecBuilder) Network registration stuff is a bit different in 1.20.6+ and needs to be handled separatelydefault booleanregisterWithProxy(boolean client, Object registerAs, Object proxy) default <P, M extends mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?,?>>
voidsendToPlayer(M message, P player) default <P, M extends mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?,?>>
voidsendToPlayer(M message, P player, boolean newType) default <M extends mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?,?>>
voidsendToServer(M message) default <M extends mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?,?>>
voidsendToServer(M message, boolean newType) static @Nullable Class<?> tryGetClass(String className) The class might not existstatic @Nullable Class<?> tryGetHandlerClass(String baseClass, String oldHandler, String newHandler) static net.minecraft.nbt.NbtAccounterdefault <CTX> mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?, CTX> wrapMessage(DIR dir, mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageAPI<CTX> message) default <CTX> mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?, CTX> wrapMessages(DIR dir, Collection<mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageAPI<CTX>> messages) default <CTX> mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?, CTX> wrapMessages(DIR dir, mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageAPI<CTX>... messages) default voidwriteTag(io.netty.buffer.ByteBuf buf, mods.thecomputerizer.theimpossiblelibrary.api.tag.CompoundTagAPI<?> tag)
-
Field Details
-
IMPL_CLIENT
-
IMPL_CLIENT_CLASS
-
IMPL_SERVER
-
IMPL_SERVER_CLASS
-
CLIENT_LOGIN
-
CLIENT_PLAY
-
PLAY_CLIENT
-
PLAY_CLIENT_CLASS
-
PLAY_CLIENT_HANDLER_CLASS
-
PROXY_MAP
-
PLAY_SERVER
-
PLAY_SERVER_CLASS
-
PLAY_SERVER_HANDLER_CLASS
-
SERVER_LOGIN
-
SERVER_PLAY
-
UNLIMITED_ACCOUNTER
static final net.minecraft.nbt.NbtAccounter UNLIMITED_ACCOUNTER -
WRAPPED_WRAPPER_CLASS
static final mods.thecomputerizer.theimpossiblelibrary.api.wrappers.MutableWrapped<Class<?>> WRAPPED_WRAPPER_CLASS
-
-
Method Details
-
atLeastV20_4
static boolean atLeastV20_4() -
atLeastV20_6
static boolean atLeastV20_6() -
fabricPkg
-
getClassIfClient
-
getHandlerClassIfClient
-
getStaticField
-
getWrapperClass
-
initWrapperClass
-
tryGetClass
-
tryGetHandlerClass
-
unlimitedAccounter
static net.minecraft.nbt.NbtAccounter unlimitedAccounter() -
createHandlerProxy
-
createHandlerProxy
-
createInvoker
-
createInvokerCustomPayload
Network registration stuff is a bit different in 1.20.6+ and needs a different InvocationHandler -
encodeMessage
default net.minecraft.network.FriendlyByteBuf encodeMessage(mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?, ?> message) -
getCheckedDir
-
getDirFromName
-
getDirToClient
-
getDirToClientLogin
-
getDirToServer
-
getDirToServerLogin
-
getNameFromDir
-
getNetwork
-
getOppositeDir
-
getRegistryName
default net.minecraft.resources.ResourceLocation getRegistryName(mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?, ?> message) -
getRegistryNameFromDir
-
getWrapper
default <CTX> mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?,CTX> getWrapper(Object dir) -
isDirToClient
-
isDirLogin
-
readResourceLocation
-
readTag
-
receiveAndRespond
-
receiveAndRespond
default <P, CTX, M extends mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<P,CTX>> void receiveAndRespond(M wrapper, CTX ctx, @Nullable P player) -
registerMessage
-
registerMessageCustomPayload
-
registerWithProxy
-
sendToPlayer
-
sendToPlayer
default <P, M extends mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?,?>> void sendToPlayer(M message, P player, boolean newType) -
sendToServer
-
sendToServer
default <M extends mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?,?>> void sendToServer(M message, boolean newType) -
wrapMessage
default <CTX> mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?,CTX> wrapMessage(DIR dir, mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageAPI<CTX> message) -
wrapMessages
default <CTX> mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?,CTX> wrapMessages(DIR dir, mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageAPI<CTX>... messages) -
wrapMessages
default <CTX> mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageWrapperAPI<?,CTX> wrapMessages(DIR dir, Collection<mods.thecomputerizer.theimpossiblelibrary.api.network.message.MessageAPI<CTX>> messages) -
writeTag
-