Class AbstractTCGPacket

java.lang.Object
com.pixelmonmod.tcg.network.data.AbstractTCGPacket
All Implemented Interfaces:
TCGPacket
Direct Known Subclasses:
BattleSpectatorUpdatePacket, CardBackSyncPacket, CardSelectorToServerPacket, CardSyncPacket, CoinFlipAckPacket, CoinSyncPacket, CustomGUIChoiceToServerPacket, EndGamePacket, ForceEndBattlePacket, GameStateSyncPacket, GenericActionRequestPacket, GenericGUIPacket, OpenBinderPacket, OpenPackGuiPacket, OpenPackPacket, PackSyncPacket, PrizeSelectorToClientPacket, PrizeSelectorToServerPacket, RenderStatePreBattleSyncPacket, RenderStateSyncPacket, RetreatAndSwitchPacket, RulebookUpdatePacket, ShowOpponentCardPacket, SwitchPacket, SyncCardSetsPacket, SyncCardsPacket, SyncThemeDecksPacket, TCGGuiClientPacket, TrainerPlayedPacket, UpdateServerCardRecordPacket

public abstract class AbstractTCGPacket extends Object implements TCGPacket
Abstract implementation of the TCGPacket interface. It abstracts the process of checking if the method should be run on the main Minecraft server Thread. It also abstracts the process of performing safety checks depending on the enviroment it's being executed in (i.e. DistExecutor.unsafeRunWhenOn(Dist, Supplier)
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractTCGPacket(boolean sync)
     
     
    AbstractTCGPacket(PacketDirection direction, boolean sync)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    decode(net.minecraft.network.FriendlyByteBuf buffer)
    Decodes the information from the buffer to the packet instance
    void
    encode(net.minecraft.network.FriendlyByteBuf buffer)
    Encodes the buffer with the packet information
    void
    handle(net.minecraftforge.event.network.CustomPayloadEvent.Context context)
    Handles the packet being executed on the server or the client
    protected abstract void
    handlePacket(net.minecraftforge.event.network.CustomPayloadEvent.Context context)
     
    protected void
    reply(net.minecraftforge.event.network.CustomPayloadEvent.Context context, Object packet)
    Abstracted method for replying to the received packet

    Methods inherited from class java.lang.Object

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

    • AbstractTCGPacket

      public AbstractTCGPacket(PacketDirection direction)
    • AbstractTCGPacket

      public AbstractTCGPacket(PacketDirection direction, boolean sync)
    • AbstractTCGPacket

      public AbstractTCGPacket(boolean sync)
  • Method Details

    • encode

      public void encode(net.minecraft.network.FriendlyByteBuf buffer)
      Description copied from interface: TCGPacket
      Encodes the buffer with the packet information
      Specified by:
      encode in interface TCGPacket
      Parameters:
      buffer - The buffer being encoded
    • decode

      public void decode(net.minecraft.network.FriendlyByteBuf buffer)
      Description copied from interface: TCGPacket
      Decodes the information from the buffer to the packet instance
      Specified by:
      decode in interface TCGPacket
      Parameters:
      buffer - The buffer being decoded
    • handle

      public void handle(net.minecraftforge.event.network.CustomPayloadEvent.Context context)
      Description copied from interface: TCGPacket
      Handles the packet being executed on the server or the client
      Specified by:
      handle in interface TCGPacket
      Parameters:
      context - The network event context being supplied by Forge
    • handlePacket

      protected abstract void handlePacket(net.minecraftforge.event.network.CustomPayloadEvent.Context context)
    • reply

      protected void reply(net.minecraftforge.event.network.CustomPayloadEvent.Context context, Object packet)
      Abstracted method for replying to the received packet
      Parameters:
      context - The context of the packet
      packet - The packet to reply with