Class PacketBase

java.lang.Object
org.cyclops.cyclopscore.network.PacketBase
Direct Known Subclasses:
PacketCodec

public abstract class PacketBase extends Object
The base packet for packets. All packets must have a default constructor.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    actionClient(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player)
    Actions for client-side.
    abstract void
    actionServer(net.minecraft.world.level.Level level, net.minecraft.server.level.ServerPlayer player)
    Actions for server-side.
    abstract void
    decode(net.minecraft.network.FriendlyByteBuf input)
    Decode for this packet.
    abstract void
    encode(net.minecraft.network.FriendlyByteBuf output)
    Encode this packet.
    abstract boolean
     

    Methods inherited from class java.lang.Object

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

    • PacketBase

      public PacketBase()
  • Method Details

    • isAsync

      public abstract boolean isAsync()
      Returns:
      If this packet can run on a thread other than the main-thread of Minecraft. If this is asynchronous, the player parameter inside the action is not guaranteed to be defined.
    • encode

      public abstract void encode(net.minecraft.network.FriendlyByteBuf output)
      Encode this packet.
      Parameters:
      output - The byte array to encode to.
    • decode

      public abstract void decode(net.minecraft.network.FriendlyByteBuf input)
      Decode for this packet.
      Parameters:
      input - The byte array to decode from.
    • actionClient

      public abstract void actionClient(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player)
      Actions for client-side.
      Parameters:
      level - The world.
      player - The player. Can be null if this packet is asynchronous.
    • actionServer

      public abstract void actionServer(net.minecraft.world.level.Level level, net.minecraft.server.level.ServerPlayer player)
      Actions for server-side.
      Parameters:
      level - The world.
      player - The player.