Class NetworkHooks
java.lang.Object
net.minecraftforge.fmllegacy.network.NetworkHooks
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FMLConnectionDatagetConnectionData(Connection mgr)private static ConnectionTypegetConnectionType(io.netty.channel.Channel channel)static ConnectionTypegetConnectionType(io.netty.channel.ChannelHandlerContext context)static ConnectionTypegetConnectionType(Supplier<Connection> connection)static Packet<?>getEntitySpawningPacket(Entity entity)static StringgetFMLVersion(String ip)static voidhandleClientLoginSuccess(Connection manager)static booleanisVanillaConnection(Connection manager)static booleanonCustomPayload(ICustomPacket<?> packet, Connection manager)static voidopenGui(ServerPlayer player, MenuProvider containerSupplier)Request to open a GUI on the client, from the server Refer toConfigGuiHandler.ConfigGuiFactoryfor how to provide a function to consume these GUI requests on the client.static voidopenGui(ServerPlayer player, MenuProvider containerSupplier, Consumer<FriendlyByteBuf> extraDataWriter)Request to open a GUI on the client, from the server Refer toConfigGuiHandler.ConfigGuiFactoryfor how to provide a function to consume these GUI requests on the client.static voidopenGui(ServerPlayer player, MenuProvider containerSupplier, BlockPos pos)Request to open a GUI on the client, from the server Refer toConfigGuiHandler.ConfigGuiFactoryfor how to provide a function to consume these GUI requests on the client.static voidregisterClientLoginChannel(Connection manager)static voidregisterServerLoginChannel(Connection manager, ClientIntentionPacket packet)static voidsendMCRegistryPackets(Connection manager, String direction)static booleantickNegotiation(ServerLoginPacketListenerImpl netHandlerLoginServer, Connection networkManager, ServerPlayer player)static voidvalidatePacketDirection(NetworkDirection packetDirection, Optional<NetworkDirection> expectedDirection, Connection connection)private static booleanvalidateSideForProcessing(ICustomPacket<?> packet, NetworkInstance ni, Connection manager)
-
Field Details
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER
-
-
Constructor Details
-
NetworkHooks
public NetworkHooks()
-
-
Method Details
-
getFMLVersion
-
getConnectionType
-
getConnectionType
-
getConnectionType
-
getEntitySpawningPacket
-
onCustomPayload
-
validateSideForProcessing
private static boolean validateSideForProcessing(ICustomPacket<?> packet, NetworkInstance ni, Connection manager) -
validatePacketDirection
public static void validatePacketDirection(NetworkDirection packetDirection, Optional<NetworkDirection> expectedDirection, Connection connection) -
registerServerLoginChannel
-
registerClientLoginChannel
-
sendMCRegistryPackets
-
isVanillaConnection
-
handleClientLoginSuccess
-
tickNegotiation
public static boolean tickNegotiation(ServerLoginPacketListenerImpl netHandlerLoginServer, Connection networkManager, ServerPlayer player) -
openGui
Request to open a GUI on the client, from the server Refer toConfigGuiHandler.ConfigGuiFactoryfor how to provide a function to consume these GUI requests on the client.- Parameters:
player- The player to open the GUI forcontainerSupplier- A supplier of container properties including the registry name of the container
-
openGui
Request to open a GUI on the client, from the server Refer toConfigGuiHandler.ConfigGuiFactoryfor how to provide a function to consume these GUI requests on the client.- Parameters:
player- The player to open the GUI forcontainerSupplier- A supplier of container properties including the registry name of the containerpos- A block pos, which will be encoded into the auxillary data for this request
-
openGui
public static void openGui(ServerPlayer player, MenuProvider containerSupplier, Consumer<FriendlyByteBuf> extraDataWriter)Request to open a GUI on the client, from the server Refer toConfigGuiHandler.ConfigGuiFactoryfor how to provide a function to consume these GUI requests on the client. The maximum size for #extraDataWriter is 32600 bytes.- Parameters:
player- The player to open the GUI forcontainerSupplier- A supplier of container properties including the registry name of the containerextraDataWriter- Consumer to write any additional data the GUI needs
-
getConnectionData
-