Class MultiConnectAPI
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClientboundIdentifierCustomPayloadListener(ICustomPayloadListener<net.minecraft.util.Identifier> listener) Adds a clientboundICustomPayloadListener<Identifier>.voidAdds a clientboundICustomPayloadListener<String>.voidDeprecated.voidaddServerboundIdentifierCustomPayloadListener(ICustomPayloadListener<net.minecraft.util.Identifier> listener) Adds a serverboundICustomPayloadListener<Identifier>.voidDeprecated.voidAdds a serverboundICustomPayloadListener<String>.voidDeprecated.voidDeprecated.byProtocolVersion(int version) Gets a supportedIProtocolobject by its protocol version, ornullif the protocol is not supported<T> booleandoesServerKnow(net.minecraft.util.registry.Registry<T> registry, net.minecraft.util.registry.RegistryKey<T> key) Returns whether the given registry contains the given value on the server.<T> booleandoesServerKnow(net.minecraft.util.registry.Registry<T> registry, T value) Returns whether the given registry contains the given value on the server.voidforceSendCustomPayload(net.minecraft.client.network.ClientPlayNetworkHandler networkHandler, net.minecraft.util.Identifier channel, net.minecraft.network.PacketByteBuf data) By default, multiconnect blocks non-vanilla client-to-server custom payload packets.voidforceSendCustomPayload(net.minecraft.util.Identifier channel, net.minecraft.network.PacketByteBuf data) Deprecated.voidforceSendStringCustomPayload(String channel, net.minecraft.network.PacketByteBuf data) Deprecated.voidforceSendStringCustomPayload(net.minecraft.client.network.ClientPlayNetworkHandler networkHandler, String channel, net.minecraft.network.PacketByteBuf data) By default, multiconnect blocks non-vanilla client-to-server custom payload packets.intGets the protocol version of the server currently connected to, or the current game version if not connected to a serverReturns a list of supported protocols, from newest to oldeststatic MultiConnectAPIinstance()Returns the singleton instance of this APIvoidremoveClientboundIdentifierCustomPayloadListener(ICustomPayloadListener<net.minecraft.util.Identifier> listener) Removes a clientboundICustomPayloadListener<Identifier>.voidRemoves a clientboundICustomPayloadListener<String>.voidDeprecated.voidremoveServerboundIdentifierCustomPayloadListener(ICustomPayloadListener<net.minecraft.util.Identifier> listener) Removes a serverboundICustomPayloadListener<Identifier>.voidDeprecated.voidRemoves a serverboundICustomPayloadListener<String>.voidDeprecated.voidDeprecated.
-
Constructor Details
-
MultiConnectAPI
public MultiConnectAPI()
-
-
Method Details
-
instance
Returns the singleton instance of this API -
getProtocolVersion
Gets the protocol version of the server currently connected to, or the current game version if not connected to a server -
byProtocolVersion
Gets a supportedIProtocolobject by its protocol version, ornullif the protocol is not supported -
getSupportedProtocols
Returns a list of supported protocols, from newest to oldest -
addClientboundIdentifierCustomPayloadListener
public void addClientboundIdentifierCustomPayloadListener(ICustomPayloadListener<net.minecraft.util.Identifier> listener) Adds a clientboundICustomPayloadListener<Identifier>. Adding one of these listeners allows for mods to listen to non-vanillaCustomPayloadS2CPackets sent by servers on older versions. Such packets are blocked by multiconnect from normal handling.This listener is not called for custom payloads from servers on the current version, as multiconnect does not block those. This listener is only called for servers on 1.13 and above; use
addClientboundStringCustomPayloadListener(ICustomPayloadListener)if you want to listen to custom payloads from older servers. -
removeClientboundIdentifierCustomPayloadListener
public void removeClientboundIdentifierCustomPayloadListener(ICustomPayloadListener<net.minecraft.util.Identifier> listener) Removes a clientboundICustomPayloadListener<Identifier>. -
addClientboundStringCustomPayloadListener
Adds a clientboundICustomPayloadListener<String>. Adding one of these listeners allows for mods to listen to non-vanillaCustomPayloadS2CPackets sent by servers on 1.12.2 or below. Such packets are blocked by multiconnect from normal handling.This listener is not called for custom payloads from servers on 1.13 or above. To listen for these custom payloads, use
addClientboundIdentifierCustomPayloadListener(ICustomPayloadListener), or if the server is on the current Minecraft version, simply do it the normal way. -
removeClientboundStringCustomPayloadListener
Removes a clientboundICustomPayloadListener<String>. -
forceSendCustomPayload
@ThreadSafe public void forceSendCustomPayload(net.minecraft.client.network.ClientPlayNetworkHandler networkHandler, net.minecraft.util.Identifier channel, net.minecraft.network.PacketByteBuf data) By default, multiconnect blocks non-vanilla client-to-server custom payload packets. Use this method to send one anyway.- Parameters:
networkHandler- The network handlerchannel- The channel to send data ondata- The data to send
-
forceSendStringCustomPayload
@ThreadSafe public void forceSendStringCustomPayload(net.minecraft.client.network.ClientPlayNetworkHandler networkHandler, String channel, net.minecraft.network.PacketByteBuf data) By default, multiconnect blocks non-vanilla client-to-server custom payload packets. Use this method to send one anyway to a 1.12.2 or below server.- Parameters:
networkHandler- The network handlerchannel- The channel to send data ondata- The data to send
-
addServerboundIdentifierCustomPayloadListener
public void addServerboundIdentifierCustomPayloadListener(ICustomPayloadListener<net.minecraft.util.Identifier> listener) Adds a serverboundICustomPayloadListener<Identifier>. Adding one of these listeners allows for mods to listen to non-vanillaCustomPayloadS2CPackets sent by clientside mods to servers on older versions. Such packets are blocked by multiconnect from being sent.This listener is not called for custom payloads to servers on the current version, as multiconnect does not block those. This listener is only called for servers on 1.13 and above; use
addServerboundStringCustomPayloadListener(ICustomPayloadListener)if you want to listen to custom payloads to older servers. This listener is also not called for custom payloads on vanilla channels, as these are also not blocked by multiconnect. -
removeServerboundIdentifierCustomPayloadListener
public void removeServerboundIdentifierCustomPayloadListener(ICustomPayloadListener<net.minecraft.util.Identifier> listener) Removes a serverboundICustomPayloadListener<Identifier>. -
addServerboundStringCustomPayloadListener
Adds a serverboundICustomPayloadListener<String>. Adding one of these listeners allows for mods to listen to non-vanillaCustomPayloadS2CPackets sent by clientside mods to servers on 1.12.2 or below. Such packets are blocked by multiconnect from being sent.This listener is not called for custom payloads to servers on 1.13 or above. To listen for these custom payloads, use
addServerboundIdentifierCustomPayloadListener(ICustomPayloadListener), or if the server is on the current Minecraft version, simply let the packet be sent the normal way. This listener is also not called for custom payloads on vanilla channels, as these are also not blocked by multiconnect. -
removeServerboundStringCustomPayloadListener
Removes a serverboundICustomPayloadListener<String>. -
doesServerKnow
@ThreadSafe public <T> boolean doesServerKnow(net.minecraft.util.registry.Registry<T> registry, T value) Returns whether the given registry contains the given value on the server. -
doesServerKnow
@ThreadSafe public <T> boolean doesServerKnow(net.minecraft.util.registry.Registry<T> registry, net.minecraft.util.registry.RegistryKey<T> key) Returns whether the given registry contains the given value on the server. -
addIdentifierCustomPayloadListener
@Deprecated public void addIdentifierCustomPayloadListener(IIdentifierCustomPayloadListener listener) Deprecated. -
removeIdentifierCustomPayloadListener
@Deprecated public void removeIdentifierCustomPayloadListener(IIdentifierCustomPayloadListener listener) Deprecated. -
addStringCustomPayloadListener
Deprecated. -
removeStringCustomPayloadListener
Deprecated. -
forceSendCustomPayload
@Deprecated public void forceSendCustomPayload(net.minecraft.util.Identifier channel, net.minecraft.network.PacketByteBuf data) Deprecated.UseforceSendCustomPayload(ClientPlayNetworkHandler, Identifier, PacketByteBuf)instead.MinecraftClient.getInstance().getNetworkHandler()can return null before the game join packet has been received. -
forceSendStringCustomPayload
@Deprecated public void forceSendStringCustomPayload(String channel, net.minecraft.network.PacketByteBuf data) Deprecated.UseforceSendStringCustomPayload(ClientPlayNetworkHandler, String, PacketByteBuf)instead.MinecraftClient.getInstance().getNetworkHandler()can return null before the game join packet has been received. -
addServerboundIdentifierCustomPayloadListener
@Deprecated public void addServerboundIdentifierCustomPayloadListener(IIdentifierCustomPayloadListener listener) Deprecated. -
removeServerboundIdentifierCustomPayloadListener
@Deprecated public void removeServerboundIdentifierCustomPayloadListener(IIdentifierCustomPayloadListener listener) Deprecated. -
addServerboundStringCustomPayloadListener
@Deprecated public void addServerboundStringCustomPayloadListener(IStringCustomPayloadListener listener) Deprecated. -
removeServerboundStringCustomPayloadListener
@Deprecated public void removeServerboundStringCustomPayloadListener(IStringCustomPayloadListener listener) Deprecated.
-
addClientboundIdentifierCustomPayloadListener(ICustomPayloadListener)instead.