mirror of
https://github.com/ammaraskar/pyCraft.git
synced 2024-12-23 09:08:36 +01:00
Add Use Item packet
This commit is contained in:
parent
e21c0d877f
commit
bea661860d
@ -21,6 +21,7 @@ def get_packets(context):
|
||||
ClientSettingsPacket,
|
||||
PluginMessagePacket,
|
||||
PlayerBlockPlacementPacket,
|
||||
UseItemPacket,
|
||||
}
|
||||
if context.protocol_version >= 107:
|
||||
packets |= {
|
||||
@ -197,3 +198,22 @@ class PlayerBlockPlacementPacket(Packet):
|
||||
|
||||
# PlayerBlockPlacementPacket.Face is an alias for BlockFace.
|
||||
Face = BlockFace
|
||||
|
||||
|
||||
class UseItemPacket(Packet):
|
||||
@staticmethod
|
||||
def get_id(context):
|
||||
return 0x2A if context.protocol_version >= 389 else \
|
||||
0x28 if context.protocol_version >= 386 else \
|
||||
0x20 if context.protocol_version >= 345 else \
|
||||
0x1F if context.protocol_version >= 343 else \
|
||||
0x20 if context.protocol_version >= 332 else \
|
||||
0x1F if context.protocol_version >= 318 else \
|
||||
0x1D
|
||||
|
||||
packet_name = "use item"
|
||||
get_definition = staticmethod(lambda context: [
|
||||
{'hand': VarInt}])
|
||||
|
||||
Hand = RelativeHand
|
||||
HAND_MAIN, HAND_OFF = Hand.MAIN, Hand.OFF # For backward compatibility.
|
||||
|
Loading…
Reference in New Issue
Block a user