Evade ranged weapons and rush target
This commit is contained in:
1 parent
dbd2831dda
commit
0722924263
10 files changed
+474
-14
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import io
|
||||
import unittest
|
||||
|
||||
from munch import Munch
|
||||
from minecraft.networking.packets import PacketBuffer
|
||||
from minecraft.networking.types import UnsignedByte, VarInt
|
||||
|
||||
from mosfet.info import items
|
||||
from mosfet.protocol.packets import SetEquipmentPacket
|
||||
|
||||
|
||||
class SetEquipmentPacketTests(unittest.TestCase):
|
||||
def test_decodes_mainhand_and_offhand_stacks(self):
|
||||
payload = PacketBuffer()
|
||||
VarInt.send(42, payload)
|
||||
UnsignedByte.send(0x80, payload) # main hand, another slot follows
|
||||
VarInt.send(1, payload)
|
||||
VarInt.send(items.get_id('bow'), payload)
|
||||
VarInt.send(0, payload) # no added components
|
||||
VarInt.send(0, payload) # no removed components
|
||||
UnsignedByte.send(1, payload) # off hand, final slot
|
||||
VarInt.send(0, payload) # empty stack
|
||||
|
||||
packet = SetEquipmentPacket(context=Munch(registry_ids={}))
|
||||
packet.read(io.BytesIO(payload.get_writable()))
|
||||
|
||||
self.assertEqual(packet.id, 0x68)
|
||||
self.assertEqual(packet.entity_id, 42)
|
||||
self.assertTrue(packet.equipment[0].present)
|
||||
self.assertEqual(packet.equipment[0].item_id, items.get_id('bow'))
|
||||
self.assertFalse(packet.equipment[1].present)
|
||||
self.assertFalse(packet.incomplete)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user