Class S2CGrabResultPacket

java.lang.Object
net.timtaran.interactivemc.body.player.packet.HandInteractionPacket
net.timtaran.interactivemc.body.player.packet.S2CGrabResultPacket
All Implemented Interfaces:
net.xmx.velthoric.network.IVxNetPacket

public class S2CGrabResultPacket extends HandInteractionPacket
Server-to-Client packet containing the result of a grab action.

This packet is sent from the server in response to a C2SGrabPacket, containing the UUID of the successfully grabbed body or null if the grab failed.

  • Constructor Details

    • S2CGrabResultPacket

      public S2CGrabResultPacket(PlayerBodyPart playerBodyPart, @Nullable @Nullable UUID grabbedBodyUUID, boolean isAttached)
      Constructs a new grab result packet.
      Parameters:
      playerBodyPart - the body part that performed the grab
      grabbedBodyUUID - the UUID of the grabbed body, or null if grab failed
  • Method Details

    • decode

      public static S2CGrabResultPacket decode(net.xmx.velthoric.network.VxByteBuf buf)
      Decodes a grab result packet from a network buffer.
      Parameters:
      buf - the buffer to read from
      Returns:
      a new instance of the grab result packet
    • encode

      public void encode(net.xmx.velthoric.network.VxByteBuf buf)
      Encodes the packet data into a network buffer.
      Specified by:
      encode in interface net.xmx.velthoric.network.IVxNetPacket
      Overrides:
      encode in class HandInteractionPacket
      Parameters:
      buf - the buffer to write to
    • getGrabbedBodyUUID

      @Nullable public @Nullable UUID getGrabbedBodyUUID()
    • handle

      public void handle(dev.architectury.networking.NetworkManager.PacketContext context)
      Handles the grab result on the client side.

      Updates the client-side data store with the UUID of the grabbed body.

      Parameters:
      context - the packet context containing the player and network info