Class NetworkHooks

java.lang.Object
net.minecraftforge.network.NetworkHooks

public class NetworkHooks extends Object
  • Field Details

    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
  • Constructor Details

    • NetworkHooks

      public NetworkHooks()
  • Method Details

    • getFMLVersion

      public static String getFMLVersion(String ip)
    • getConnectionType

      public static ConnectionType getConnectionType(Supplier<Connection> connection)
    • getConnectionType

      public static ConnectionType getConnectionType(io.netty.channel.ChannelHandlerContext context)
    • getConnectionType

      private static ConnectionType getConnectionType(io.netty.channel.Channel channel)
    • getEntitySpawningPacket

      public static Packet<ClientGamePacketListener> getEntitySpawningPacket(Entity entity)
    • onCustomPayload

      public static boolean onCustomPayload(ICustomPacket<?> packet, Connection manager)
    • validateSideForProcessing

      private static boolean validateSideForProcessing(ICustomPacket<?> packet, NetworkInstance ni, Connection manager)
    • validatePacketDirection

      public static void validatePacketDirection(NetworkDirection packetDirection, Optional<NetworkDirection> expectedDirection, Connection connection)
    • registerServerLoginChannel

      public static void registerServerLoginChannel(Connection manager, ClientIntentionPacket packet)
    • registerClientLoginChannel

      public static void registerClientLoginChannel(Connection manager)
    • sendMCRegistryPackets

      public static void sendMCRegistryPackets(Connection manager, String direction)
    • isVanillaConnection

      public static boolean isVanillaConnection(Connection manager)
    • handleClientLoginSuccess

      public static void handleClientLoginSuccess(Connection manager)
    • tickNegotiation

      public static boolean tickNegotiation(ServerLoginPacketListenerImpl netHandlerLoginServer, Connection networkManager, ServerPlayer player)
    • openScreen

      public static void openScreen(ServerPlayer player, MenuProvider containerSupplier)
      Request to open a GUI on the client, from the server Refer to ConfigScreenHandler.ConfigScreenFactory for how to provide a function to consume these GUI requests on the client.
      Parameters:
      player - The player to open the GUI for
      containerSupplier - A supplier of container properties including the registry name of the container
    • openScreen

      public static void openScreen(ServerPlayer player, MenuProvider containerSupplier, BlockPos pos)
      Request to open a GUI on the client, from the server Refer to ConfigScreenHandler.ConfigScreenFactory for how to provide a function to consume these GUI requests on the client.
      Parameters:
      player - The player to open the GUI for
      containerSupplier - A supplier of container properties including the registry name of the container
      pos - A block pos, which will be encoded into the auxillary data for this request
    • openScreen

      public static void openScreen(ServerPlayer player, MenuProvider containerSupplier, Consumer<FriendlyByteBuf> extraDataWriter)
      Request to open a GUI on the client, from the server Refer to ConfigScreenHandler.ConfigScreenFactory for 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 for
      containerSupplier - A supplier of container properties including the registry name of the container
      extraDataWriter - Consumer to write any additional data the GUI needs
    • appendConnectionData

      static void appendConnectionData(Connection mgr, Map<String,org.apache.commons.lang3.tuple.Pair<String,String>> modData, Map<ResourceLocation,String> channels)
      Updates the current ConnectionData instance with new mod or channel data if the old instance did not have either of these yet, or creates a new ConnectionData instance with the new data if the current ConnectionData instance doesn't exist yet.
    • getConnectionData

      @Nullable public static @Nullable ConnectionData getConnectionData(Connection mgr)
    • getModMismatchData

      @Nullable public static @Nullable ConnectionData.ModMismatchData getModMismatchData(Connection mgr)
    • getChannelList

      @Nullable public static MCRegisterPacketHandler.ChannelList getChannelList(Connection mgr)