Class NetworkHandler

java.lang.Object
me.desht.pneumaticcraft.common.network.NetworkHandler

public class NetworkHandler extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    static <MSG> void
    registerMessage(Class<MSG> messageType, BiConsumer<MSG,net.minecraft.network.FriendlyByteBuf> encoder, Function<net.minecraft.network.FriendlyByteBuf,MSG> decoder, BiConsumer<MSG,Supplier<net.minecraftforge.network.NetworkEvent.Context>> messageConsumer)
     
    static <MSG> void
    registerMessage(Class<MSG> messageType, BiConsumer<MSG,net.minecraft.network.FriendlyByteBuf> encoder, Function<net.minecraft.network.FriendlyByteBuf,MSG> decoder, BiConsumer<MSG,Supplier<net.minecraftforge.network.NetworkEvent.Context>> messageConsumer, net.minecraftforge.network.NetworkDirection direction)
     
    static void
    Send a packet to all non-local players, which is everyone for a dedicated server, and everyone except the server owner for an integrated server.
    static void
    sendNonLocal(net.minecraft.server.level.ServerPlayer player, Object packet)
    Send a packet to the player, unless the player is local (i.e.
    static void
    sendToAll(Object message)
     
    static void
    sendToAllTracking(Object message, net.minecraft.world.entity.Entity entity)
     
    static void
    sendToAllTracking(Object message, net.minecraft.world.level.block.entity.BlockEntity te)
     
    static void
    sendToAllTracking(Object message, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
     
    static void
    sendToDimension(Object message, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> world)
     
    static void
    sendToPlayer(Object message, net.minecraft.server.level.ServerPlayer player)
     
    static void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NetworkHandler

      public NetworkHandler()
  • Method Details

    • init

      public static void init()
    • registerMessage

      public static <MSG> void registerMessage(Class<MSG> messageType, BiConsumer<MSG,net.minecraft.network.FriendlyByteBuf> encoder, Function<net.minecraft.network.FriendlyByteBuf,MSG> decoder, BiConsumer<MSG,Supplier<net.minecraftforge.network.NetworkEvent.Context>> messageConsumer)
    • registerMessage

      public static <MSG> void registerMessage(Class<MSG> messageType, BiConsumer<MSG,net.minecraft.network.FriendlyByteBuf> encoder, Function<net.minecraft.network.FriendlyByteBuf,MSG> decoder, BiConsumer<MSG,Supplier<net.minecraftforge.network.NetworkEvent.Context>> messageConsumer, net.minecraftforge.network.NetworkDirection direction)
    • sendToAll

      public static void sendToAll(Object message)
    • sendToPlayer

      public static void sendToPlayer(Object message, net.minecraft.server.level.ServerPlayer player)
    • sendToAllTracking

      public static void sendToAllTracking(Object message, net.minecraft.world.entity.Entity entity)
    • sendToAllTracking

      public static void sendToAllTracking(Object message, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
    • sendToAllTracking

      public static void sendToAllTracking(Object message, net.minecraft.world.level.block.entity.BlockEntity te)
    • sendToDimension

      public static void sendToDimension(Object message, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> world)
    • sendToServer

      public static void sendToServer(Object message)
    • sendNonLocal

      public static void sendNonLocal(Object packet)
      Send a packet to all non-local players, which is everyone for a dedicated server, and everyone except the server owner for an integrated server.
      Parameters:
      packet - the packet to send
    • sendNonLocal

      public static void sendNonLocal(net.minecraft.server.level.ServerPlayer player, Object packet)
      Send a packet to the player, unless the player is local (i.e. player owner of the integrated server)
      Parameters:
      player - the player
      packet - the packet to send