Class C2SGrabPacket
java.lang.Object
net.timtaran.interactivemc.network.sync.packet.HandInteractionPacket
net.timtaran.interactivemc.network.sync.packet.C2SGrabPacket
- All Implemented Interfaces:
net.xmx.velthoric.network.IVxNetPacket
Client-to-Server packet requesting a grab action.
This packet is sent from the client when a player attempts to grab an object
using their specified hand. The server processes this request and sends back
a S2CGrabResultPacket with the result.
-
Constructor Summary
ConstructorsConstructorDescriptionC2SGrabPacket(net.minecraft.world.InteractionHand interactionHand) Constructs a new grab request packet. -
Method Summary
Modifier and TypeMethodDescriptionstatic C2SGrabPacketdecode(net.minecraft.network.FriendlyByteBuf buf) Decodes a grab packet from a network buffer.voidhandle(dev.architectury.networking.NetworkManager.PacketContext context) Handles the grab request on the server side.Methods inherited from class net.timtaran.interactivemc.network.sync.packet.HandInteractionPacket
encode, getInteractionHand
-
Constructor Details
-
C2SGrabPacket
public C2SGrabPacket(net.minecraft.world.InteractionHand interactionHand) Constructs a new grab request packet.- Parameters:
interactionHand- the hand attempting to grab
-
-
Method Details
-
decode
Decodes a grab packet from a network buffer.- Parameters:
buf- the buffer to read from- Returns:
- a new instance of the grab packet
-
handle
public void handle(dev.architectury.networking.NetworkManager.PacketContext context) Handles the grab request on the server side.This method executes on the physics world thread to ensure thread safety, then sends the result back to the client.
- Parameters:
context- the packet context containing the player and network info
-