Class PacketHandler

java.lang.Object
org.cyclops.cyclopscore.network.PacketHandler
All Implemented Interfaces:
org.cyclops.cyclopscore.network.IPacketHandler

@Sharable public final class PacketHandler extends Object implements org.cyclops.cyclopscore.network.IPacketHandler
Advanced packet handler of PacketBase instances.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Deprecated.
    static final record 
    Deprecated.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handlePacketClient(net.neoforged.neoforge.network.handling.IPayloadContext context, org.cyclops.cyclopscore.network.PacketBase packet)
     
    void
    handlePacketServer(net.neoforged.neoforge.network.handling.IPayloadContext context, org.cyclops.cyclopscore.network.PacketBase packet)
     
    protected void
    init(net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent event)
     
    <P extends org.cyclops.cyclopscore.network.PacketBase>
    void
    register(Class<P> clazz, net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<P> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,P> codec)
     
    <P extends org.cyclops.cyclopscore.network.PacketBase>
    void
    register(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<P> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,P> codec)
    Deprecated.
    protected <P extends org.cyclops.cyclopscore.network.PacketBase>
    void
    registerActual(net.neoforged.neoforge.network.registration.PayloadRegistrar registrar, net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<P> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,P> codec)
     
    void
    sendToAll(org.cyclops.cyclopscore.network.PacketBase packet)
     
    void
    sendToAllAround(org.cyclops.cyclopscore.network.PacketBase packet, PacketHandler.TargetPoint point)
    Deprecated.
    void
    sendToAllAroundPoint(org.cyclops.cyclopscore.network.PacketBase packet, org.cyclops.cyclopscore.network.IPacketHandler.TargetPoint point)
     
    void
    sendToDimension(org.cyclops.cyclopscore.network.PacketBase packet, net.minecraft.server.level.ServerLevel dimension)
     
    void
    sendToPlayer(org.cyclops.cyclopscore.network.PacketBase packet, net.minecraft.server.level.ServerPlayer player)
     
    void
    sendToServer(org.cyclops.cyclopscore.network.PacketBase packet)
     

    Methods inherited from class java.lang.Object

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

    • PacketHandler

      public PacketHandler(ModBase mod)
  • Method Details

    • init

      protected void init(net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent event)
    • register

      public <P extends org.cyclops.cyclopscore.network.PacketBase> void register(Class<P> clazz, net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<P> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,P> codec)
      Specified by:
      register in interface org.cyclops.cyclopscore.network.IPacketHandler
    • register

      @Deprecated public <P extends org.cyclops.cyclopscore.network.PacketBase> void register(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<P> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,P> codec)
      Deprecated.
    • registerActual

      protected <P extends org.cyclops.cyclopscore.network.PacketBase> void registerActual(net.neoforged.neoforge.network.registration.PayloadRegistrar registrar, net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<P> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,P> codec)
    • handlePacketClient

      public void handlePacketClient(net.neoforged.neoforge.network.handling.IPayloadContext context, org.cyclops.cyclopscore.network.PacketBase packet)
    • handlePacketServer

      public void handlePacketServer(net.neoforged.neoforge.network.handling.IPayloadContext context, org.cyclops.cyclopscore.network.PacketBase packet)
    • sendToServer

      public void sendToServer(org.cyclops.cyclopscore.network.PacketBase packet)
      Specified by:
      sendToServer in interface org.cyclops.cyclopscore.network.IPacketHandler
    • sendToPlayer

      public void sendToPlayer(org.cyclops.cyclopscore.network.PacketBase packet, net.minecraft.server.level.ServerPlayer player)
      Specified by:
      sendToPlayer in interface org.cyclops.cyclopscore.network.IPacketHandler
    • sendToAllAround

      @Deprecated public void sendToAllAround(org.cyclops.cyclopscore.network.PacketBase packet, PacketHandler.TargetPoint point)
      Deprecated.
      Send a packet to all in the target range.
      Parameters:
      packet - The packet.
      point - The point.
    • sendToAllAroundPoint

      public void sendToAllAroundPoint(org.cyclops.cyclopscore.network.PacketBase packet, org.cyclops.cyclopscore.network.IPacketHandler.TargetPoint point)
      Specified by:
      sendToAllAroundPoint in interface org.cyclops.cyclopscore.network.IPacketHandler
    • sendToDimension

      public void sendToDimension(org.cyclops.cyclopscore.network.PacketBase packet, net.minecraft.server.level.ServerLevel dimension)
      Specified by:
      sendToDimension in interface org.cyclops.cyclopscore.network.IPacketHandler
    • sendToAll

      public void sendToAll(org.cyclops.cyclopscore.network.PacketBase packet)
      Specified by:
      sendToAll in interface org.cyclops.cyclopscore.network.IPacketHandler