Some more packets maybe?
This commit is contained in:
parent
69a00c1a2b
commit
522814f574
|
@ -56,11 +56,15 @@ async def inspect_server(queue: Queue, addr: tuple[str, int]):
|
|||
continue
|
||||
case Packet51MapChunk.packet_id:
|
||||
continue
|
||||
case Packet28EntityVelocity.packet_id:
|
||||
continue
|
||||
case Packet31RelEntityMove.packet_id:
|
||||
continue
|
||||
case Packet32EntityLook.packet_id:
|
||||
continue
|
||||
case Packet33RelEntityMoveLook.packet_id:
|
||||
continue
|
||||
case Packet73WeatherStatus.packet_id:
|
||||
continue
|
||||
case _:
|
||||
print(f"S {delta*1000:+8.1f}ms {pkt}")
|
||||
|
|
|
@ -65,3 +65,12 @@ from .packet22collect import Packet22Collect
|
|||
from .packet9respawn import Packet9Respawn
|
||||
from .packet60explosion import Packet60Explosion
|
||||
from .packet60explosion import Packet60Explosion
|
||||
from .packet54playnoteblock import Packet54PlayNoteBlock
|
||||
from .packet100openwindow import Packet100OpenWindow
|
||||
from .packet130updatesign import Packet130UpdateSign
|
||||
from .packet131mapdata import Packet131MapData
|
||||
from .packet133openguidebook import Packet133OpenGuidebook
|
||||
from .packet134itemdata import Packet134ItemData
|
||||
from .packet137updateflag import Packet137UpdateFlag
|
||||
from .packet139setpaintingmotive import Packet139SetPaintingMotive
|
||||
from .packet141updateflag import Packet141UpdateFlag
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from typing import Any, ClassVar, Optional, Type, Union
|
||||
|
||||
import gzip
|
||||
from bta_proxy.entitydata import EntityData
|
||||
from bta_proxy.itemstack import ItemStack
|
||||
from ..datainputstream import AsyncDataInputStream
|
||||
|
@ -144,6 +145,13 @@ class Packet:
|
|||
return None
|
||||
case "entitydata":
|
||||
return await EntityData.read_from(stream)
|
||||
case "nbt":
|
||||
size = await stream.read_short()
|
||||
if size < 0:
|
||||
raise ValueError("Received tag length is less than zero! Weird tag!")
|
||||
if size == 0:
|
||||
return None
|
||||
return gzip.decompress(await stream.read_bytes(size))
|
||||
case _:
|
||||
raise ValueError(f"unknown type {datatype}")
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
from .base import Packet
|
||||
|
||||
class Packet100OpenWindow(Packet, packet_id=100):
|
||||
__slots__ = ('window_id', 'inv_type', 'title', 'slots')
|
||||
FIELDS = [
|
||||
('window_id', 'ubyte'),
|
||||
('inv_type', 'ubyte'),
|
||||
('title', 'str'),
|
||||
('slots', 'ubyte'),
|
||||
]
|
|
@ -0,0 +1,12 @@
|
|||
from .base import Packet
|
||||
|
||||
class Packet130UpdateSign(Packet, packet_id=130):
|
||||
__slots__ = ('x', 'y', 'z', 'lines', 'picture', 'color')
|
||||
FIELDS = [
|
||||
('x', 'int'),
|
||||
('y', 'short'),
|
||||
('z', 'int'),
|
||||
('lines', ('list', 4, 'str')),
|
||||
('picture', 'int'),
|
||||
('color', 'int'),
|
||||
]
|
|
@ -0,0 +1,10 @@
|
|||
from .base import Packet
|
||||
|
||||
class Packet131MapData(Packet, packet_id=131):
|
||||
__slots__ = ('item', 'meta', 'size', 'data')
|
||||
FIELDS = [
|
||||
('item', 'short'),
|
||||
('meta', 'short'),
|
||||
('size', 'ubyte'),
|
||||
('data', ('bytes', 'size')),
|
||||
]
|
|
@ -0,0 +1,7 @@
|
|||
from .base import Packet
|
||||
|
||||
class Packet133OpenGuidebook(Packet, packet_id=133):
|
||||
__slots__ = ('open',)
|
||||
FIELDS = [
|
||||
('open', 'bool'),
|
||||
]
|
|
@ -0,0 +1,8 @@
|
|||
from .base import Packet
|
||||
|
||||
class Packet134ItemData(Packet, packet_id=134):
|
||||
__slots__ = ('slot', 'data')
|
||||
FIELDS = [
|
||||
('slot', 'int'),
|
||||
('data', 'nbt'),
|
||||
]
|
|
@ -0,0 +1,6 @@
|
|||
from .base import Packet
|
||||
|
||||
class Packet137UpdateFlag(Packet, packet_id=137):
|
||||
__slots__ = ()
|
||||
FIELDS = [
|
||||
]
|
|
@ -0,0 +1,7 @@
|
|||
from .base import Packet
|
||||
|
||||
class Packet139SetPaintingMotive(Packet, packet_id=139):
|
||||
__slots__ = ('motive',)
|
||||
FIELDS = [
|
||||
('motive', 'int'),
|
||||
]
|
|
@ -2,11 +2,7 @@ from .base import Packet
|
|||
import gzip
|
||||
|
||||
class Packet140TileEntityData(Packet, packet_id=140):
|
||||
__slots__ = ('size', 'data')
|
||||
__slots__ = ('tag',)
|
||||
FIELDS = [
|
||||
('size', 'short'),
|
||||
('data', ('bytes', 'size')),
|
||||
('tag', 'nbt')
|
||||
]
|
||||
|
||||
def post_creation(self):
|
||||
self.data = gzip.decompress(self.data)
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
from .base import Packet
|
||||
|
||||
class Packet141UpdateFlag(Packet, packet_id=141):
|
||||
__slots__ = ('x', 'y', 'z', 'colors', 'items')
|
||||
FIELDS = [
|
||||
('x', 'int'),
|
||||
('y', 'short'),
|
||||
('z', 'int'),
|
||||
('colors', ('bytes', 384)),
|
||||
('items', ('list', 3, 'nbt')),
|
||||
]
|
|
@ -6,8 +6,7 @@ class Packet21PickupSpawn(Packet, packet_id=21):
|
|||
('item_id', 'short'),
|
||||
('count', 'byte'),
|
||||
('damage', 'short'),
|
||||
('tag_size', 'short'),
|
||||
('tag', ('bytes', 'tag_size')),
|
||||
('tag', 'nbt'),
|
||||
('x', 'int'),
|
||||
('y', 'int'),
|
||||
('z', 'int'),
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
from .base import Packet
|
||||
|
||||
class Packet54PlayNoteBlock(Packet, packet_id=54):
|
||||
__slots__ = ('x', 'y', 'z', 'instrument', 'pitch')
|
||||
FIELDS = [
|
||||
('x', 'int'),
|
||||
('y', 'short'),
|
||||
('z', 'int'),
|
||||
('instrument', 'ubyte'),
|
||||
('pitch', 'ubyte'),
|
||||
]
|
Loading…
Reference in New Issue