Decode selected hotbar slot updates
This commit is contained in:
1 parent
9cd9aef05f
commit
0e3b556628
2 files changed
+16
-2
No files matched your search
@@ -831,6 +831,13 @@ class SetCarriedItemPacket(Packet):
|
|||||||
definition = [{'slot': Short}]
|
definition = [{'slot': Short}]
|
||||||
|
|
||||||
|
|
||||||
|
class SetHeldSlotPacket(Packet):
|
||||||
|
"""Server synchronization of the selected hotbar slot (protocol 777)."""
|
||||||
|
id = 0x6B
|
||||||
|
packet_name = "set held slot"
|
||||||
|
definition = [{'slot': VarInt}]
|
||||||
|
|
||||||
|
|
||||||
class ContainerClickSwapPacket(Packet):
|
class ContainerClickSwapPacket(Packet):
|
||||||
id = 0x12
|
id = 0x12
|
||||||
packet_name = "container click swap"
|
packet_name = "container click swap"
|
||||||
@@ -1134,7 +1141,7 @@ class ModernPlayingReactor(PacketReactor):
|
|||||||
EntityPositionSyncPacket, PlayerInfoUpdatePacket,
|
EntityPositionSyncPacket, PlayerInfoUpdatePacket,
|
||||||
PlayerInfoRemovePacket, ContainerOpenPacket,
|
PlayerInfoRemovePacket, ContainerOpenPacket,
|
||||||
ContainerSetContentPacket, ContainerSetSlotPacket,
|
ContainerSetContentPacket, ContainerSetSlotPacket,
|
||||||
SetCursorItemPacket,
|
SetCursorItemPacket, SetHeldSlotPacket,
|
||||||
}
|
}
|
||||||
|
|
||||||
def react(self, packet):
|
def react(self, packet):
|
||||||
|
|||||||
@@ -2,7 +2,14 @@ import struct
|
|||||||
import unittest
|
import unittest
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from minecraft.networking.modern import ForgetChunkPacket
|
from minecraft.networking.modern import ForgetChunkPacket, SetHeldSlotPacket
|
||||||
|
|
||||||
|
|
||||||
|
class TestSetHeldSlotPacket(unittest.TestCase):
|
||||||
|
def test_reads_server_selected_hotbar_slot(self):
|
||||||
|
packet = SetHeldSlotPacket()
|
||||||
|
packet.read(BytesIO(bytes([2])))
|
||||||
|
self.assertEqual(packet.slot, 2)
|
||||||
|
|
||||||
|
|
||||||
class TestForgetChunkPacket(unittest.TestCase):
|
class TestForgetChunkPacket(unittest.TestCase):
|
||||||
|
|||||||
Reference in new issue
Block a user