Class PlayerPositionPacket

Direct Known Subclasses:
RingOfFirePacket

public abstract class PlayerPositionPacket extends PacketCodec
An abstract superclass for all packets that contain the position and uuid of a player and execute a specific action on the client side that is visible by all players in a specific range around the given player.
  • Field Details

    • uuid

      protected String uuid
    • position

      protected net.minecraft.world.phys.Vec3 position
  • Constructor Details

    • PlayerPositionPacket

      public PlayerPositionPacket()
      Creates a packet with no content
    • PlayerPositionPacket

      public PlayerPositionPacket(net.minecraft.world.entity.player.Player player)
      Creates a PlayerPositionPacket which contains the player data.
      Parameters:
      player - The player data.
    • PlayerPositionPacket

      public PlayerPositionPacket(net.minecraft.world.entity.player.Player player, int range)
      Creates a PlayerPositionPacket which contains the player data and will be sent to all players in the specified range of the player.
      Parameters:
      player - The player data.
      range - The range around the player.
  • Method Details

    • isAsync

      public boolean isAsync()
      Specified by:
      isAsync in class PacketBase
      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.
    • actionClient

      public void actionClient(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player)
      Description copied from class: PacketBase
      Actions for client-side.
      Specified by:
      actionClient in class PacketBase
      Parameters:
      level - The world.
      player - The player. Can be null if this packet is asynchronous.
    • actionServer

      public void actionServer(net.minecraft.world.level.Level level, net.minecraft.server.level.ServerPlayer player)
      Description copied from class: PacketBase
      Actions for server-side.
      Specified by:
      actionServer in class PacketBase
      Parameters:
      level - The world.
      player - The player.
    • create

      protected abstract PlayerPositionPacket create(net.minecraft.world.entity.player.Player player, int range)
    • getModInstance

      protected abstract ModBase getModInstance()
    • performClientAction

      protected abstract void performClientAction(net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player)