diff --git a/aiocraft/__init__.py b/aiocraft/__init__.py index 431b49a..9da0588 100644 --- a/aiocraft/__init__.py +++ b/aiocraft/__init__.py @@ -1,10 +1,9 @@ """aiocraft is an asyncio-driven headless minecraft client""" -# from .client import Client -from .mc import * # TODO move mc out of mc +from .client import AbstractMinecraftClient +from .server import AbstractMinecraftServer -from .client import MinecraftClient -from .server import MinecraftServer -from .mc.auth import MicrosoftAuthenticator, MojangAuthenticator +from .types import * +from .auth import MicrosoftAuthenticator, MojangAuthenticator from .aiocraft import * # This is needed for PyO3 functions! No clue why or how... diff --git a/aiocraft/mc/auth/__init__.py b/aiocraft/auth/__init__.py similarity index 100% rename from aiocraft/mc/auth/__init__.py rename to aiocraft/auth/__init__.py diff --git a/aiocraft/mc/auth/interface.py b/aiocraft/auth/interface.py similarity index 98% rename from aiocraft/mc/auth/interface.py rename to aiocraft/auth/interface.py index d0d9772..eba6181 100644 --- a/aiocraft/mc/auth/interface.py +++ b/aiocraft/auth/interface.py @@ -6,7 +6,7 @@ from typing import Optional, Dict, Any import aiohttp from json.decoder import JSONDecodeError -from ..definitions import GameProfile +from ..types import GameProfile logger = logging.getLogger(__file__) @@ -26,7 +26,7 @@ class AuthException(Exception): class AuthInterface: accessToken : str selectedProfile : GameProfile - session_server_override : str + session_server_override : str | None = None SESSION_SERVER = "https://sessionserver.mojang.com/session/minecraft" TIMEOUT = aiohttp.ClientTimeout(total=3) diff --git a/aiocraft/mc/auth/microsoft.py b/aiocraft/auth/microsoft.py similarity index 92% rename from aiocraft/mc/auth/microsoft.py rename to aiocraft/auth/microsoft.py index 70f9b65..f4d9ce2 100644 --- a/aiocraft/mc/auth/microsoft.py +++ b/aiocraft/auth/microsoft.py @@ -1,14 +1,9 @@ -import re -import uuid import logging from urllib.parse import urlencode -from typing import Dict, List, Optional, Any +from typing import Any -from yarl import URL -import aiohttp - -from ..definitions import GameProfile +from ..types import GameProfile from .interface import AuthInterface, AuthException class InvalidStateError(Exception): @@ -18,11 +13,11 @@ class MicrosoftAuthenticator(AuthInterface): client_id : str client_secret : str redirect_uri : str - code : Optional[str] + code : str | None accessToken : str selectedProfile : GameProfile - refreshToken : Optional[str] + refreshToken : str | None MINECRAFT_CLIENT_ID = "00000000402b5328" OAUTH_LOGIN = "https://login.live.com/oauth20" @@ -34,7 +29,7 @@ class MicrosoftAuthenticator(AuthInterface): client_id:str, client_secret:str, redirect_uri:str="http://localhost", - code:Optional[str]=None + code:str|None = None ): self.client_id = client_id self.client_secret = client_secret @@ -44,14 +39,14 @@ class MicrosoftAuthenticator(AuthInterface): self.accessToken = '' self.selectedProfile = GameProfile(id='', name='') - def serialize(self) -> Dict[str, Any]: + def serialize(self) -> dict[str, Any]: return { 'accessToken': self.accessToken, 'refreshToken': self.refreshToken, 'selectedProfile': self.selectedProfile.serialize(), } - def deserialize(self, data:Dict[str, Any]): + def deserialize(self, data:dict[str, Any]): self.accessToken = data['accessToken'] self.refreshToken = data['refreshToken'] self.selectedProfile = GameProfile(**data['selectedProfile']) @@ -65,9 +60,9 @@ class MicrosoftAuthenticator(AuthInterface): return ( self.OAUTH_LOGIN + "_authorize.srf" + f"?client_id={self.client_id}" + - f"&response_type=code" + + "&response_type=code" + f"&redirect_uri={self.redirect_uri}" + - f"&scope=XboxLive.signin%20offline_access" + + "&scope=XboxLive.signin%20offline_access" + f"&state={state}" ) @@ -181,7 +176,7 @@ class MicrosoftAuthenticator(AuthInterface): ) return auth_response['access_token'] - async def fetch_mcstore(self) -> Dict[str, Any]: + async def fetch_mcstore(self) -> dict[str, Any]: """Get the store information""" logging.debug("Fetching MC Store") return await self._get( @@ -189,7 +184,7 @@ class MicrosoftAuthenticator(AuthInterface): headers={ "Authorization": f"Bearer {self.accessToken}" }, ) - async def fetch_profile(self) -> Dict[str, Any]: + async def fetch_profile(self) -> dict[str, Any]: """Get player profile""" logging.debug("Fetching profile") return await self._get( diff --git a/aiocraft/mc/auth/mojang.py b/aiocraft/auth/mojang.py similarity index 96% rename from aiocraft/mc/auth/mojang.py rename to aiocraft/auth/mojang.py index 30ae831..7fcd84c 100644 --- a/aiocraft/mc/auth/mojang.py +++ b/aiocraft/auth/mojang.py @@ -7,17 +7,14 @@ from typing import Optional, Dict, Any from .interface import AuthInterface, AuthException -from ..definitions import GameProfile +from ..types import GameProfile @dataclass class MojangAuthenticator(AuthInterface): - #selectedProfile : GameProfile - #accessToken : str - #session_server_override : str username : str password : Optional[str] clientToken : str - auth_server_override : str + auth_server_override : str | None = None AGENT_NAME = "Minecraft" AGENT_VERSION = 1 diff --git a/aiocraft/client.py b/aiocraft/client.py index 6033843..5494551 100644 --- a/aiocraft/client.py +++ b/aiocraft/client.py @@ -1,78 +1,74 @@ -import asyncio import logging import json -import uuid -from dataclasses import dataclass from asyncio import Task -from enum import Enum from time import time -from typing import Dict, List, Callable, Type, Optional, Tuple, AsyncIterator, Any, Set +from typing import Any, Type import dns.resolver from .dispatcher import Dispatcher -from .mc.packet import Packet -from .mc.auth import AuthInterface, AuthException, MojangAuthenticator, MicrosoftAuthenticator -from .mc.definitions import Dimension, Difficulty, Gamemode, ConnectionState -from .mc.proto.status.serverbound import PacketPing, PacketPingStart -from .mc.proto.status.clientbound import PacketServerInfo, PacketPing as PacketPong -from .mc.proto.handshaking.serverbound import PacketSetProtocol -from .mc.proto.play.serverbound import PacketKeepAlive as PacketKeepAliveResponse -from .mc.proto.play.clientbound import PacketKeepAlive, PacketSetCompression, PacketKickDisconnect -from .mc.proto.login.serverbound import PacketLoginStart, PacketEncryptionBegin as PacketEncryptionResponse -from .mc.proto.login.clientbound import ( +from .auth import AuthInterface, AuthException +from .types import ConnectionState +from .packet import Packet +from .proto.status.serverbound import PacketPing, PacketPingStart +from .proto.status.clientbound import PacketServerInfo, PacketPing as PacketPong +from .proto.handshaking.serverbound import PacketSetProtocol +from .proto.play.serverbound import PacketKeepAlive as PacketKeepAliveResponse +from .proto.play.clientbound import PacketKeepAlive, PacketSetCompression, PacketKickDisconnect +from .proto.login.serverbound import PacketLoginStart, PacketEncryptionBegin as PacketEncryptionResponse +from .proto.login.clientbound import ( PacketCompress, PacketDisconnect, PacketEncryptionBegin, PacketLoginPluginRequest, PacketSuccess ) from .util import encryption, helpers LOGGER = logging.getLogger(__name__) -class MinecraftClient: - online_mode:bool - authenticator:AuthInterface - dispatcher : Dispatcher - logger : logging.Logger - _authenticated : bool - _processing : bool - _worker : Task +class AbstractMinecraftClient: + online_mode: bool + authenticator: AuthInterface + logger: logging.Logger + _dispatcher: Dispatcher | None + _authenticated: bool + _processing: bool + _worker: Task def __init__( self, - server:str, authenticator:AuthInterface, online_mode:bool = True, - force_port:int = 0, - resolve_srv:bool = True, ): - self.logger = LOGGER.getChild(f"on({server})") + self.logger = LOGGER.getChild(f"as({authenticator.selectedProfile.name})") self.online_mode = online_mode self.authenticator = authenticator self._authenticated = False self._processing = False + self._dispatcher = None - host = server - port = force_port or 25565 - - if resolve_srv: - try: - answ = dns.resolver.resolve(f"_minecraft._tcp.{server}", "SRV") - # TODO can we just use the 1st record? - host = str(answ[0].target).rstrip('.') - port = answ[0].port - except Exception: # TODO what can I catch? dns.resolver.exception doesn't always exist, wtf - self.logger.warning("Failed resolving SRV record for '%s'", server) - - self.dispatcher = Dispatcher().set_host(host, port) + def resolve_srv(self, server: str) -> tuple[str, int]: + try: + answ = dns.resolver.resolve(f"_minecraft._tcp.{server}", "SRV") + # TODO can we just use the 1st record? + host = str(answ[0].target).rstrip('.') + port = answ[0].port + return (host, port) + except Exception: # TODO what can I catch? dns.resolver.exception doesn't always exist, wtf + self.logger.warning("Failed resolving SRV record for '%s'", server) + return (server, 25565) @property def connected(self) -> bool: - return self.dispatcher.connected + return self._dispatcher is not None and self.dispatcher.connected - async def write(self, packet:Packet, wait:bool=False): - # TODO get rid of this, too many ways to do one thing... - await self.dispatcher.write(packet, wait) + @property + def dispatcher(self) -> Dispatcher: + # This is a weird fix to avoid asserting dispatcher is not None in all handlers: + # if i'm receiving a packet callback dispatcher is very likely not None, if I received + # a callback and it's None it's because client is stopping so an exc is ok + if self._dispatcher is None: + raise ValueError("Invalid state: connect first") + return self._dispatcher async def authenticate(self): if self._authenticated: @@ -90,46 +86,78 @@ class MinecraftClient: self.logger.info("Logged in") self._authenticated = True - async def info(self, host:str="", port:int=0, proto:int=0, ping:bool=False) -> Dict[str, Any]: + async def info( + self, + host:str, + port:int=0, + proto:int=0, + ping:bool=False, + log_ignored_packets:bool=False, + whitelist: set[Type[Packet]] = set(), + ) -> dict[str, Any]: """Make a mini connection to asses server status and version""" + if not port: + host, port = self.resolve_srv(host) + self._dispatcher = Dispatcher( + host=host, + port=port, + proto=proto, + log_ignored_packets=log_ignored_packets, + whitelist=whitelist + ) try: - await self.dispatcher.set_host(host, port).connect() + await self.dispatcher.connect() await self._handshake(ConnectionState.STATUS) return await self._status(ping) finally: if self.dispatcher.connected: await self.dispatcher.disconnect() + self._dispatcher = None - async def join(self, host:str="", port:int=0, proto:int=0): + async def join( + self, + host:str, + port:int=0, + proto:int=0, + log_ignored_packets:bool=False, + whitelist: set[Type[Packet]]=set(), + ): + if not port: + host, port = self.resolve_srv(host) + self._dispatcher = Dispatcher( + host=host, + port=port, + proto=proto, + log_ignored_packets=log_ignored_packets, + whitelist=whitelist, + ) if self.online_mode: await self.authenticate() try: - await self.dispatcher.set_host(host, port).set_proto(proto).connect() + await self.dispatcher.connect() await self._handshake(ConnectionState.LOGIN) if await self._login(): await self._play() finally: if self.dispatcher.connected: await self.dispatcher.disconnect() + self._dispatcher = None async def _handshake(self, state:ConnectionState): await self.dispatcher.write( PacketSetProtocol( - self.dispatcher._proto, - protocolVersion=self.dispatcher._proto, - serverHost=self.dispatcher._host, - serverPort=self.dispatcher._port, + protocolVersion=self.dispatcher.proto, + serverHost=self.dispatcher.host, + serverPort=self.dispatcher.port, nextState=state.value ) ) - async def _status(self, ping:bool=False) -> Dict[str, Any]: - self.dispatcher.state = ConnectionState.STATUS - await self.dispatcher.write( - PacketPingStart(self.dispatcher._proto) #empty packet - ) + async def _status(self, ping:bool=False) -> dict[str, Any]: + self.dispatcher.promote(ConnectionState.STATUS) + await self.dispatcher.write(PacketPingStart()) #empty packet #Response - data : Dict[str, Any] = {} + data : dict[str, Any] = {} ping_id : int = 0 ping_time : float = 0 async for packet in self.dispatcher.packets(): @@ -141,10 +169,7 @@ class MinecraftClient: ping_id = int(time()) ping_time = time() await self.dispatcher.write( - PacketPing( - self.dispatcher._proto, - time=ping_id, - ) + PacketPing(time=ping_id) ) if isinstance(packet, PacketPong): if packet.time == ping_id: @@ -153,12 +178,9 @@ class MinecraftClient: return data async def _login(self) -> bool: - self.dispatcher.state = ConnectionState.LOGIN + self.dispatcher.promote(ConnectionState.LOGIN) await self.dispatcher.write( - PacketLoginStart( - self.dispatcher._proto, - username=self.authenticator.selectedProfile.name - ) + PacketLoginStart(username=self.authenticator.selectedProfile.name) ) async for packet in self.dispatcher.packets(): if isinstance(packet, PacketEncryptionBegin): @@ -187,7 +209,6 @@ class MinecraftClient: else: self.logger.warning("Server gave an offline-mode serverId but still requested Encryption") encryption_response = PacketEncryptionResponse( - self.dispatcher._proto, sharedSecret=encrypted_secret, verifyToken=token ) @@ -207,7 +228,7 @@ class MinecraftClient: return False async def _play(self): - self.dispatcher.state = ConnectionState.PLAY + self.dispatcher.promote(ConnectionState.PLAY) async for packet in self.dispatcher.packets(): self.logger.debug("[ * ] Processing %s", packet.__class__.__name__) if isinstance(packet, PacketSetCompression): diff --git a/aiocraft/dispatcher.py b/aiocraft/dispatcher.py index 878fad2..86e0415 100644 --- a/aiocraft/dispatcher.py +++ b/aiocraft/dispatcher.py @@ -1,19 +1,18 @@ import io import asyncio -import contextlib import zlib import logging + +from typing import Type, AsyncIterator from asyncio import StreamReader, StreamWriter, Queue, Task -from enum import Enum -from typing import List, Dict, Set, Optional, AsyncIterator, Type, Union from types import ModuleType from cryptography.hazmat.primitives.ciphers import CipherContext -from .mc import proto as minecraft_protocol -from .mc.types import VarInt, Context -from .mc.packet import Packet -from .mc.definitions import ConnectionState +from . import proto as minecraft_protocol +from .primitives import VarInt, Context +from .packet import Packet +from .types import ConnectionState from .util import encryption LOGGER = logging.getLogger(__name__) @@ -29,11 +28,11 @@ class Dispatcher: _is_server : bool # True when receiving packets from clients _down : StreamReader - _reader : Optional[Task] + _reader : Task | None _decryptor : CipherContext _up : StreamWriter - _writer : Optional[Task] + _writer : Task | None _encryptor : CipherContext _dispatching : bool @@ -41,8 +40,8 @@ class Dispatcher: _incoming : Queue _outgoing : Queue - _packet_whitelist : Optional[Set[Type[Packet]]] - _packet_id_whitelist : Optional[Set[int]] + _packet_whitelist : set[Type[Packet]] | None + _packet_id_whitelist : set[int] | None _log_ignored_packets : bool @@ -52,20 +51,39 @@ class Dispatcher: _proto : int _encryption : bool - _compression : Optional[int] + _compression : int | None state : ConnectionState # TODO make getter/setter ? logger : logging.Logger - def __init__(self, server:bool = False): - self._proto = 757 + def __init__( + self, + host:str = "localhost", + port:int = 25565, + proto:int = 757, + compression_threshold: int | None = None, + server:bool = False, + log_ignored_packets: bool = False, + whitelist: set[Type[Packet]] = set(), + ): + self._proto = proto + self._host = host + self._port = port + self._compression = compression_threshold self._is_server = server - self._host = "localhost" - self._port = 25565 self._dispatching = False self._packet_whitelist = None self._packet_id_whitelist = None - self._log_ignored_packets = False + self._log_ignored_packets = log_ignored_packets + self._packet_whitelist = set(whitelist) if whitelist is not None else None + if self._packet_whitelist: + self._packet_whitelist.add(minecraft_protocol.play.clientbound.PacketKeepAlive) + self._packet_whitelist.add(minecraft_protocol.play.clientbound.PacketKickDisconnect) + self._packet_id_whitelist = set((P().for_proto(self.proto) for P in self._packet_whitelist)) if self._packet_whitelist else None + + def promote(self, next_state:ConnectionState): + # change dispatcher state + self.state = next_state @property def proto(self) -> int: @@ -84,7 +102,7 @@ class Dispatcher: return self._encryption @property - def compression(self) -> Optional[int]: + def compression(self) -> int | None: return self._compression @property @@ -112,7 +130,7 @@ class Dispatcher: except asyncio.TimeoutError: pass # so we recheck self.connected - def encrypt(self, secret:Optional[bytes]=None) -> 'Dispatcher': + def encrypt(self, secret: bytes | None = None): if secret is not None: cipher = encryption.create_AES_cipher(secret) self._encryptor = cipher.encryptor() @@ -122,52 +140,20 @@ class Dispatcher: else: self._encryption = False self.logger.info("Encryption disabled") - return self - def whitelist(self, ids:Optional[List[Type[Packet]]]) -> 'Dispatcher': - self._packet_whitelist = set(ids) if ids is not None else None - if self._packet_whitelist: - self._packet_whitelist.add(minecraft_protocol.play.clientbound.PacketKeepAlive) - self._packet_whitelist.add(minecraft_protocol.play.clientbound.PacketKickDisconnect) - self._packet_id_whitelist = set((P(self._proto).id for P in self._packet_whitelist)) if self._packet_whitelist else None - return self - - def set_host( - self, - host:Optional[str]="", - port:Optional[int]=0, - ) -> 'Dispatcher': - self._host = host or self._host - self._port = port or self._port - self.logger = LOGGER.getChild(f"on({self._host}:{self._port})") - return self - - def set_proto(self, proto:Optional[int]=757) -> 'Dispatcher': - self._proto = proto or self._proto - if self._packet_whitelist: - self._packet_id_whitelist = set((P(self._proto).id for P in self._packet_whitelist)) - return self - - def set_compression(self, threshold:Optional[int] = None) -> 'Dispatcher': - self._compression = threshold - return self - - def set_state(self, state:Optional[ConnectionState]=ConnectionState.HANDSHAKING) -> 'Dispatcher': - self.state = state or self.state - return self - - def log_ignored_packets(self, log:bool) -> 'Dispatcher': - self._log_ignored_packets = log - return self + def update_compression_threshold(self, threshold: int | None): + self._compression = threshold or 0 async def connect(self, - reader : Optional[StreamReader] = None, - writer : Optional[StreamWriter] = None, - queue_size : int = 100, - ) -> 'Dispatcher': + reader : StreamReader | None = None, + writer : StreamWriter | None = None, + queue_size : int = 100, + ): if self.connected: raise InvalidState("Dispatcher already connected") + self.logger = LOGGER.getChild(f"on({self._host}:{self._port})") + self._encryption = False self._compression = None self._incoming = Queue(queue_size) @@ -191,7 +177,7 @@ class Dispatcher: self.logger.info("Connected") return self - async def disconnect(self, block:bool=True) -> 'Dispatcher': + async def disconnect(self, block:bool=True): self._dispatching = False if block and self._writer and self._reader: await asyncio.gather(self._writer, self._reader) @@ -314,7 +300,7 @@ class Dispatcher: self.logger.debug("%s", buffer.getvalue()) await self.disconnect(block=False) - async def _up_worker(self, timeout=1): + async def _up_worker(self, timeout:float = 1.): while self._dispatching: try: packet : Packet = await asyncio.wait_for(self._outgoing.get(), timeout=timeout) @@ -325,7 +311,7 @@ class Dispatcher: return try: - buffer = packet.serialize() + buffer = packet.serialize(self.proto) length = len(buffer.getvalue()) # ewww TODO if self._compression is not None: diff --git a/aiocraft/mc/__init__.py b/aiocraft/mc/__init__.py deleted file mode 100644 index 31fe206..0000000 --- a/aiocraft/mc/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from .packet import Packet -from .definitions import * diff --git a/aiocraft/mc/chunk.py b/aiocraft/mc/chunk.py deleted file mode 100644 index acf26bf..0000000 --- a/aiocraft/mc/chunk.py +++ /dev/null @@ -1,275 +0,0 @@ -import io -import math -import logging -import struct - -from typing import Dict, Tuple, Any, Optional, Iterable, List - -import numpy as np - -from aiocraft.mc.types import VarInt, Short, UnsignedByte, UnsignedLong, Type, Context - -def bit_pack(data:Iterable[int], bits:int, size:int=64): - if size <= bits: - raise ValueError("Cannot pack into chunks smaller than bits per block") - out : List[int] = [] - cursor = 0 - buffer = 0 - for el in data: - if cursor + bits > size: - delta = (cursor+bits) - size - buffer |= (el & (2**(bits-delta) - 1)) << cursor - out.append(buffer) - buffer = 0 | (( el >> (bits-delta) ) & (2**(delta) - 1)) - cursor = delta - else: - buffer |= (el & (2**bits - 1)) << cursor - cursor += bits - return out - -class BitStream: - data : bytes - cursor : int - size : int - - def __init__(self, data:bytes, size:int): - self.data = data - self.cursor = 0 - self.size = size if size > 0 else len(self.data) * 8 - - def __len__(self) -> int: - return self.size - self.cursor - - def read(self, size:int) -> int: - if len(self) < size: - raise ValueError(f"Not enough bits ({len(self)} left, {size} requested)") - # Calculate splice indexes - start_byte = math.floor(self.cursor / 8) - end_byte = math.ceil((self.cursor + size) / 8) - # Construct int from bytes - buf = 0 - delta = end_byte-start_byte - fmt = f">{delta}B" # TODO endianness doesn't seem to matter? - unpacked = struct.unpack(fmt, self.data[start_byte:end_byte]) - for (i, x) in enumerate(unpacked): - # buf |= (x << (8 * (len(unpacked) - (i + 1)))) - buf |= (x << (8 * i)) - # Trim extra bits - # offset = self.cursor % 8 # start - offset = (8*delta) - ((self.cursor + size) % (8 * delta)) # end - if offset > 0: - buf = buf >> offset # There's an extra 1 to the left in air, maybe shift 1 bit less? - buf = buf & ((1 << size) - 1) - # Increment and return - self.cursor += size - return buf - -class PalettedContainer(Type): - """ - block_data = [ UnsignedLong.read(buf) for _ in range(container_size) ] - for y in range(self.size): - for z in range(self.size): - for x in range(self.size): - i = x + ((y * 16) + z) * 16 - start_long = (i * bits) // 64 - start_offset = (i * bits) % 64 - end_long = ((i + 1) * bits - 1) // 64 - if start_long == end_long: - block = (block_data[start_long] >> start_offset) & max_val - else: - end_offset = 64 - start_offset - block = (block_data[start_long] >> start_offset | - block_data[end_long] << end_offset) & max_val - """ - pytype : type - threshold : int - size : int - - def __init__(self, threshold:int, size:int): - self.threshold = threshold - self.size = size - - def write(self, data, buffer:io.BytesIO, ctx:Context): - # TODO attempt to make a palette rather than sending always 13 - UnsignedByte.write(13, buffer, ctx=ctx) # 13 bits per block - VarInt.write(0, buffer, ctx=ctx) # 0 palette len - for c in bit_pack(blocks, 13, 8*8): # FIXME add generator to iter blocks? idk - UnsignedLong.write(c, buffer, ctx=ctx) - - def read(self, buffer:io.BytesIO, ctx:Context): - bits = UnsignedByte.read(buffer, ctx=ctx) # FIXME if bits > 4 it reads trash - #logging.debug("[%d|%d@%d] Bits per block : %d", ctx.x, ctx.z, ctx.sec, bits) - if bits < 4: - bits = 4 - if bits >= self.threshold: - bits = 13 # this should not be hardcoded but we have no way to calculate all possible block states - palette_len = VarInt.read(buffer, ctx=ctx) - palette = np.zeros((palette_len,), dtype='int32') - for i in range(palette_len): - palette[i] = VarInt.read(buffer, ctx=ctx) - # logging.debug("[%d|%d@%d] Palette section : [%d] %s", ctx.x, ctx.z, ctx.sec, palette_len, str(palette)) - container_size = VarInt.read(buffer, ctx=ctx) - section = np.zeros((self.size, self.size, self.size), dtype='int32') - stream = BitStream(buffer.read(container_size * 8), container_size*8*8) # a Long is 64 bits long - # logging.debug("[%d|%d@%d] Buffer : %s", ctx.x, ctx.z, ctx.sec, stream.data) - for y in range(self.size): - for z in range(self.size): - for x in range(self.size): - val = stream.read(bits) - if val >= len(palette): - logging.warning("out of bounds : %d (%d)", val, len(palette)) # FIXME happens a lot! - section[x, y, z] = val - continue - section[x, y, z] = palette[val] if bits < self.threshold else val - return section - -BiomeContainer = PalettedContainer(4, 4) -BlockStateContainer = PalettedContainer(9, 16) - -class HalfByteArrayType(Type): - size : int - - def __init__(self, size:int): - self.size = size - - def write(self, data:np.ndarray, buffer:io.BytesIO, ctx:Context): - if data.shape != (self.size, self.size, self.size): - raise ValueError(f"Array must be of shape {str((self.size, self.size, self.size))}") - alternating = False - val = 0 - for y in range(self.size): - for z in range(self.size): - for x in range(self.size): - if alternating: - val |= (data[x, y, z] & 0xF) - buffer.write(struct.pack("B", val)) # FIXME this format is probably wrong - else: - val |= (data[x, y, z] & 0xF) << 4 - alternating = not alternating - - def read(self, buffer:io.BytesIO, ctx:Context): - section = np.empty((self.size, self.size, self.size), dtype='int32') - bit_buffer = BitStream(buffer.read((self.size**3)//2), (self.size**3)*4) - for y in range(self.size): - for z in range(self.size): - for x in range(self.size): - section[x, y, z] = bit_buffer.read(4) - return section - -BlockLightSection = HalfByteArrayType(16) -SkyLightSection = HalfByteArrayType(16) - -class NewChunkSectionType(Type): - pytype : type - - def write(self, data, buffer:io.BytesIO, ctx:Context): - raise NotImplementedError - - def read(self, buffer:io.BytesIO, ctx:Context): - block_count = Short.read(buffer, ctx=ctx) - block_states = BlockStateContainer.read(buffer, ctx=ctx) - biomes = BiomeContainer.read(buffer, ctx=ctx) - return ( - block_count, - block_states, - biomes - ) - -class OldChunkSectionType(Type): - pytype : type - - def write(self, data:Tuple[np.ndarray, np.ndarray, np.ndarray], buffer:io.BytesIO, ctx:Context): - BlockStateContainer.write(data[0], buffer, ctx=ctx) - BlockLightSection.write(data[1], buffer, ctx=ctx) - if ctx.overworld: - SkyLightSection.write(data[2], buffer, ctx=ctx) - - def read(self, buffer:io.BytesIO, ctx:Context): - block_states = BlockStateContainer.read(buffer, ctx=ctx) - block_light = BlockLightSection.read(buffer, ctx=ctx) - if ctx.overworld: - sky_light = SkyLightSection.read(buffer, ctx=ctx) - else: - sky_light = np.empty((16, 16, 16), dtype='int32') - return ( - block_states, - block_light, - sky_light - ) - -ChunkSection = OldChunkSectionType() - -class Chunk(Type): - x : int - z : int - bitmask : int - ground_up_continuous : bool - blocks : np.ndarray - block_light : np.ndarray - sky_light : np.ndarray - biomes: bytes - - def __init__(self, x:int, z:int, bitmask:int, ground_up_continuous:bool): - self.x = x - self.z = z - self.bitmask = bitmask - self.blocks = np.zeros((16, 256, 16), dtype='int32') - self.block_light = np.zeros((16, 256, 16), dtype='int32') - self.sky_light = np.zeros((16, 256, 16), dtype='int32') - self.ground_up_continuous = ground_up_continuous - - def __getitem__(self, item:Any): - return self.blocks[item] - - def merge(self, other:'Chunk'): - for i in range(16): - if not ((self.bitmask >> i) & 1): - self.blocks[:, i*16 : (i+1)*16, :] = other.blocks[:, i*16 : (i+1)*16, :] - self.block_light[:, i*16 : (i+1)*16, :] = other.block_light[:, i*16 : (i+1)*16, :] - self.sky_light[:, i*16 : (i+1)*16, :] = other.sky_light[:, i*16 : (i+1)*16, :] - - def read(self, buffer:io.BytesIO, ctx:Context): - ctx.x = self.x - ctx.z = self.z - for i in range(16): - if (self.bitmask >> i) & 1: - ctx.sec = i - block_states, block_light, sky_light = ChunkSection.read(buffer, ctx=ctx) - self.blocks[:, i*16 : (i+1)*16, :] = block_states - self.block_light[:, i*16 : (i+1)*16, :] = block_light - self.sky_light[:, i*16 : (i+1)*16, :] = sky_light - if self.ground_up_continuous: - self.biomes = buffer.read(256) # 16x16 - if buffer.read(): - logging.warning("Leftover data in chunk buffer") - return self - - def write(self, data:Any, buffer:io.BytesIO, ctx:Context): - for i in range(16): - if (self.bitmask >> i) & 1: - ChunkSection.write( - (self.blocks[:, i*16 : (i+1)*16, :], self.block_light[:, i*16 : (i+1)*16, :], self.sky_light[:, i*16 : (i+1)*16, :]), - buffer, - ctx=ctx - ) - pass # TODO!! - -class World: - chunks : Dict[Tuple[int, int], Chunk] - - def __init__(self): - self.chunks = {} - - def __getitem__(self, item:Tuple[int, int, int]): - return self.get(*item) - - def get(self, x:int, y:int, z:int) -> int: - coord = (x//16, z//16) - if coord not in self.chunks: - raise KeyError(f"Chunk {coord} not loaded") - return self.chunks[coord][int(x%16), int(y), int(z%16)] - - def put(self, chunk:Chunk, x:int, z:int, merge:bool=False): - if merge and (x,z) in self.chunks: - chunk.merge(self.chunks[(x,z)]) - self.chunks[(x,z)] = chunk diff --git a/aiocraft/mc/packet.py b/aiocraft/packet.py similarity index 70% rename from aiocraft/mc/packet.py rename to aiocraft/packet.py index 766f153..82144ab 100644 --- a/aiocraft/mc/packet.py +++ b/aiocraft/packet.py @@ -3,38 +3,51 @@ import json from asyncio import Event from typing import Tuple, List, Dict, Any -from .types import Type, VarInt, Context +from .primitives import Type, VarInt, Context MAX_FIELD_PRINT_SIZE = 255 class Packet: __slots__ = 'id', 'definition', '_processed', '_proto', '_state' - id : int - definition : List[Tuple[str, Type]] + id : int | None + definition : List[Tuple[str, Type]] | None _processed : Event - _proto : int + _proto : int | None _state : int _ids : Dict[int, int] # definitions are compiled at install time _definitions : Dict[int, List[Tuple[str, Type]]] # definitions are compiled at install time - def __init__(self, proto:int, **kwargs): - self._proto = proto + def __init__(self, **kwargs): + if not self._definitions: + raise NotImplementedError("cannot instantiate Packet base class") + self.id = None + self.definition = None + self._proto = None self._processed = Event() + for k, v in kwargs.items(): + setattr(self, k, v) + + def for_proto(self, proto: int) -> int: + self._proto = proto while proto not in self._definitions: proto -= 1 self.definition = self._definitions[proto] self.id = self._ids[proto] - for name, t in self.definition: - if name in kwargs and kwargs[name] is not None: - setattr(self, name, kwargs[name]) + return self.id @property def processed(self) -> Event: """Returns an event which will be set only after the packet has been processed (either sent or raised exc)""" return self._processed + @property + def slots(self) -> list[str]: + if self.definition is not None: + return [k for k, t in self.definition] + return [k for k in self.__slots__] + @classmethod def deserialize(cls, proto:int, buffer:io.BytesIO): ctx = Context(_proto=proto) @@ -43,10 +56,13 @@ class Packet: fallback_proto -= 1 for k, t in cls._definitions[fallback_proto]: setattr(ctx, k, t.read(buffer, ctx=ctx)) - return cls(proto, **ctx.serialize()) + return cls(**ctx.serialize()) # return cls(proto, **{ name : t.read(buffer) for (name, t) in cls._definitions[proto] }) - def serialize(self) -> io.BytesIO: + def serialize(self, proto:int) -> io.BytesIO: + self.for_proto(proto) # this sets both id and definitions but mypy doesn't know... + assert self.id is not None + assert self.definition is not None ctx = Context(_proto=self._proto) buf = io.BytesIO() VarInt.write(self.id, buf, ctx=ctx) @@ -60,9 +76,11 @@ class Packet: def __eq__(self, other) -> bool: if not isinstance(other, self.__class__): return False - if self._proto != other._proto: + if self._proto is not None \ + and other._proto is not None \ + and self._proto != other._proto: return False - for name, t in self.definition: + for name in self.slots: if getattr(self, name) != getattr(other, name): return False return True @@ -73,13 +91,13 @@ class Packet: obj["_proto"] = self._proto obj["_state"] = self._state obj["_id"] = f"0x{self.id:02x}" - for key, t in self.definition: + for key in self.slots: obj[key] = getattr(self, key, None) return json.dumps(obj, indent=2, default=str) def __repr__(self) -> str: trunc = lambda x : x if len(x) < MAX_FIELD_PRINT_SIZE else "[blob]" - attrs = (f"{key}={trunc(repr(getattr(self, key, None)))}" for (key, t) in self.definition) + attrs = (f"{key}={trunc(repr(getattr(self, key, None)))}" for key in self.slots) return f"{self.__class__.__name__}({self._proto}, {', '.join(attrs)})" diff --git a/aiocraft/mc/types.py b/aiocraft/primitives.py similarity index 98% rename from aiocraft/mc/types.py rename to aiocraft/primitives.py index 5076548..3b803f6 100644 --- a/aiocraft/mc/types.py +++ b/aiocraft/primitives.py @@ -1,15 +1,14 @@ import io import struct -import asyncio import json import uuid import logging import pynbt -from typing import List, Tuple, Dict, Any, Union, Optional, Callable, Type as Class +from typing import List, Tuple, Dict, Any, Union, Optional, Callable -from .definitions import Item +from .types import Item class Context: def __init__(self, **kwargs): @@ -390,7 +389,7 @@ class ParticleType(Type): # TODO this changes across versions! def read(self, data:dict, buffer:io.BytesIO, ctx:Context): - from aiocraft.mc.proto.ext import ParticlesDefinitions + from aiocraft.proto.ext import ParticlesDefinitions proto = ctx._proto while proto not in ParticlesDefinitions._definitions: proto -= 1 @@ -414,7 +413,7 @@ class EntityMetadataType(Type): buffer.write(b'\xFF') def read(self, buffer:io.BytesIO, ctx:Context) -> Dict[int, Any]: - from aiocraft.mc.proto.ext import MetadataDefinitions + from aiocraft.proto.ext import MetadataDefinitions proto = ctx._proto while proto not in MetadataDefinitions._definitions: proto -= 1 diff --git a/aiocraft/mc/proto/__init__.py b/aiocraft/proto/__init__.py similarity index 100% rename from aiocraft/mc/proto/__init__.py rename to aiocraft/proto/__init__.py diff --git a/aiocraft/mc/proto/ext.py b/aiocraft/proto/ext.py similarity index 92% rename from aiocraft/mc/proto/ext.py rename to aiocraft/proto/ext.py index afdac52..b1391a8 100644 --- a/aiocraft/mc/proto/ext.py +++ b/aiocraft/proto/ext.py @@ -1,4 +1,4 @@ -from ..types import * +from ..primitives import * class MetadataDefinitions: _definitions: dict[int, dict[int, Type]] = { @@ -68,7 +68,7 @@ class ParticlesDefinitions: 756 : {4: StructType(( 'blockState', VarInt ), ), 15: StructType(( 'red', Float ), ( 'green', Float ), ( 'blue', Float ), ( 'scale', Float ), ), 16: StructType(( 'fromRed', Float ), ( 'fromGreen', Float ), ( 'fromBlue', Float ), ( 'scale', Float ), ( 'toRed', Float ), ( 'toGreen', Float ), ( 'toBlue', Float ), ), 25: StructType(( 'blockState', VarInt ), ), 36: StructType(( 'item', Slot ), ), 37: StructType(( 'origin', Position ), ( 'positionType', String ), ( 'destination', SwitchType('positionType', { 'minecraft:block' : Position, 'minecraft:entity' : VarInt }, None, ) ), ( 'ticks', VarInt ), )}, 757 : {2: StructType(( 'blockState', VarInt ), ), 3: StructType(( 'blockState', VarInt ), ), 14: StructType(( 'red', Float ), ( 'green', Float ), ( 'blue', Float ), ( 'scale', Float ), ), 15: StructType(( 'fromRed', Float ), ( 'fromGreen', Float ), ( 'fromBlue', Float ), ( 'scale', Float ), ( 'toRed', Float ), ( 'toGreen', Float ), ( 'toBlue', Float ), ), 24: StructType(( 'blockState', VarInt ), ), 35: StructType(( 'item', Slot ), ), 36: StructType(( 'origin', Position ), ( 'positionType', String ), ( 'destination', SwitchType('positionType', { 'minecraft:block' : Position, 'minecraft:entity' : VarInt }, None, ) ), ( 'ticks', VarInt ), )}, 758 : {2: StructType(( 'blockState', VarInt ), ), 3: StructType(( 'blockState', VarInt ), ), 14: StructType(( 'red', Float ), ( 'green', Float ), ( 'blue', Float ), ( 'scale', Float ), ), 15: StructType(( 'fromRed', Float ), ( 'fromGreen', Float ), ( 'fromBlue', Float ), ( 'scale', Float ), ( 'toRed', Float ), ( 'toGreen', Float ), ( 'toBlue', Float ), ), 24: StructType(( 'blockState', VarInt ), ), 35: StructType(( 'item', Slot ), ), 36: StructType(( 'origin', Position ), ( 'positionType', String ), ( 'destination', SwitchType('positionType', { 'minecraft:block' : Position, 'minecraft:entity' : VarInt }, None, ) ), ( 'ticks', VarInt ), )}, - 759 : {2: StructType(( 'blockState', VarInt ), ), 3: StructType(( 'blockState', VarInt ), ), 14: StructType(( 'red', Float ), ( 'green', Float ), ( 'blue', Float ), ( 'scale', Float ), ), 15: StructType(( 'fromRed', Float ), ( 'fromGreen', Float ), ( 'fromBlue', Float ), ( 'scale', Float ), ( 'toRed', Float ), ( 'toGreen', Float ), ( 'toBlue', Float ), ), 24: StructType(( 'blockState', VarInt ), ), 35: StructType(( 'item', Slot ), ), 36: StructType(( 'origin', Position ), ( 'positionType', String ), ( 'destination', SwitchType('positionType', { 'minecraft:block' : Position, 'minecraft:entity' : VarInt }, None, ) ), ( 'ticks', VarInt ), )}, - 760 : {2: StructType(( 'blockState', VarInt ), ), 3: StructType(( 'blockState', VarInt ), ), 14: StructType(( 'red', Float ), ( 'green', Float ), ( 'blue', Float ), ( 'scale', Float ), ), 15: StructType(( 'fromRed', Float ), ( 'fromGreen', Float ), ( 'fromBlue', Float ), ( 'scale', Float ), ( 'toRed', Float ), ( 'toGreen', Float ), ( 'toBlue', Float ), ), 24: StructType(( 'blockState', VarInt ), ), 35: StructType(( 'item', Slot ), ), 36: StructType(( 'origin', Position ), ( 'positionType', String ), ( 'destination', SwitchType('positionType', { 'minecraft:block' : Position, 'minecraft:entity' : VarInt }, None, ) ), ( 'ticks', VarInt ), )}, - 761 : {2: StructType(( 'blockState', VarInt ), ), 3: StructType(( 'blockState', VarInt ), ), 14: StructType(( 'red', Float ), ( 'green', Float ), ( 'blue', Float ), ( 'scale', Float ), ), 15: StructType(( 'fromRed', Float ), ( 'fromGreen', Float ), ( 'fromBlue', Float ), ( 'scale', Float ), ( 'toRed', Float ), ( 'toGreen', Float ), ( 'toBlue', Float ), ), 24: StructType(( 'blockState', VarInt ), ), 35: StructType(( 'item', Slot ), ), 36: StructType(( 'origin', Position ), ( 'positionType', String ), ( 'destination', SwitchType('positionType', { 'minecraft:block' : Position, 'minecraft:entity' : VarInt }, None, ) ), ( 'ticks', VarInt ), )} + 759 : {2: StructType(( 'blockState', VarInt ), ), 3: StructType(( 'blockState', VarInt ), ), 14: StructType(( 'red', Float ), ( 'green', Float ), ( 'blue', Float ), ( 'scale', Float ), ), 15: StructType(( 'fromRed', Float ), ( 'fromGreen', Float ), ( 'fromBlue', Float ), ( 'scale', Float ), ( 'toRed', Float ), ( 'toGreen', Float ), ( 'toBlue', Float ), ), 25: StructType(( 'blockState', VarInt ), ), 30: StructType(( 'rotation', Float ), ), 39: StructType(( 'item', Slot ), ), 40: StructType(( 'positionType', String ), ( 'entityId', SwitchType('positionType', { 'minecraft:entity' : VarInt }, None, ) ), ( 'entityEyeHeight', SwitchType('positionType', { 'minecraft:entity' : VarInt }, None, ) ), ( 'destination', SwitchType('positionType', { 'minecraft:block' : Position, 'minecraft:entity' : VarInt }, None, ) ), ( 'ticks', VarInt ), ), 92: StructType(( 'delayInTicksBeforeShown', VarInt ), )}, + 760 : {2: StructType(( 'blockState', VarInt ), ), 3: StructType(( 'blockState', VarInt ), ), 14: StructType(( 'red', Float ), ( 'green', Float ), ( 'blue', Float ), ( 'scale', Float ), ), 15: StructType(( 'fromRed', Float ), ( 'fromGreen', Float ), ( 'fromBlue', Float ), ( 'scale', Float ), ( 'toRed', Float ), ( 'toGreen', Float ), ( 'toBlue', Float ), ), 25: StructType(( 'blockState', VarInt ), ), 30: StructType(( 'rotation', Float ), ), 39: StructType(( 'item', Slot ), ), 40: StructType(( 'positionType', String ), ( 'entityId', SwitchType('positionType', { 'minecraft:entity' : VarInt }, None, ) ), ( 'entityEyeHeight', SwitchType('positionType', { 'minecraft:entity' : VarInt }, None, ) ), ( 'destination', SwitchType('positionType', { 'minecraft:block' : Position, 'minecraft:entity' : VarInt }, None, ) ), ( 'ticks', VarInt ), ), 92: StructType(( 'delayInTicksBeforeShown', VarInt ), )}, + 761 : {2: StructType(( 'blockState', VarInt ), ), 3: StructType(( 'blockState', VarInt ), ), 14: StructType(( 'red', Float ), ( 'green', Float ), ( 'blue', Float ), ( 'scale', Float ), ), 15: StructType(( 'fromRed', Float ), ( 'fromGreen', Float ), ( 'fromBlue', Float ), ( 'scale', Float ), ( 'toRed', Float ), ( 'toGreen', Float ), ( 'toBlue', Float ), ), 25: StructType(( 'blockState', VarInt ), ), 30: StructType(( 'rotation', Float ), ), 39: StructType(( 'item', Slot ), ), 40: StructType(( 'positionType', String ), ( 'entityId', SwitchType('positionType', { 'minecraft:entity' : VarInt }, None, ) ), ( 'entityEyeHeight', SwitchType('positionType', { 'minecraft:entity' : VarInt }, None, ) ), ( 'destination', SwitchType('positionType', { 'minecraft:block' : Position, 'minecraft:entity' : VarInt }, None, ) ), ( 'ticks', VarInt ), ), 92: StructType(( 'delayInTicksBeforeShown', VarInt ), )} } diff --git a/aiocraft/mc/proto/handshaking/__init__.py b/aiocraft/proto/handshaking/__init__.py similarity index 100% rename from aiocraft/mc/proto/handshaking/__init__.py rename to aiocraft/proto/handshaking/__init__.py diff --git a/aiocraft/mc/proto/handshaking/clientbound/__init__.py b/aiocraft/proto/handshaking/clientbound/__init__.py similarity index 100% rename from aiocraft/mc/proto/handshaking/clientbound/__init__.py rename to aiocraft/proto/handshaking/clientbound/__init__.py diff --git a/aiocraft/mc/proto/handshaking/serverbound/__init__.py b/aiocraft/proto/handshaking/serverbound/__init__.py similarity index 100% rename from aiocraft/mc/proto/handshaking/serverbound/__init__.py rename to aiocraft/proto/handshaking/serverbound/__init__.py diff --git a/aiocraft/mc/proto/handshaking/serverbound/packet_legacy_server_list_ping.py b/aiocraft/proto/handshaking/serverbound/packet_legacy_server_list_ping.py similarity index 95% rename from aiocraft/mc/proto/handshaking/serverbound/packet_legacy_server_list_ping.py rename to aiocraft/proto/handshaking/serverbound/packet_legacy_server_list_ping.py index b5d4778..3e78d8a 100644 --- a/aiocraft/mc/proto/handshaking/serverbound/packet_legacy_server_list_ping.py +++ b/aiocraft/proto/handshaking/serverbound/packet_legacy_server_list_ping.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketLegacyServerListPing(Packet): __slots__ = ( 'id', 'payload' ) payload : int - def __init__(self, proto:int, - payload:int=None, + def __init__(self, + payload:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( payload=payload ) diff --git a/aiocraft/mc/proto/handshaking/serverbound/packet_set_protocol.py b/aiocraft/proto/handshaking/serverbound/packet_set_protocol.py similarity index 96% rename from aiocraft/mc/proto/handshaking/serverbound/packet_set_protocol.py rename to aiocraft/proto/handshaking/serverbound/packet_set_protocol.py index 0b8b743..d8abc86 100644 --- a/aiocraft/mc/proto/handshaking/serverbound/packet_set_protocol.py +++ b/aiocraft/proto/handshaking/serverbound/packet_set_protocol.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSetProtocol(Packet): __slots__ = ( 'id', 'nextState', 'protocolVersion', 'serverHost', 'serverPort' ) @@ -13,14 +13,14 @@ class PacketSetProtocol(Packet): serverHost : str serverPort : int - def __init__(self, proto:int, - nextState:int=None, - protocolVersion:int=None, - serverHost:str=None, - serverPort:int=None, + def __init__(self, + nextState:int | None = None, + protocolVersion:int | None = None, + serverHost:str | None = None, + serverPort:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( nextState=nextState, protocolVersion=protocolVersion, serverHost=serverHost, diff --git a/aiocraft/mc/proto/login/__init__.py b/aiocraft/proto/login/__init__.py similarity index 100% rename from aiocraft/mc/proto/login/__init__.py rename to aiocraft/proto/login/__init__.py diff --git a/aiocraft/mc/proto/login/clientbound/__init__.py b/aiocraft/proto/login/clientbound/__init__.py similarity index 100% rename from aiocraft/mc/proto/login/clientbound/__init__.py rename to aiocraft/proto/login/clientbound/__init__.py diff --git a/aiocraft/mc/proto/login/clientbound/packet_compress.py b/aiocraft/proto/login/clientbound/packet_compress.py similarity index 95% rename from aiocraft/mc/proto/login/clientbound/packet_compress.py rename to aiocraft/proto/login/clientbound/packet_compress.py index 408c3fe..fcd95b1 100644 --- a/aiocraft/mc/proto/login/clientbound/packet_compress.py +++ b/aiocraft/proto/login/clientbound/packet_compress.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketCompress(Packet): __slots__ = ( 'id', 'threshold' ) threshold : int - def __init__(self, proto:int, - threshold:int=None, + def __init__(self, + threshold:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( threshold=threshold ) diff --git a/aiocraft/mc/proto/login/clientbound/packet_disconnect.py b/aiocraft/proto/login/clientbound/packet_disconnect.py similarity index 95% rename from aiocraft/mc/proto/login/clientbound/packet_disconnect.py rename to aiocraft/proto/login/clientbound/packet_disconnect.py index cefe7eb..9e57895 100644 --- a/aiocraft/mc/proto/login/clientbound/packet_disconnect.py +++ b/aiocraft/proto/login/clientbound/packet_disconnect.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketDisconnect(Packet): __slots__ = ( 'id', 'reason' ) reason : str - def __init__(self, proto:int, - reason:str=None, + def __init__(self, + reason:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( reason=reason ) diff --git a/aiocraft/mc/proto/login/clientbound/packet_encryption_begin.py b/aiocraft/proto/login/clientbound/packet_encryption_begin.py similarity index 96% rename from aiocraft/mc/proto/login/clientbound/packet_encryption_begin.py rename to aiocraft/proto/login/clientbound/packet_encryption_begin.py index 5cbf13b..96e0804 100644 --- a/aiocraft/mc/proto/login/clientbound/packet_encryption_begin.py +++ b/aiocraft/proto/login/clientbound/packet_encryption_begin.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEncryptionBegin(Packet): __slots__ = ( 'id', 'publicKey', 'serverId', 'verifyToken' ) @@ -12,13 +12,13 @@ class PacketEncryptionBegin(Packet): serverId : str verifyToken : bytes - def __init__(self, proto:int, - publicKey:bytes=None, - serverId:str=None, - verifyToken:bytes=None, + def __init__(self, + publicKey:bytes | None = None, + serverId:str | None = None, + verifyToken:bytes | None = None, **kwargs ): - super().__init__(proto, + super().__init__( publicKey=publicKey, serverId=serverId, verifyToken=verifyToken diff --git a/aiocraft/mc/proto/login/clientbound/packet_login_plugin_request.py b/aiocraft/proto/login/clientbound/packet_login_plugin_request.py similarity index 94% rename from aiocraft/mc/proto/login/clientbound/packet_login_plugin_request.py rename to aiocraft/proto/login/clientbound/packet_login_plugin_request.py index fc3ade8..2de0058 100644 --- a/aiocraft/mc/proto/login/clientbound/packet_login_plugin_request.py +++ b/aiocraft/proto/login/clientbound/packet_login_plugin_request.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketLoginPluginRequest(Packet): __slots__ = ( 'id', 'channel', 'data', 'messageId' ) @@ -12,13 +12,13 @@ class PacketLoginPluginRequest(Packet): data : bytes messageId : int - def __init__(self, proto:int, - channel:str=None, - data:bytes=None, - messageId:int=None, + def __init__(self, + channel:str | None = None, + data:bytes | None = None, + messageId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( channel=channel, data=data, messageId=messageId diff --git a/aiocraft/mc/proto/login/clientbound/packet_success.py b/aiocraft/proto/login/clientbound/packet_success.py similarity index 95% rename from aiocraft/mc/proto/login/clientbound/packet_success.py rename to aiocraft/proto/login/clientbound/packet_success.py index 346e9f5..d031463 100644 --- a/aiocraft/mc/proto/login/clientbound/packet_success.py +++ b/aiocraft/proto/login/clientbound/packet_success.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSuccess(Packet): __slots__ = ( 'id', 'properties', 'username', 'uuid' ) @@ -12,13 +12,13 @@ class PacketSuccess(Packet): username : str uuid : str - def __init__(self, proto:int, - properties:list=None, - username:str=None, - uuid:str=None, + def __init__(self, + properties:list | None = None, + username:str | None = None, + uuid:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( properties=properties, username=username, uuid=uuid diff --git a/aiocraft/mc/proto/login/serverbound/__init__.py b/aiocraft/proto/login/serverbound/__init__.py similarity index 100% rename from aiocraft/mc/proto/login/serverbound/__init__.py rename to aiocraft/proto/login/serverbound/__init__.py diff --git a/aiocraft/mc/proto/login/serverbound/packet_encryption_begin.py b/aiocraft/proto/login/serverbound/packet_encryption_begin.py similarity index 95% rename from aiocraft/mc/proto/login/serverbound/packet_encryption_begin.py rename to aiocraft/proto/login/serverbound/packet_encryption_begin.py index 7acf8db..643f930 100644 --- a/aiocraft/mc/proto/login/serverbound/packet_encryption_begin.py +++ b/aiocraft/proto/login/serverbound/packet_encryption_begin.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEncryptionBegin(Packet): __slots__ = ( 'id', 'crypto', 'hasVerifyToken', 'sharedSecret', 'verifyToken' ) @@ -13,14 +13,14 @@ class PacketEncryptionBegin(Packet): sharedSecret : bytes verifyToken : bytes - def __init__(self, proto:int, - crypto:Union[None, dict]=None, - hasVerifyToken:bool=None, - sharedSecret:bytes=None, - verifyToken:bytes=None, + def __init__(self, + crypto:Union[None, dict] | None = None, + hasVerifyToken:bool | None = None, + sharedSecret:bytes | None = None, + verifyToken:bytes | None = None, **kwargs ): - super().__init__(proto, + super().__init__( crypto=crypto, hasVerifyToken=hasVerifyToken, sharedSecret=sharedSecret, diff --git a/aiocraft/mc/proto/login/serverbound/packet_login_plugin_response.py b/aiocraft/proto/login/serverbound/packet_login_plugin_response.py similarity index 95% rename from aiocraft/mc/proto/login/serverbound/packet_login_plugin_response.py rename to aiocraft/proto/login/serverbound/packet_login_plugin_response.py index 52bd2ee..28ba0d3 100644 --- a/aiocraft/mc/proto/login/serverbound/packet_login_plugin_response.py +++ b/aiocraft/proto/login/serverbound/packet_login_plugin_response.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketLoginPluginResponse(Packet): __slots__ = ( 'id', 'data', 'messageId' ) @@ -11,12 +11,12 @@ class PacketLoginPluginResponse(Packet): data : tuple messageId : int - def __init__(self, proto:int, - data:tuple=None, - messageId:int=None, + def __init__(self, + data:tuple | None = None, + messageId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( data=data, messageId=messageId ) diff --git a/aiocraft/mc/proto/login/serverbound/packet_login_start.py b/aiocraft/proto/login/serverbound/packet_login_start.py similarity index 94% rename from aiocraft/mc/proto/login/serverbound/packet_login_start.py rename to aiocraft/proto/login/serverbound/packet_login_start.py index 67e2825..c1ab425 100644 --- a/aiocraft/mc/proto/login/serverbound/packet_login_start.py +++ b/aiocraft/proto/login/serverbound/packet_login_start.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketLoginStart(Packet): __slots__ = ( 'id', 'playerUUID', 'signature', 'username' ) @@ -12,13 +12,13 @@ class PacketLoginStart(Packet): signature : tuple username : str - def __init__(self, proto:int, - playerUUID:tuple=None, - signature:tuple=None, - username:str=None, + def __init__(self, + playerUUID:tuple | None = None, + signature:tuple | None = None, + username:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( playerUUID=playerUUID, signature=signature, username=username diff --git a/aiocraft/mc/proto/play/__init__.py b/aiocraft/proto/play/__init__.py similarity index 100% rename from aiocraft/mc/proto/play/__init__.py rename to aiocraft/proto/play/__init__.py diff --git a/aiocraft/mc/proto/play/clientbound/__init__.py b/aiocraft/proto/play/clientbound/__init__.py similarity index 100% rename from aiocraft/mc/proto/play/clientbound/__init__.py rename to aiocraft/proto/play/clientbound/__init__.py diff --git a/aiocraft/mc/proto/play/clientbound/packet_abilities.py b/aiocraft/proto/play/clientbound/packet_abilities.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_abilities.py rename to aiocraft/proto/play/clientbound/packet_abilities.py index 3018046..8a14902 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_abilities.py +++ b/aiocraft/proto/play/clientbound/packet_abilities.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketAbilities(Packet): __slots__ = ( 'id', 'flags', 'flyingSpeed', 'walkingSpeed' ) @@ -12,13 +12,13 @@ class PacketAbilities(Packet): flyingSpeed : float walkingSpeed : float - def __init__(self, proto:int, - flags:int=None, - flyingSpeed:float=None, - walkingSpeed:float=None, + def __init__(self, + flags:int | None = None, + flyingSpeed:float | None = None, + walkingSpeed:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( flags=flags, flyingSpeed=flyingSpeed, walkingSpeed=walkingSpeed diff --git a/aiocraft/mc/proto/play/clientbound/packet_acknowledge_player_digging.py b/aiocraft/proto/play/clientbound/packet_acknowledge_player_digging.py similarity index 91% rename from aiocraft/mc/proto/play/clientbound/packet_acknowledge_player_digging.py rename to aiocraft/proto/play/clientbound/packet_acknowledge_player_digging.py index c4198d4..756a77a 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_acknowledge_player_digging.py +++ b/aiocraft/proto/play/clientbound/packet_acknowledge_player_digging.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketAcknowledgePlayerDigging(Packet): __slots__ = ( 'id', 'block', 'location', 'sequenceId', 'status', 'successful' ) @@ -14,15 +14,15 @@ class PacketAcknowledgePlayerDigging(Packet): status : int successful : bool - def __init__(self, proto:int, - block:int=None, - location:tuple=None, - sequenceId:int=None, - status:int=None, - successful:bool=None, + def __init__(self, + block:int | None = None, + location:tuple | None = None, + sequenceId:int | None = None, + status:int | None = None, + successful:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( block=block, location=location, sequenceId=sequenceId, diff --git a/aiocraft/mc/proto/play/clientbound/packet_action_bar.py b/aiocraft/proto/play/clientbound/packet_action_bar.py similarity index 86% rename from aiocraft/mc/proto/play/clientbound/packet_action_bar.py rename to aiocraft/proto/play/clientbound/packet_action_bar.py index 1ad2c3a..254d1d5 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_action_bar.py +++ b/aiocraft/proto/play/clientbound/packet_action_bar.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketActionBar(Packet): __slots__ = ( 'id', 'text' ) text : str - def __init__(self, proto:int, - text:str=None, + def __init__(self, + text:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( text=text ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_advancement_progress.py b/aiocraft/proto/play/clientbound/packet_advancement_progress.py similarity index 80% rename from aiocraft/mc/proto/play/clientbound/packet_advancement_progress.py rename to aiocraft/proto/play/clientbound/packet_advancement_progress.py index 78f9b26..218a3d6 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_advancement_progress.py +++ b/aiocraft/proto/play/clientbound/packet_advancement_progress.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketAdvancementProgress(Packet): __slots__ = ( 'id', 'id' ) id : tuple - def __init__(self, proto:int, - id:tuple=None, + def __init__(self, + id:tuple | None = None, **kwargs ): - super().__init__(proto, + super().__init__( id=id ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_advancements.py b/aiocraft/proto/play/clientbound/packet_advancements.py similarity index 99% rename from aiocraft/mc/proto/play/clientbound/packet_advancements.py rename to aiocraft/proto/play/clientbound/packet_advancements.py index a008cb4..13255ab 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_advancements.py +++ b/aiocraft/proto/play/clientbound/packet_advancements.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketAdvancements(Packet): __slots__ = ( 'id', 'advancementMapping', 'identifiers', 'progressMapping', 'reset' ) @@ -13,14 +13,14 @@ class PacketAdvancements(Packet): progressMapping : list reset : bool - def __init__(self, proto:int, - advancementMapping:list=None, - identifiers:list=None, - progressMapping:list=None, - reset:bool=None, + def __init__(self, + advancementMapping:list | None = None, + identifiers:list | None = None, + progressMapping:list | None = None, + reset:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( advancementMapping=advancementMapping, identifiers=identifiers, progressMapping=progressMapping, diff --git a/aiocraft/mc/proto/play/clientbound/packet_animation.py b/aiocraft/proto/play/clientbound/packet_animation.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_animation.py rename to aiocraft/proto/play/clientbound/packet_animation.py index cd3b2c6..a9a7b7d 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_animation.py +++ b/aiocraft/proto/play/clientbound/packet_animation.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketAnimation(Packet): __slots__ = ( 'id', 'animation', 'entityId' ) @@ -11,12 +11,12 @@ class PacketAnimation(Packet): animation : int entityId : int - def __init__(self, proto:int, - animation:int=None, - entityId:int=None, + def __init__(self, + animation:int | None = None, + entityId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( animation=animation, entityId=entityId ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_attach_entity.py b/aiocraft/proto/play/clientbound/packet_attach_entity.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_attach_entity.py rename to aiocraft/proto/play/clientbound/packet_attach_entity.py index 50089e1..f839602 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_attach_entity.py +++ b/aiocraft/proto/play/clientbound/packet_attach_entity.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketAttachEntity(Packet): __slots__ = ( 'id', 'entityId', 'leash', 'vehicleId' ) @@ -12,13 +12,13 @@ class PacketAttachEntity(Packet): leash : bool vehicleId : int - def __init__(self, proto:int, - entityId:int=None, - leash:bool=None, - vehicleId:int=None, + def __init__(self, + entityId:int | None = None, + leash:bool | None = None, + vehicleId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, leash=leash, vehicleId=vehicleId diff --git a/aiocraft/mc/proto/play/clientbound/packet_bed.py b/aiocraft/proto/play/clientbound/packet_bed.py similarity index 93% rename from aiocraft/mc/proto/play/clientbound/packet_bed.py rename to aiocraft/proto/play/clientbound/packet_bed.py index 3ea1395..2d5e5d3 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_bed.py +++ b/aiocraft/proto/play/clientbound/packet_bed.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketBed(Packet): __slots__ = ( 'id', 'entityId', 'location' ) @@ -11,12 +11,12 @@ class PacketBed(Packet): entityId : int location : tuple - def __init__(self, proto:int, - entityId:int=None, - location:tuple=None, + def __init__(self, + entityId:int | None = None, + location:tuple | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, location=location ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_block_action.py b/aiocraft/proto/play/clientbound/packet_block_action.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_block_action.py rename to aiocraft/proto/play/clientbound/packet_block_action.py index e570f43..ecd1add 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_block_action.py +++ b/aiocraft/proto/play/clientbound/packet_block_action.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketBlockAction(Packet): __slots__ = ( 'id', 'blockId', 'byte1', 'byte2', 'location' ) @@ -13,14 +13,14 @@ class PacketBlockAction(Packet): byte2 : int location : tuple - def __init__(self, proto:int, - blockId:int=None, - byte1:int=None, - byte2:int=None, - location:tuple=None, + def __init__(self, + blockId:int | None = None, + byte1:int | None = None, + byte2:int | None = None, + location:tuple | None = None, **kwargs ): - super().__init__(proto, + super().__init__( blockId=blockId, byte1=byte1, byte2=byte2, diff --git a/aiocraft/mc/proto/play/clientbound/packet_block_break_animation.py b/aiocraft/proto/play/clientbound/packet_block_break_animation.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_block_break_animation.py rename to aiocraft/proto/play/clientbound/packet_block_break_animation.py index 129a53c..2866aef 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_block_break_animation.py +++ b/aiocraft/proto/play/clientbound/packet_block_break_animation.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketBlockBreakAnimation(Packet): __slots__ = ( 'id', 'destroyStage', 'entityId', 'location' ) @@ -12,13 +12,13 @@ class PacketBlockBreakAnimation(Packet): entityId : int location : tuple - def __init__(self, proto:int, - destroyStage:int=None, - entityId:int=None, - location:tuple=None, + def __init__(self, + destroyStage:int | None = None, + entityId:int | None = None, + location:tuple | None = None, **kwargs ): - super().__init__(proto, + super().__init__( destroyStage=destroyStage, entityId=entityId, location=location diff --git a/aiocraft/mc/proto/play/clientbound/packet_block_change.py b/aiocraft/proto/play/clientbound/packet_block_change.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_block_change.py rename to aiocraft/proto/play/clientbound/packet_block_change.py index 2fa1326..87322a2 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_block_change.py +++ b/aiocraft/proto/play/clientbound/packet_block_change.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketBlockChange(Packet): __slots__ = ( 'id', 'location', 'type' ) @@ -11,12 +11,12 @@ class PacketBlockChange(Packet): location : tuple type : int - def __init__(self, proto:int, - location:tuple=None, - type:int=None, + def __init__(self, + location:tuple | None = None, + type:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( location=location, type=type ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_boss_bar.py b/aiocraft/proto/play/clientbound/packet_boss_bar.py similarity index 98% rename from aiocraft/mc/proto/play/clientbound/packet_boss_bar.py rename to aiocraft/proto/play/clientbound/packet_boss_bar.py index ed24dfb..4458b4c 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_boss_bar.py +++ b/aiocraft/proto/play/clientbound/packet_boss_bar.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketBossBar(Packet): __slots__ = ( 'id', 'action', 'color', 'dividers', 'entityUUID', 'flags', 'health', 'title' ) @@ -16,17 +16,17 @@ class PacketBossBar(Packet): health : Union[None, float] title : Union[None, str] - def __init__(self, proto:int, - action:int=None, - color:Union[None, int]=None, - dividers:Union[None, int]=None, - entityUUID:str=None, - flags:Union[None, int]=None, - health:Union[None, float]=None, - title:Union[None, str]=None, + def __init__(self, + action:int | None = None, + color:Union[None, int] | None = None, + dividers:Union[None, int] | None = None, + entityUUID:str | None = None, + flags:Union[None, int] | None = None, + health:Union[None, float] | None = None, + title:Union[None, str] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( action=action, color=color, dividers=dividers, diff --git a/aiocraft/mc/proto/play/clientbound/packet_camera.py b/aiocraft/proto/play/clientbound/packet_camera.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_camera.py rename to aiocraft/proto/play/clientbound/packet_camera.py index d5388e1..e23538d 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_camera.py +++ b/aiocraft/proto/play/clientbound/packet_camera.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketCamera(Packet): __slots__ = ( 'id', 'cameraId' ) cameraId : int - def __init__(self, proto:int, - cameraId:int=None, + def __init__(self, + cameraId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( cameraId=cameraId ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_chat.py b/aiocraft/proto/play/clientbound/packet_chat.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_chat.py rename to aiocraft/proto/play/clientbound/packet_chat.py index 4a61a31..89e61b0 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_chat.py +++ b/aiocraft/proto/play/clientbound/packet_chat.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketChat(Packet): __slots__ = ( 'id', 'message', 'position', 'sender' ) @@ -12,13 +12,13 @@ class PacketChat(Packet): position : int sender : str - def __init__(self, proto:int, - message:str=None, - position:int=None, - sender:str=None, + def __init__(self, + message:str | None = None, + position:int | None = None, + sender:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( message=message, position=position, sender=sender diff --git a/aiocraft/mc/proto/play/clientbound/packet_chat_preview.py b/aiocraft/proto/play/clientbound/packet_chat_preview.py similarity index 81% rename from aiocraft/mc/proto/play/clientbound/packet_chat_preview.py rename to aiocraft/proto/play/clientbound/packet_chat_preview.py index 96d0114..7e150c8 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_chat_preview.py +++ b/aiocraft/proto/play/clientbound/packet_chat_preview.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketChatPreview(Packet): __slots__ = ( 'id', 'message', 'queryId' ) @@ -11,12 +11,12 @@ class PacketChatPreview(Packet): message : tuple queryId : int - def __init__(self, proto:int, - message:tuple=None, - queryId:int=None, + def __init__(self, + message:tuple | None = None, + queryId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( message=message, queryId=queryId ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_chat_suggestions.py b/aiocraft/proto/play/clientbound/packet_chat_suggestions.py similarity index 82% rename from aiocraft/mc/proto/play/clientbound/packet_chat_suggestions.py rename to aiocraft/proto/play/clientbound/packet_chat_suggestions.py index 59b3822..a386065 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_chat_suggestions.py +++ b/aiocraft/proto/play/clientbound/packet_chat_suggestions.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketChatSuggestions(Packet): __slots__ = ( 'id', 'action', 'entries' ) @@ -11,12 +11,12 @@ class PacketChatSuggestions(Packet): action : int entries : list - def __init__(self, proto:int, - action:int=None, - entries:list=None, + def __init__(self, + action:int | None = None, + entries:list | None = None, **kwargs ): - super().__init__(proto, + super().__init__( action=action, entries=entries ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_clear_titles.py b/aiocraft/proto/play/clientbound/packet_clear_titles.py similarity index 86% rename from aiocraft/mc/proto/play/clientbound/packet_clear_titles.py rename to aiocraft/proto/play/clientbound/packet_clear_titles.py index e3ce72f..ffda443 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_clear_titles.py +++ b/aiocraft/proto/play/clientbound/packet_clear_titles.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketClearTitles(Packet): __slots__ = ( 'id', 'reset' ) reset : bool - def __init__(self, proto:int, - reset:bool=None, + def __init__(self, + reset:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( reset=reset ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_close_window.py b/aiocraft/proto/play/clientbound/packet_close_window.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_close_window.py rename to aiocraft/proto/play/clientbound/packet_close_window.py index 56402ed..c82dbad 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_close_window.py +++ b/aiocraft/proto/play/clientbound/packet_close_window.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketCloseWindow(Packet): __slots__ = ( 'id', 'windowId' ) windowId : int - def __init__(self, proto:int, - windowId:int=None, + def __init__(self, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( windowId=windowId ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_collect.py b/aiocraft/proto/play/clientbound/packet_collect.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_collect.py rename to aiocraft/proto/play/clientbound/packet_collect.py index 0e50913..5e085d5 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_collect.py +++ b/aiocraft/proto/play/clientbound/packet_collect.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketCollect(Packet): __slots__ = ( 'id', 'collectedEntityId', 'collectorEntityId', 'pickupItemCount' ) @@ -12,13 +12,13 @@ class PacketCollect(Packet): collectorEntityId : int pickupItemCount : int - def __init__(self, proto:int, - collectedEntityId:int=None, - collectorEntityId:int=None, - pickupItemCount:int=None, + def __init__(self, + collectedEntityId:int | None = None, + collectorEntityId:int | None = None, + pickupItemCount:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( collectedEntityId=collectedEntityId, collectorEntityId=collectorEntityId, pickupItemCount=pickupItemCount diff --git a/aiocraft/mc/proto/play/clientbound/packet_combat_event.py b/aiocraft/proto/play/clientbound/packet_combat_event.py similarity index 97% rename from aiocraft/mc/proto/play/clientbound/packet_combat_event.py rename to aiocraft/proto/play/clientbound/packet_combat_event.py index ffa6799..130c20f 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_combat_event.py +++ b/aiocraft/proto/play/clientbound/packet_combat_event.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketCombatEvent(Packet): __slots__ = ( 'id', 'duration', 'entityId', 'event', 'message', 'playerId' ) @@ -14,15 +14,15 @@ class PacketCombatEvent(Packet): message : Union[None, str] playerId : Union[None, int] - def __init__(self, proto:int, - duration:Union[None, int]=None, - entityId:Union[None, int]=None, - event:int=None, - message:Union[None, str]=None, - playerId:Union[None, int]=None, + def __init__(self, + duration:Union[None, int] | None = None, + entityId:Union[None, int] | None = None, + event:int | None = None, + message:Union[None, str] | None = None, + playerId:Union[None, int] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( duration=duration, entityId=entityId, event=event, diff --git a/aiocraft/mc/proto/play/clientbound/packet_craft_progress_bar.py b/aiocraft/proto/play/clientbound/packet_craft_progress_bar.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_craft_progress_bar.py rename to aiocraft/proto/play/clientbound/packet_craft_progress_bar.py index 6ad4b88..f4e99fb 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_craft_progress_bar.py +++ b/aiocraft/proto/play/clientbound/packet_craft_progress_bar.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketCraftProgressBar(Packet): __slots__ = ( 'id', 'property', 'value', 'windowId' ) @@ -12,13 +12,13 @@ class PacketCraftProgressBar(Packet): value : int windowId : int - def __init__(self, proto:int, - property:int=None, - value:int=None, - windowId:int=None, + def __init__(self, + property:int | None = None, + value:int | None = None, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( property=property, value=value, windowId=windowId diff --git a/aiocraft/mc/proto/play/clientbound/packet_craft_recipe_response.py b/aiocraft/proto/play/clientbound/packet_craft_recipe_response.py similarity index 94% rename from aiocraft/mc/proto/play/clientbound/packet_craft_recipe_response.py rename to aiocraft/proto/play/clientbound/packet_craft_recipe_response.py index 6a63428..7d5744b 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_craft_recipe_response.py +++ b/aiocraft/proto/play/clientbound/packet_craft_recipe_response.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketCraftRecipeResponse(Packet): __slots__ = ( 'id', 'recipe', 'windowId' ) @@ -11,12 +11,12 @@ class PacketCraftRecipeResponse(Packet): recipe : Union[int,str] windowId : int - def __init__(self, proto:int, - recipe:Union[int,str]=None, - windowId:int=None, + def __init__(self, + recipe:Union[int,str] | None = None, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( recipe=recipe, windowId=windowId ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_custom_payload.py b/aiocraft/proto/play/clientbound/packet_custom_payload.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_custom_payload.py rename to aiocraft/proto/play/clientbound/packet_custom_payload.py index e0de668..ac3b8dc 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_custom_payload.py +++ b/aiocraft/proto/play/clientbound/packet_custom_payload.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketCustomPayload(Packet): __slots__ = ( 'id', 'channel', 'data' ) @@ -11,12 +11,12 @@ class PacketCustomPayload(Packet): channel : str data : bytes - def __init__(self, proto:int, - channel:str=None, - data:bytes=None, + def __init__(self, + channel:str | None = None, + data:bytes | None = None, **kwargs ): - super().__init__(proto, + super().__init__( channel=channel, data=data ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_death_combat_event.py b/aiocraft/proto/play/clientbound/packet_death_combat_event.py similarity index 87% rename from aiocraft/mc/proto/play/clientbound/packet_death_combat_event.py rename to aiocraft/proto/play/clientbound/packet_death_combat_event.py index b954c4b..ec2f989 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_death_combat_event.py +++ b/aiocraft/proto/play/clientbound/packet_death_combat_event.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketDeathCombatEvent(Packet): __slots__ = ( 'id', 'entityId', 'message', 'playerId' ) @@ -12,13 +12,13 @@ class PacketDeathCombatEvent(Packet): message : str playerId : int - def __init__(self, proto:int, - entityId:int=None, - message:str=None, - playerId:int=None, + def __init__(self, + entityId:int | None = None, + message:str | None = None, + playerId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, message=message, playerId=playerId diff --git a/aiocraft/mc/proto/play/clientbound/packet_declare_commands.py b/aiocraft/proto/play/clientbound/packet_declare_commands.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_declare_commands.py rename to aiocraft/proto/play/clientbound/packet_declare_commands.py index c4acde6..fb64871 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_declare_commands.py +++ b/aiocraft/proto/play/clientbound/packet_declare_commands.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketDeclareCommands(Packet): __slots__ = ( 'id', 'nodes', 'rootIndex' ) @@ -11,12 +11,12 @@ class PacketDeclareCommands(Packet): nodes : list rootIndex : int - def __init__(self, proto:int, - nodes:list=None, - rootIndex:int=None, + def __init__(self, + nodes:list | None = None, + rootIndex:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( nodes=nodes, rootIndex=rootIndex ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_declare_recipes.py b/aiocraft/proto/play/clientbound/packet_declare_recipes.py similarity index 99% rename from aiocraft/mc/proto/play/clientbound/packet_declare_recipes.py rename to aiocraft/proto/play/clientbound/packet_declare_recipes.py index 869c330..85722dd 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_declare_recipes.py +++ b/aiocraft/proto/play/clientbound/packet_declare_recipes.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketDeclareRecipes(Packet): __slots__ = ( 'id', 'recipes' ) recipes : list - def __init__(self, proto:int, - recipes:list=None, + def __init__(self, + recipes:list | None = None, **kwargs ): - super().__init__(proto, + super().__init__( recipes=recipes ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_destroy_entity.py b/aiocraft/proto/play/clientbound/packet_destroy_entity.py similarity index 79% rename from aiocraft/mc/proto/play/clientbound/packet_destroy_entity.py rename to aiocraft/proto/play/clientbound/packet_destroy_entity.py index be3a341..4c77090 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_destroy_entity.py +++ b/aiocraft/proto/play/clientbound/packet_destroy_entity.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketDestroyEntity(Packet): __slots__ = ( 'id', 'entityId' ) entityId : int - def __init__(self, proto:int, - entityId:int=None, + def __init__(self, + entityId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_difficulty.py b/aiocraft/proto/play/clientbound/packet_difficulty.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_difficulty.py rename to aiocraft/proto/play/clientbound/packet_difficulty.py index 28d631d..1a4e229 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_difficulty.py +++ b/aiocraft/proto/play/clientbound/packet_difficulty.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketDifficulty(Packet): __slots__ = ( 'id', 'difficulty', 'difficultyLocked' ) @@ -11,12 +11,12 @@ class PacketDifficulty(Packet): difficulty : int difficultyLocked : bool - def __init__(self, proto:int, - difficulty:int=None, - difficultyLocked:bool=None, + def __init__(self, + difficulty:int | None = None, + difficultyLocked:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( difficulty=difficulty, difficultyLocked=difficultyLocked ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_end_combat_event.py b/aiocraft/proto/play/clientbound/packet_end_combat_event.py similarity index 87% rename from aiocraft/mc/proto/play/clientbound/packet_end_combat_event.py rename to aiocraft/proto/play/clientbound/packet_end_combat_event.py index 4ad74fe..83b5551 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_end_combat_event.py +++ b/aiocraft/proto/play/clientbound/packet_end_combat_event.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEndCombatEvent(Packet): __slots__ = ( 'id', 'duration', 'entityId' ) @@ -11,12 +11,12 @@ class PacketEndCombatEvent(Packet): duration : int entityId : int - def __init__(self, proto:int, - duration:int=None, - entityId:int=None, + def __init__(self, + duration:int | None = None, + entityId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( duration=duration, entityId=entityId ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_enter_combat_event.py b/aiocraft/proto/play/clientbound/packet_enter_combat_event.py similarity index 85% rename from aiocraft/mc/proto/play/clientbound/packet_enter_combat_event.py rename to aiocraft/proto/play/clientbound/packet_enter_combat_event.py index b134aa7..57f05f5 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_enter_combat_event.py +++ b/aiocraft/proto/play/clientbound/packet_enter_combat_event.py @@ -2,18 +2,18 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEnterCombatEvent(Packet): __slots__ = ( 'id' ) - def __init__(self, proto:int, + def __init__(self, **kwargs ): - super().__init__(proto, + super().__init__( ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_entity.py b/aiocraft/proto/play/clientbound/packet_entity.py similarity index 94% rename from aiocraft/mc/proto/play/clientbound/packet_entity.py rename to aiocraft/proto/play/clientbound/packet_entity.py index 547ac5a..9fb60f2 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_entity.py +++ b/aiocraft/proto/play/clientbound/packet_entity.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntity(Packet): __slots__ = ( 'id', 'entityId' ) entityId : int - def __init__(self, proto:int, - entityId:int=None, + def __init__(self, + entityId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_entity_destroy.py b/aiocraft/proto/play/clientbound/packet_entity_destroy.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_entity_destroy.py rename to aiocraft/proto/play/clientbound/packet_entity_destroy.py index 3c5cf9c..756b48d 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_entity_destroy.py +++ b/aiocraft/proto/play/clientbound/packet_entity_destroy.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntityDestroy(Packet): __slots__ = ( 'id', 'entityIds' ) entityIds : list - def __init__(self, proto:int, - entityIds:list=None, + def __init__(self, + entityIds:list | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityIds=entityIds ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_entity_effect.py b/aiocraft/proto/play/clientbound/packet_entity_effect.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_entity_effect.py rename to aiocraft/proto/play/clientbound/packet_entity_effect.py index 44f71a9..cac62c1 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_entity_effect.py +++ b/aiocraft/proto/play/clientbound/packet_entity_effect.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntityEffect(Packet): __slots__ = ( 'id', 'amplifier', 'duration', 'effectId', 'entityId', 'factorCodec', 'hideParticles' ) @@ -15,16 +15,16 @@ class PacketEntityEffect(Packet): factorCodec : tuple hideParticles : Union[bool,int] - def __init__(self, proto:int, - amplifier:int=None, - duration:int=None, - effectId:int=None, - entityId:int=None, - factorCodec:tuple=None, - hideParticles:Union[bool,int]=None, + def __init__(self, + amplifier:int | None = None, + duration:int | None = None, + effectId:int | None = None, + entityId:int | None = None, + factorCodec:tuple | None = None, + hideParticles:Union[bool,int] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( amplifier=amplifier, duration=duration, effectId=effectId, diff --git a/aiocraft/mc/proto/play/clientbound/packet_entity_equipment.py b/aiocraft/proto/play/clientbound/packet_entity_equipment.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_entity_equipment.py rename to aiocraft/proto/play/clientbound/packet_entity_equipment.py index 08bc551..486da30 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_entity_equipment.py +++ b/aiocraft/proto/play/clientbound/packet_entity_equipment.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntityEquipment(Packet): __slots__ = ( 'id', 'entityId', 'equipments', 'item', 'slot' ) @@ -13,14 +13,14 @@ class PacketEntityEquipment(Packet): item : Item slot : int - def __init__(self, proto:int, - entityId:int=None, - equipments:bytes=None, - item:Item=None, - slot:int=None, + def __init__(self, + entityId:int | None = None, + equipments:bytes | None = None, + item:Item | None = None, + slot:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, equipments=equipments, item=item, diff --git a/aiocraft/mc/proto/play/clientbound/packet_entity_head_rotation.py b/aiocraft/proto/play/clientbound/packet_entity_head_rotation.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_entity_head_rotation.py rename to aiocraft/proto/play/clientbound/packet_entity_head_rotation.py index 125747a..6eac0eb 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_entity_head_rotation.py +++ b/aiocraft/proto/play/clientbound/packet_entity_head_rotation.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntityHeadRotation(Packet): __slots__ = ( 'id', 'entityId', 'headYaw' ) @@ -11,12 +11,12 @@ class PacketEntityHeadRotation(Packet): entityId : int headYaw : int - def __init__(self, proto:int, - entityId:int=None, - headYaw:int=None, + def __init__(self, + entityId:int | None = None, + headYaw:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, headYaw=headYaw ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_entity_look.py b/aiocraft/proto/play/clientbound/packet_entity_look.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_entity_look.py rename to aiocraft/proto/play/clientbound/packet_entity_look.py index 3e810b0..c9620ba 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_entity_look.py +++ b/aiocraft/proto/play/clientbound/packet_entity_look.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntityLook(Packet): __slots__ = ( 'id', 'entityId', 'onGround', 'pitch', 'yaw' ) @@ -13,14 +13,14 @@ class PacketEntityLook(Packet): pitch : int yaw : int - def __init__(self, proto:int, - entityId:int=None, - onGround:bool=None, - pitch:int=None, - yaw:int=None, + def __init__(self, + entityId:int | None = None, + onGround:bool | None = None, + pitch:int | None = None, + yaw:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, onGround=onGround, pitch=pitch, diff --git a/aiocraft/mc/proto/play/clientbound/packet_entity_metadata.py b/aiocraft/proto/play/clientbound/packet_entity_metadata.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_entity_metadata.py rename to aiocraft/proto/play/clientbound/packet_entity_metadata.py index 4c79440..1326263 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_entity_metadata.py +++ b/aiocraft/proto/play/clientbound/packet_entity_metadata.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntityMetadata(Packet): __slots__ = ( 'id', 'entityId', 'metadata' ) @@ -11,12 +11,12 @@ class PacketEntityMetadata(Packet): entityId : int metadata : dict - def __init__(self, proto:int, - entityId:int=None, - metadata:dict=None, + def __init__(self, + entityId:int | None = None, + metadata:dict | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, metadata=metadata ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_entity_move_look.py b/aiocraft/proto/play/clientbound/packet_entity_move_look.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_entity_move_look.py rename to aiocraft/proto/play/clientbound/packet_entity_move_look.py index fbe77cc..4b36a77 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_entity_move_look.py +++ b/aiocraft/proto/play/clientbound/packet_entity_move_look.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntityMoveLook(Packet): __slots__ = ( 'id', 'dX', 'dY', 'dZ', 'entityId', 'onGround', 'pitch', 'yaw' ) @@ -16,17 +16,17 @@ class PacketEntityMoveLook(Packet): pitch : int yaw : int - def __init__(self, proto:int, - dX:int=None, - dY:int=None, - dZ:int=None, - entityId:int=None, - onGround:bool=None, - pitch:int=None, - yaw:int=None, + def __init__(self, + dX:int | None = None, + dY:int | None = None, + dZ:int | None = None, + entityId:int | None = None, + onGround:bool | None = None, + pitch:int | None = None, + yaw:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( dX=dX, dY=dY, dZ=dZ, diff --git a/aiocraft/mc/proto/play/clientbound/packet_entity_sound_effect.py b/aiocraft/proto/play/clientbound/packet_entity_sound_effect.py similarity index 82% rename from aiocraft/mc/proto/play/clientbound/packet_entity_sound_effect.py rename to aiocraft/proto/play/clientbound/packet_entity_sound_effect.py index a5b9f7c..55e659f 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_entity_sound_effect.py +++ b/aiocraft/proto/play/clientbound/packet_entity_sound_effect.py @@ -2,33 +2,36 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntitySoundEffect(Packet): - __slots__ = ( 'id', 'entityId', 'pitch', 'seed', 'soundCategory', 'soundId', 'volume' ) + __slots__ = ( 'id', 'entityId', 'pitch', 'seed', 'soundCategory', 'soundEvent', 'soundId', 'volume' ) entityId : int pitch : float seed : int soundCategory : int + soundEvent : Union[None, dict] soundId : int volume : float - def __init__(self, proto:int, - entityId:int=None, - pitch:float=None, - seed:int=None, - soundCategory:int=None, - soundId:int=None, - volume:float=None, + def __init__(self, + entityId:int | None = None, + pitch:float | None = None, + seed:int | None = None, + soundCategory:int | None = None, + soundEvent:Union[None, dict] | None = None, + soundId:int | None = None, + volume:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, pitch=pitch, seed=seed, soundCategory=soundCategory, + soundEvent=soundEvent, soundId=soundId, volume=volume ) @@ -75,5 +78,5 @@ class PacketEntitySoundEffect(Packet): 758 : [ ( 'soundId', VarInt ), ( 'soundCategory', VarInt ), ( 'entityId', VarInt ), ( 'volume', Float ), ( 'pitch', Float ) ], 759 : [ ( 'soundId', VarInt ), ( 'soundCategory', VarInt ), ( 'entityId', VarInt ), ( 'volume', Float ), ( 'pitch', Float ) ], 760 : [ ( 'soundId', VarInt ), ( 'soundCategory', VarInt ), ( 'entityId', VarInt ), ( 'volume', Float ), ( 'pitch', Float ), ( 'seed', Long ) ], - 761 : [ ( 'soundId', VarInt ), ( 'soundCategory', VarInt ), ( 'entityId', VarInt ), ( 'volume', Float ), ( 'pitch', Float ), ( 'seed', Long ) ] + 761 : [ ( 'soundId', VarInt ), ( 'soundEvent', SwitchType('soundId', { 0 : StructType(( 'resource', String ), ( 'range', OptionalType(Float, ) ), ) }, None, ) ), ( 'soundCategory', VarInt ), ( 'entityId', VarInt ), ( 'volume', Float ), ( 'pitch', Float ), ( 'seed', Long ) ] } diff --git a/aiocraft/mc/proto/play/clientbound/packet_entity_status.py b/aiocraft/proto/play/clientbound/packet_entity_status.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_entity_status.py rename to aiocraft/proto/play/clientbound/packet_entity_status.py index b5221c4..adde33e 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_entity_status.py +++ b/aiocraft/proto/play/clientbound/packet_entity_status.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntityStatus(Packet): __slots__ = ( 'id', 'entityId', 'entityStatus' ) @@ -11,12 +11,12 @@ class PacketEntityStatus(Packet): entityId : int entityStatus : int - def __init__(self, proto:int, - entityId:int=None, - entityStatus:int=None, + def __init__(self, + entityId:int | None = None, + entityStatus:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, entityStatus=entityStatus ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_entity_teleport.py b/aiocraft/proto/play/clientbound/packet_entity_teleport.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_entity_teleport.py rename to aiocraft/proto/play/clientbound/packet_entity_teleport.py index 25f8dbb..4ed5790 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_entity_teleport.py +++ b/aiocraft/proto/play/clientbound/packet_entity_teleport.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntityTeleport(Packet): __slots__ = ( 'id', 'entityId', 'onGround', 'pitch', 'x', 'y', 'yaw', 'z' ) @@ -16,17 +16,17 @@ class PacketEntityTeleport(Packet): yaw : int z : Union[float,int] - def __init__(self, proto:int, - entityId:int=None, - onGround:bool=None, - pitch:int=None, - x:Union[float,int]=None, - y:Union[float,int]=None, - yaw:int=None, - z:Union[float,int]=None, + def __init__(self, + entityId:int | None = None, + onGround:bool | None = None, + pitch:int | None = None, + x:Union[float,int] | None = None, + y:Union[float,int] | None = None, + yaw:int | None = None, + z:Union[float,int] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, onGround=onGround, pitch=pitch, diff --git a/aiocraft/mc/proto/play/clientbound/packet_entity_update_attributes.py b/aiocraft/proto/play/clientbound/packet_entity_update_attributes.py similarity index 98% rename from aiocraft/mc/proto/play/clientbound/packet_entity_update_attributes.py rename to aiocraft/proto/play/clientbound/packet_entity_update_attributes.py index c8e680b..404c698 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_entity_update_attributes.py +++ b/aiocraft/proto/play/clientbound/packet_entity_update_attributes.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntityUpdateAttributes(Packet): __slots__ = ( 'id', 'entityId', 'properties' ) @@ -11,12 +11,12 @@ class PacketEntityUpdateAttributes(Packet): entityId : int properties : list - def __init__(self, proto:int, - entityId:int=None, - properties:list=None, + def __init__(self, + entityId:int | None = None, + properties:list | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, properties=properties ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_entity_velocity.py b/aiocraft/proto/play/clientbound/packet_entity_velocity.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_entity_velocity.py rename to aiocraft/proto/play/clientbound/packet_entity_velocity.py index 945717f..eb1437b 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_entity_velocity.py +++ b/aiocraft/proto/play/clientbound/packet_entity_velocity.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntityVelocity(Packet): __slots__ = ( 'id', 'entityId', 'velocityX', 'velocityY', 'velocityZ' ) @@ -13,14 +13,14 @@ class PacketEntityVelocity(Packet): velocityY : int velocityZ : int - def __init__(self, proto:int, - entityId:int=None, - velocityX:int=None, - velocityY:int=None, - velocityZ:int=None, + def __init__(self, + entityId:int | None = None, + velocityX:int | None = None, + velocityY:int | None = None, + velocityZ:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, velocityX=velocityX, velocityY=velocityY, diff --git a/aiocraft/mc/proto/play/clientbound/packet_experience.py b/aiocraft/proto/play/clientbound/packet_experience.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_experience.py rename to aiocraft/proto/play/clientbound/packet_experience.py index 0bc5c28..91574c9 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_experience.py +++ b/aiocraft/proto/play/clientbound/packet_experience.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketExperience(Packet): __slots__ = ( 'id', 'experienceBar', 'level', 'totalExperience' ) @@ -12,13 +12,13 @@ class PacketExperience(Packet): level : int totalExperience : int - def __init__(self, proto:int, - experienceBar:float=None, - level:int=None, - totalExperience:int=None, + def __init__(self, + experienceBar:float | None = None, + level:int | None = None, + totalExperience:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( experienceBar=experienceBar, level=level, totalExperience=totalExperience diff --git a/aiocraft/mc/proto/play/clientbound/packet_explosion.py b/aiocraft/proto/play/clientbound/packet_explosion.py similarity index 97% rename from aiocraft/mc/proto/play/clientbound/packet_explosion.py rename to aiocraft/proto/play/clientbound/packet_explosion.py index 29d9900..de7d5a8 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_explosion.py +++ b/aiocraft/proto/play/clientbound/packet_explosion.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketExplosion(Packet): __slots__ = ( 'id', 'affectedBlockOffsets', 'playerMotionX', 'playerMotionY', 'playerMotionZ', 'radius', 'x', 'y', 'z' ) @@ -17,18 +17,18 @@ class PacketExplosion(Packet): y : float z : float - def __init__(self, proto:int, - affectedBlockOffsets:list=None, - playerMotionX:float=None, - playerMotionY:float=None, - playerMotionZ:float=None, - radius:float=None, - x:float=None, - y:float=None, - z:float=None, + def __init__(self, + affectedBlockOffsets:list | None = None, + playerMotionX:float | None = None, + playerMotionY:float | None = None, + playerMotionZ:float | None = None, + radius:float | None = None, + x:float | None = None, + y:float | None = None, + z:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( affectedBlockOffsets=affectedBlockOffsets, playerMotionX=playerMotionX, playerMotionY=playerMotionY, diff --git a/aiocraft/mc/proto/play/clientbound/packet_face_player.py b/aiocraft/proto/play/clientbound/packet_face_player.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_face_player.py rename to aiocraft/proto/play/clientbound/packet_face_player.py index cced978..13c85cd 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_face_player.py +++ b/aiocraft/proto/play/clientbound/packet_face_player.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketFacePlayer(Packet): __slots__ = ( 'id', 'entityId', 'entity_feet_eyes', 'feet_eyes', 'isEntity', 'x', 'y', 'z' ) @@ -16,17 +16,17 @@ class PacketFacePlayer(Packet): y : float z : float - def __init__(self, proto:int, - entityId:Union[None, int]=None, - entity_feet_eyes:Union[None, str]=None, - feet_eyes:int=None, - isEntity:bool=None, - x:float=None, - y:float=None, - z:float=None, + def __init__(self, + entityId:Union[None, int] | None = None, + entity_feet_eyes:Union[None, str] | None = None, + feet_eyes:int | None = None, + isEntity:bool | None = None, + x:float | None = None, + y:float | None = None, + z:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, entity_feet_eyes=entity_feet_eyes, feet_eyes=feet_eyes, diff --git a/aiocraft/mc/proto/play/clientbound/packet_feature_flags.py b/aiocraft/proto/play/clientbound/packet_feature_flags.py similarity index 80% rename from aiocraft/mc/proto/play/clientbound/packet_feature_flags.py rename to aiocraft/proto/play/clientbound/packet_feature_flags.py index e939b89..d5c41ca 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_feature_flags.py +++ b/aiocraft/proto/play/clientbound/packet_feature_flags.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketFeatureFlags(Packet): __slots__ = ( 'id', 'features' ) features : list - def __init__(self, proto:int, - features:list=None, + def __init__(self, + features:list | None = None, **kwargs ): - super().__init__(proto, + super().__init__( features=features ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_game_state_change.py b/aiocraft/proto/play/clientbound/packet_game_state_change.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_game_state_change.py rename to aiocraft/proto/play/clientbound/packet_game_state_change.py index e0a4aba..6842c17 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_game_state_change.py +++ b/aiocraft/proto/play/clientbound/packet_game_state_change.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketGameStateChange(Packet): __slots__ = ( 'id', 'gameMode', 'reason' ) @@ -11,12 +11,12 @@ class PacketGameStateChange(Packet): gameMode : float reason : int - def __init__(self, proto:int, - gameMode:float=None, - reason:int=None, + def __init__(self, + gameMode:float | None = None, + reason:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( gameMode=gameMode, reason=reason ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_held_item_slot.py b/aiocraft/proto/play/clientbound/packet_held_item_slot.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_held_item_slot.py rename to aiocraft/proto/play/clientbound/packet_held_item_slot.py index faf1b98..1877ae7 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_held_item_slot.py +++ b/aiocraft/proto/play/clientbound/packet_held_item_slot.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketHeldItemSlot(Packet): __slots__ = ( 'id', 'slot' ) slot : int - def __init__(self, proto:int, - slot:int=None, + def __init__(self, + slot:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( slot=slot ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_hide_message.py b/aiocraft/proto/play/clientbound/packet_hide_message.py similarity index 79% rename from aiocraft/mc/proto/play/clientbound/packet_hide_message.py rename to aiocraft/proto/play/clientbound/packet_hide_message.py index c881a18..bee2b68 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_hide_message.py +++ b/aiocraft/proto/play/clientbound/packet_hide_message.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketHideMessage(Packet): __slots__ = ( 'id', 'id', 'signature' ) @@ -11,12 +11,12 @@ class PacketHideMessage(Packet): id : int signature : Union[Union[None, bytes],bytes] - def __init__(self, proto:int, - id:int=None, - signature:Union[Union[None, bytes],bytes]=None, + def __init__(self, + id:int | None = None, + signature:Union[Union[None, bytes],bytes] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( id=id, signature=signature ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_initialize_world_border.py b/aiocraft/proto/play/clientbound/packet_initialize_world_border.py similarity index 87% rename from aiocraft/mc/proto/play/clientbound/packet_initialize_world_border.py rename to aiocraft/proto/play/clientbound/packet_initialize_world_border.py index 5151323..48bad8a 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_initialize_world_border.py +++ b/aiocraft/proto/play/clientbound/packet_initialize_world_border.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketInitializeWorldBorder(Packet): __slots__ = ( 'id', 'newDiameter', 'oldDiameter', 'portalTeleportBoundary', 'speed', 'warningBlocks', 'warningTime', 'x', 'z' ) @@ -17,18 +17,18 @@ class PacketInitializeWorldBorder(Packet): x : float z : float - def __init__(self, proto:int, - newDiameter:float=None, - oldDiameter:float=None, - portalTeleportBoundary:int=None, - speed:int=None, - warningBlocks:int=None, - warningTime:int=None, - x:float=None, - z:float=None, + def __init__(self, + newDiameter:float | None = None, + oldDiameter:float | None = None, + portalTeleportBoundary:int | None = None, + speed:int | None = None, + warningBlocks:int | None = None, + warningTime:int | None = None, + x:float | None = None, + z:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( newDiameter=newDiameter, oldDiameter=oldDiameter, portalTeleportBoundary=portalTeleportBoundary, diff --git a/aiocraft/mc/proto/play/clientbound/packet_keep_alive.py b/aiocraft/proto/play/clientbound/packet_keep_alive.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_keep_alive.py rename to aiocraft/proto/play/clientbound/packet_keep_alive.py index 4a2af8e..ff3f8f1 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_keep_alive.py +++ b/aiocraft/proto/play/clientbound/packet_keep_alive.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketKeepAlive(Packet): __slots__ = ( 'id', 'keepAliveId' ) keepAliveId : int - def __init__(self, proto:int, - keepAliveId:int=None, + def __init__(self, + keepAliveId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( keepAliveId=keepAliveId ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_kick_disconnect.py b/aiocraft/proto/play/clientbound/packet_kick_disconnect.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_kick_disconnect.py rename to aiocraft/proto/play/clientbound/packet_kick_disconnect.py index fd2d45b..8131d00 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_kick_disconnect.py +++ b/aiocraft/proto/play/clientbound/packet_kick_disconnect.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketKickDisconnect(Packet): __slots__ = ( 'id', 'reason' ) reason : str - def __init__(self, proto:int, - reason:str=None, + def __init__(self, + reason:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( reason=reason ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_login.py b/aiocraft/proto/play/clientbound/packet_login.py similarity index 94% rename from aiocraft/mc/proto/play/clientbound/packet_login.py rename to aiocraft/proto/play/clientbound/packet_login.py index 94bd893..2ea70b1 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_login.py +++ b/aiocraft/proto/play/clientbound/packet_login.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketLogin(Packet): __slots__ = ( 'id', 'death', 'difficulty', 'dimension', 'dimensionCodec', 'enableRespawnScreen', 'entityId', 'gameMode', 'hashedSeed', 'isDebug', 'isFlat', 'isHardcore', 'levelType', 'maxPlayers', 'previousGameMode', 'reducedDebugInfo', 'simulationDistance', 'viewDistance', 'worldName', 'worldNames', 'worldType' ) @@ -29,30 +29,30 @@ class PacketLogin(Packet): worldNames : list worldType : str - def __init__(self, proto:int, - death:tuple=None, - difficulty:int=None, - dimension:Union[dict,int,str]=None, - dimensionCodec:dict=None, - enableRespawnScreen:bool=None, - entityId:int=None, - gameMode:int=None, - hashedSeed:int=None, - isDebug:bool=None, - isFlat:bool=None, - isHardcore:bool=None, - levelType:str=None, - maxPlayers:int=None, - previousGameMode:int=None, - reducedDebugInfo:bool=None, - simulationDistance:int=None, - viewDistance:int=None, - worldName:str=None, - worldNames:list=None, - worldType:str=None, + def __init__(self, + death:tuple | None = None, + difficulty:int | None = None, + dimension:Union[dict,int,str] | None = None, + dimensionCodec:dict | None = None, + enableRespawnScreen:bool | None = None, + entityId:int | None = None, + gameMode:int | None = None, + hashedSeed:int | None = None, + isDebug:bool | None = None, + isFlat:bool | None = None, + isHardcore:bool | None = None, + levelType:str | None = None, + maxPlayers:int | None = None, + previousGameMode:int | None = None, + reducedDebugInfo:bool | None = None, + simulationDistance:int | None = None, + viewDistance:int | None = None, + worldName:str | None = None, + worldNames:list | None = None, + worldType:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( death=death, difficulty=difficulty, dimension=dimension, diff --git a/aiocraft/mc/proto/play/clientbound/packet_map.py b/aiocraft/proto/play/clientbound/packet_map.py similarity index 98% rename from aiocraft/mc/proto/play/clientbound/packet_map.py rename to aiocraft/proto/play/clientbound/packet_map.py index 20f861f..00b89db 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_map.py +++ b/aiocraft/proto/play/clientbound/packet_map.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketMap(Packet): __slots__ = ( 'id', 'columns', 'data', 'icons', 'itemDamage', 'locked', 'rows', 'scale', 'trackingPosition', 'x', 'y' ) @@ -19,20 +19,20 @@ class PacketMap(Packet): x : Union[None, int] y : Union[None, int] - def __init__(self, proto:int, - columns:int=None, - data:Union[None, bytes]=None, - icons:Union[list,tuple]=None, - itemDamage:int=None, - locked:bool=None, - rows:Union[None, int]=None, - scale:int=None, - trackingPosition:bool=None, - x:Union[None, int]=None, - y:Union[None, int]=None, + def __init__(self, + columns:int | None = None, + data:Union[None, bytes] | None = None, + icons:Union[list,tuple] | None = None, + itemDamage:int | None = None, + locked:bool | None = None, + rows:Union[None, int] | None = None, + scale:int | None = None, + trackingPosition:bool | None = None, + x:Union[None, int] | None = None, + y:Union[None, int] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( columns=columns, data=data, icons=icons, diff --git a/aiocraft/mc/proto/play/clientbound/packet_map_chunk.py b/aiocraft/proto/play/clientbound/packet_map_chunk.py similarity index 94% rename from aiocraft/mc/proto/play/clientbound/packet_map_chunk.py rename to aiocraft/proto/play/clientbound/packet_map_chunk.py index a1f1f98..c67102e 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_map_chunk.py +++ b/aiocraft/proto/play/clientbound/packet_map_chunk.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketMapChunk(Packet): __slots__ = ( 'id', 'biomes', 'bitMap', 'blockEntities', 'blockLight', 'blockLightMask', 'chunkData', 'emptyBlockLightMask', 'emptySkyLightMask', 'groundUp', 'heightmaps', 'ignoreOldData', 'skyLight', 'skyLightMask', 'trustEdges', 'x', 'z' ) @@ -25,26 +25,26 @@ class PacketMapChunk(Packet): x : int z : int - def __init__(self, proto:int, - biomes:Union[Union[None, list],list]=None, - bitMap:Union[int,list]=None, - blockEntities:list=None, - blockLight:list=None, - blockLightMask:list=None, - chunkData:bytes=None, - emptyBlockLightMask:list=None, - emptySkyLightMask:list=None, - groundUp:bool=None, - heightmaps:dict=None, - ignoreOldData:bool=None, - skyLight:list=None, - skyLightMask:list=None, - trustEdges:bool=None, - x:int=None, - z:int=None, + def __init__(self, + biomes:Union[Union[None, list],list] | None = None, + bitMap:Union[int,list] | None = None, + blockEntities:list | None = None, + blockLight:list | None = None, + blockLightMask:list | None = None, + chunkData:bytes | None = None, + emptyBlockLightMask:list | None = None, + emptySkyLightMask:list | None = None, + groundUp:bool | None = None, + heightmaps:dict | None = None, + ignoreOldData:bool | None = None, + skyLight:list | None = None, + skyLightMask:list | None = None, + trustEdges:bool | None = None, + x:int | None = None, + z:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( biomes=biomes, bitMap=bitMap, blockEntities=blockEntities, diff --git a/aiocraft/mc/proto/play/clientbound/packet_map_chunk_bulk.py b/aiocraft/proto/play/clientbound/packet_map_chunk_bulk.py similarity index 80% rename from aiocraft/mc/proto/play/clientbound/packet_map_chunk_bulk.py rename to aiocraft/proto/play/clientbound/packet_map_chunk_bulk.py index b0a6231..e9197c4 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_map_chunk_bulk.py +++ b/aiocraft/proto/play/clientbound/packet_map_chunk_bulk.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketMapChunkBulk(Packet): __slots__ = ( 'id', 'data', 'meta', 'skyLightSent' ) @@ -12,13 +12,13 @@ class PacketMapChunkBulk(Packet): meta : list skyLightSent : bool - def __init__(self, proto:int, - data:bytes=None, - meta:list=None, - skyLightSent:bool=None, + def __init__(self, + data:bytes | None = None, + meta:list | None = None, + skyLightSent:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( data=data, meta=meta, skyLightSent=skyLightSent diff --git a/aiocraft/mc/proto/play/clientbound/packet_message_header.py b/aiocraft/proto/play/clientbound/packet_message_header.py similarity index 78% rename from aiocraft/mc/proto/play/clientbound/packet_message_header.py rename to aiocraft/proto/play/clientbound/packet_message_header.py index 7cb3379..0fbee3d 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_message_header.py +++ b/aiocraft/proto/play/clientbound/packet_message_header.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketMessageHeader(Packet): __slots__ = ( 'id', 'messageHash', 'previousSignature', 'senderUuid', 'signature' ) @@ -13,14 +13,14 @@ class PacketMessageHeader(Packet): senderUuid : str signature : bytes - def __init__(self, proto:int, - messageHash:bytes=None, - previousSignature:tuple=None, - senderUuid:str=None, - signature:bytes=None, + def __init__(self, + messageHash:bytes | None = None, + previousSignature:tuple | None = None, + senderUuid:str | None = None, + signature:bytes | None = None, **kwargs ): - super().__init__(proto, + super().__init__( messageHash=messageHash, previousSignature=previousSignature, senderUuid=senderUuid, diff --git a/aiocraft/mc/proto/play/clientbound/packet_multi_block_change.py b/aiocraft/proto/play/clientbound/packet_multi_block_change.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_multi_block_change.py rename to aiocraft/proto/play/clientbound/packet_multi_block_change.py index 2fd3941..deaaca2 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_multi_block_change.py +++ b/aiocraft/proto/play/clientbound/packet_multi_block_change.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketMultiBlockChange(Packet): __slots__ = ( 'id', 'chunkCoordinates', 'chunkX', 'chunkZ', 'notTrustEdges', 'records', 'suppressLightUpdates' ) @@ -15,16 +15,16 @@ class PacketMultiBlockChange(Packet): records : list suppressLightUpdates : bool - def __init__(self, proto:int, - chunkCoordinates:int=None, - chunkX:int=None, - chunkZ:int=None, - notTrustEdges:bool=None, - records:list=None, - suppressLightUpdates:bool=None, + def __init__(self, + chunkCoordinates:int | None = None, + chunkX:int | None = None, + chunkZ:int | None = None, + notTrustEdges:bool | None = None, + records:list | None = None, + suppressLightUpdates:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( chunkCoordinates=chunkCoordinates, chunkX=chunkX, chunkZ=chunkZ, diff --git a/aiocraft/mc/proto/play/clientbound/packet_named_entity_spawn.py b/aiocraft/proto/play/clientbound/packet_named_entity_spawn.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_named_entity_spawn.py rename to aiocraft/proto/play/clientbound/packet_named_entity_spawn.py index a2ea65f..57df569 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_named_entity_spawn.py +++ b/aiocraft/proto/play/clientbound/packet_named_entity_spawn.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketNamedEntitySpawn(Packet): __slots__ = ( 'id', 'currentItem', 'entityId', 'metadata', 'pitch', 'playerUUID', 'x', 'y', 'yaw', 'z' ) @@ -18,19 +18,19 @@ class PacketNamedEntitySpawn(Packet): yaw : int z : Union[float,int] - def __init__(self, proto:int, - currentItem:int=None, - entityId:int=None, - metadata:dict=None, - pitch:int=None, - playerUUID:str=None, - x:Union[float,int]=None, - y:Union[float,int]=None, - yaw:int=None, - z:Union[float,int]=None, + def __init__(self, + currentItem:int | None = None, + entityId:int | None = None, + metadata:dict | None = None, + pitch:int | None = None, + playerUUID:str | None = None, + x:Union[float,int] | None = None, + y:Union[float,int] | None = None, + yaw:int | None = None, + z:Union[float,int] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( currentItem=currentItem, entityId=entityId, metadata=metadata, diff --git a/aiocraft/mc/proto/play/clientbound/packet_named_sound_effect.py b/aiocraft/proto/play/clientbound/packet_named_sound_effect.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_named_sound_effect.py rename to aiocraft/proto/play/clientbound/packet_named_sound_effect.py index 2170242..e9b1005 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_named_sound_effect.py +++ b/aiocraft/proto/play/clientbound/packet_named_sound_effect.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketNamedSoundEffect(Packet): __slots__ = ( 'id', 'pitch', 'seed', 'soundCategory', 'soundName', 'volume', 'x', 'y', 'z' ) @@ -17,18 +17,18 @@ class PacketNamedSoundEffect(Packet): y : int z : int - def __init__(self, proto:int, - pitch:Union[float,int]=None, - seed:int=None, - soundCategory:int=None, - soundName:str=None, - volume:float=None, - x:int=None, - y:int=None, - z:int=None, + def __init__(self, + pitch:Union[float,int] | None = None, + seed:int | None = None, + soundCategory:int | None = None, + soundName:str | None = None, + volume:float | None = None, + x:int | None = None, + y:int | None = None, + z:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( pitch=pitch, seed=seed, soundCategory=soundCategory, diff --git a/aiocraft/mc/proto/play/clientbound/packet_nbt_query_response.py b/aiocraft/proto/play/clientbound/packet_nbt_query_response.py similarity index 94% rename from aiocraft/mc/proto/play/clientbound/packet_nbt_query_response.py rename to aiocraft/proto/play/clientbound/packet_nbt_query_response.py index b552a09..05376c6 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_nbt_query_response.py +++ b/aiocraft/proto/play/clientbound/packet_nbt_query_response.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketNbtQueryResponse(Packet): __slots__ = ( 'id', 'nbt', 'transactionId' ) @@ -11,12 +11,12 @@ class PacketNbtQueryResponse(Packet): nbt : Optional[dict] transactionId : int - def __init__(self, proto:int, - nbt:Optional[dict]=None, - transactionId:int=None, + def __init__(self, + nbt:Optional[dict] | None = None, + transactionId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( nbt=nbt, transactionId=transactionId ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_open_book.py b/aiocraft/proto/play/clientbound/packet_open_book.py similarity index 91% rename from aiocraft/mc/proto/play/clientbound/packet_open_book.py rename to aiocraft/proto/play/clientbound/packet_open_book.py index 69dffdf..cfbdc4c 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_open_book.py +++ b/aiocraft/proto/play/clientbound/packet_open_book.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketOpenBook(Packet): __slots__ = ( 'id', 'hand' ) hand : int - def __init__(self, proto:int, - hand:int=None, + def __init__(self, + hand:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( hand=hand ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_open_horse_window.py b/aiocraft/proto/play/clientbound/packet_open_horse_window.py similarity index 93% rename from aiocraft/mc/proto/play/clientbound/packet_open_horse_window.py rename to aiocraft/proto/play/clientbound/packet_open_horse_window.py index 43a95bd..e643878 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_open_horse_window.py +++ b/aiocraft/proto/play/clientbound/packet_open_horse_window.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketOpenHorseWindow(Packet): __slots__ = ( 'id', 'entityId', 'nbSlots', 'windowId' ) @@ -12,13 +12,13 @@ class PacketOpenHorseWindow(Packet): nbSlots : int windowId : int - def __init__(self, proto:int, - entityId:int=None, - nbSlots:int=None, - windowId:int=None, + def __init__(self, + entityId:int | None = None, + nbSlots:int | None = None, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, nbSlots=nbSlots, windowId=windowId diff --git a/aiocraft/mc/proto/play/clientbound/packet_open_sign_entity.py b/aiocraft/proto/play/clientbound/packet_open_sign_entity.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_open_sign_entity.py rename to aiocraft/proto/play/clientbound/packet_open_sign_entity.py index 4c83a98..28a141e 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_open_sign_entity.py +++ b/aiocraft/proto/play/clientbound/packet_open_sign_entity.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketOpenSignEntity(Packet): __slots__ = ( 'id', 'location' ) location : tuple - def __init__(self, proto:int, - location:tuple=None, + def __init__(self, + location:tuple | None = None, **kwargs ): - super().__init__(proto, + super().__init__( location=location ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_open_window.py b/aiocraft/proto/play/clientbound/packet_open_window.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_open_window.py rename to aiocraft/proto/play/clientbound/packet_open_window.py index b29e6ef..5f11abb 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_open_window.py +++ b/aiocraft/proto/play/clientbound/packet_open_window.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketOpenWindow(Packet): __slots__ = ( 'id', 'entityId', 'inventoryType', 'slotCount', 'windowId', 'windowTitle' ) @@ -14,15 +14,15 @@ class PacketOpenWindow(Packet): windowId : int windowTitle : str - def __init__(self, proto:int, - entityId:Union[None, int]=None, - inventoryType:Union[int,str]=None, - slotCount:int=None, - windowId:int=None, - windowTitle:str=None, + def __init__(self, + entityId:Union[None, int] | None = None, + inventoryType:Union[int,str] | None = None, + slotCount:int | None = None, + windowId:int | None = None, + windowTitle:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, inventoryType=inventoryType, slotCount=slotCount, diff --git a/aiocraft/mc/proto/play/clientbound/packet_ping.py b/aiocraft/proto/play/clientbound/packet_ping.py similarity index 85% rename from aiocraft/mc/proto/play/clientbound/packet_ping.py rename to aiocraft/proto/play/clientbound/packet_ping.py index 03ce13a..a7939c6 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_ping.py +++ b/aiocraft/proto/play/clientbound/packet_ping.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPing(Packet): __slots__ = ( 'id', 'id' ) id : int - def __init__(self, proto:int, - id:int=None, + def __init__(self, + id:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( id=id ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_player_chat.py b/aiocraft/proto/play/clientbound/packet_player_chat.py similarity index 79% rename from aiocraft/mc/proto/play/clientbound/packet_player_chat.py rename to aiocraft/proto/play/clientbound/packet_player_chat.py index e27f321..cb6b9c2 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_player_chat.py +++ b/aiocraft/proto/play/clientbound/packet_player_chat.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPlayerChat(Packet): __slots__ = ( 'id', 'filterType', 'filterTypeMask', 'formattedMessage', 'index', 'networkName', 'networkTargetName', 'plainMessage', 'previousMessages', 'previousSignature', 'salt', 'senderName', 'senderTeam', 'senderUuid', 'signature', 'signedChatContent', 'timestamp', 'type', 'unsignedChatContent', 'unsignedContent' ) @@ -28,29 +28,29 @@ class PacketPlayerChat(Packet): unsignedChatContent : tuple unsignedContent : tuple - def __init__(self, proto:int, - filterType:int=None, - filterTypeMask:Union[None, list]=None, - formattedMessage:tuple=None, - index:int=None, - networkName:str=None, - networkTargetName:tuple=None, - plainMessage:str=None, - previousMessages:bytes=None, - previousSignature:tuple=None, - salt:int=None, - senderName:str=None, - senderTeam:tuple=None, - senderUuid:str=None, - signature:Union[bytes,tuple]=None, - signedChatContent:str=None, - timestamp:int=None, - type:int=None, - unsignedChatContent:tuple=None, - unsignedContent:tuple=None, + def __init__(self, + filterType:int | None = None, + filterTypeMask:Union[None, list] | None = None, + formattedMessage:tuple | None = None, + index:int | None = None, + networkName:str | None = None, + networkTargetName:tuple | None = None, + plainMessage:str | None = None, + previousMessages:bytes | None = None, + previousSignature:tuple | None = None, + salt:int | None = None, + senderName:str | None = None, + senderTeam:tuple | None = None, + senderUuid:str | None = None, + signature:Union[bytes,tuple] | None = None, + signedChatContent:str | None = None, + timestamp:int | None = None, + type:int | None = None, + unsignedChatContent:tuple | None = None, + unsignedContent:tuple | None = None, **kwargs ): - super().__init__(proto, + super().__init__( filterType=filterType, filterTypeMask=filterTypeMask, formattedMessage=formattedMessage, diff --git a/aiocraft/mc/proto/play/clientbound/packet_player_info.py b/aiocraft/proto/play/clientbound/packet_player_info.py similarity index 99% rename from aiocraft/mc/proto/play/clientbound/packet_player_info.py rename to aiocraft/proto/play/clientbound/packet_player_info.py index 9fef603..2843805 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_player_info.py +++ b/aiocraft/proto/play/clientbound/packet_player_info.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPlayerInfo(Packet): __slots__ = ( 'id', 'action', 'data' ) @@ -11,12 +11,12 @@ class PacketPlayerInfo(Packet): action : int data : list - def __init__(self, proto:int, - action:int=None, - data:list=None, + def __init__(self, + action:int | None = None, + data:list | None = None, **kwargs ): - super().__init__(proto, + super().__init__( action=action, data=data ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_player_remove.py b/aiocraft/proto/play/clientbound/packet_player_remove.py similarity index 80% rename from aiocraft/mc/proto/play/clientbound/packet_player_remove.py rename to aiocraft/proto/play/clientbound/packet_player_remove.py index 99017e5..c74a8c2 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_player_remove.py +++ b/aiocraft/proto/play/clientbound/packet_player_remove.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPlayerRemove(Packet): __slots__ = ( 'id', 'players' ) players : list - def __init__(self, proto:int, - players:list=None, + def __init__(self, + players:list | None = None, **kwargs ): - super().__init__(proto, + super().__init__( players=players ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_playerlist_header.py b/aiocraft/proto/play/clientbound/packet_playerlist_header.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_playerlist_header.py rename to aiocraft/proto/play/clientbound/packet_playerlist_header.py index 8197d9d..4efc27b 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_playerlist_header.py +++ b/aiocraft/proto/play/clientbound/packet_playerlist_header.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPlayerlistHeader(Packet): __slots__ = ( 'id', 'footer', 'header' ) @@ -11,12 +11,12 @@ class PacketPlayerlistHeader(Packet): footer : str header : str - def __init__(self, proto:int, - footer:str=None, - header:str=None, + def __init__(self, + footer:str | None = None, + header:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( footer=footer, header=header ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_position.py b/aiocraft/proto/play/clientbound/packet_position.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_position.py rename to aiocraft/proto/play/clientbound/packet_position.py index 2c2587d..8c70d87 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_position.py +++ b/aiocraft/proto/play/clientbound/packet_position.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPosition(Packet): __slots__ = ( 'id', 'dismountVehicle', 'flags', 'pitch', 'teleportId', 'x', 'y', 'yaw', 'z' ) @@ -17,18 +17,18 @@ class PacketPosition(Packet): yaw : float z : float - def __init__(self, proto:int, - dismountVehicle:bool=None, - flags:int=None, - pitch:float=None, - teleportId:int=None, - x:float=None, - y:float=None, - yaw:float=None, - z:float=None, + def __init__(self, + dismountVehicle:bool | None = None, + flags:int | None = None, + pitch:float | None = None, + teleportId:int | None = None, + x:float | None = None, + y:float | None = None, + yaw:float | None = None, + z:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( dismountVehicle=dismountVehicle, flags=flags, pitch=pitch, diff --git a/aiocraft/mc/proto/play/clientbound/packet_profileless_chat.py b/aiocraft/proto/play/clientbound/packet_profileless_chat.py similarity index 77% rename from aiocraft/mc/proto/play/clientbound/packet_profileless_chat.py rename to aiocraft/proto/play/clientbound/packet_profileless_chat.py index dcda916..598f5b2 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_profileless_chat.py +++ b/aiocraft/proto/play/clientbound/packet_profileless_chat.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketProfilelessChat(Packet): __slots__ = ( 'id', 'message', 'name', 'target', 'type' ) @@ -13,14 +13,14 @@ class PacketProfilelessChat(Packet): target : tuple type : int - def __init__(self, proto:int, - message:str=None, - name:str=None, - target:tuple=None, - type:int=None, + def __init__(self, + message:str | None = None, + name:str | None = None, + target:tuple | None = None, + type:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( message=message, name=name, target=target, diff --git a/aiocraft/mc/proto/play/clientbound/packet_rel_entity_move.py b/aiocraft/proto/play/clientbound/packet_rel_entity_move.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_rel_entity_move.py rename to aiocraft/proto/play/clientbound/packet_rel_entity_move.py index b23b976..bd831ed 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_rel_entity_move.py +++ b/aiocraft/proto/play/clientbound/packet_rel_entity_move.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketRelEntityMove(Packet): __slots__ = ( 'id', 'dX', 'dY', 'dZ', 'entityId', 'onGround' ) @@ -14,15 +14,15 @@ class PacketRelEntityMove(Packet): entityId : int onGround : bool - def __init__(self, proto:int, - dX:int=None, - dY:int=None, - dZ:int=None, - entityId:int=None, - onGround:bool=None, + def __init__(self, + dX:int | None = None, + dY:int | None = None, + dZ:int | None = None, + entityId:int | None = None, + onGround:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( dX=dX, dY=dY, dZ=dZ, diff --git a/aiocraft/mc/proto/play/clientbound/packet_remove_entity_effect.py b/aiocraft/proto/play/clientbound/packet_remove_entity_effect.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_remove_entity_effect.py rename to aiocraft/proto/play/clientbound/packet_remove_entity_effect.py index c71d48d..bea5849 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_remove_entity_effect.py +++ b/aiocraft/proto/play/clientbound/packet_remove_entity_effect.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketRemoveEntityEffect(Packet): __slots__ = ( 'id', 'effectId', 'entityId' ) @@ -11,12 +11,12 @@ class PacketRemoveEntityEffect(Packet): effectId : int entityId : int - def __init__(self, proto:int, - effectId:int=None, - entityId:int=None, + def __init__(self, + effectId:int | None = None, + entityId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( effectId=effectId, entityId=entityId ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_resource_pack_send.py b/aiocraft/proto/play/clientbound/packet_resource_pack_send.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_resource_pack_send.py rename to aiocraft/proto/play/clientbound/packet_resource_pack_send.py index 82aeb12..0748f35 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_resource_pack_send.py +++ b/aiocraft/proto/play/clientbound/packet_resource_pack_send.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketResourcePackSend(Packet): __slots__ = ( 'id', 'forced', 'hash', 'promptMessage', 'url' ) @@ -13,14 +13,14 @@ class PacketResourcePackSend(Packet): promptMessage : tuple url : str - def __init__(self, proto:int, - forced:bool=None, - hash:str=None, - promptMessage:tuple=None, - url:str=None, + def __init__(self, + forced:bool | None = None, + hash:str | None = None, + promptMessage:tuple | None = None, + url:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( forced=forced, hash=hash, promptMessage=promptMessage, diff --git a/aiocraft/mc/proto/play/clientbound/packet_respawn.py b/aiocraft/proto/play/clientbound/packet_respawn.py similarity index 94% rename from aiocraft/mc/proto/play/clientbound/packet_respawn.py rename to aiocraft/proto/play/clientbound/packet_respawn.py index ac40146..f391077 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_respawn.py +++ b/aiocraft/proto/play/clientbound/packet_respawn.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketRespawn(Packet): __slots__ = ( 'id', 'copyMetadata', 'death', 'difficulty', 'dimension', 'gamemode', 'hashedSeed', 'isDebug', 'isFlat', 'levelType', 'previousGamemode', 'worldName' ) @@ -20,21 +20,21 @@ class PacketRespawn(Packet): previousGamemode : int worldName : str - def __init__(self, proto:int, - copyMetadata:bool=None, - death:tuple=None, - difficulty:int=None, - dimension:Union[dict,int,str]=None, - gamemode:int=None, - hashedSeed:int=None, - isDebug:bool=None, - isFlat:bool=None, - levelType:str=None, - previousGamemode:int=None, - worldName:str=None, + def __init__(self, + copyMetadata:bool | None = None, + death:tuple | None = None, + difficulty:int | None = None, + dimension:Union[dict,int,str] | None = None, + gamemode:int | None = None, + hashedSeed:int | None = None, + isDebug:bool | None = None, + isFlat:bool | None = None, + levelType:str | None = None, + previousGamemode:int | None = None, + worldName:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( copyMetadata=copyMetadata, death=death, difficulty=difficulty, diff --git a/aiocraft/mc/proto/play/clientbound/packet_scoreboard_display_objective.py b/aiocraft/proto/play/clientbound/packet_scoreboard_display_objective.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_scoreboard_display_objective.py rename to aiocraft/proto/play/clientbound/packet_scoreboard_display_objective.py index 3eb854c..111d3c5 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_scoreboard_display_objective.py +++ b/aiocraft/proto/play/clientbound/packet_scoreboard_display_objective.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketScoreboardDisplayObjective(Packet): __slots__ = ( 'id', 'name', 'position' ) @@ -11,12 +11,12 @@ class PacketScoreboardDisplayObjective(Packet): name : str position : int - def __init__(self, proto:int, - name:str=None, - position:int=None, + def __init__(self, + name:str | None = None, + position:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( name=name, position=position ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_scoreboard_objective.py b/aiocraft/proto/play/clientbound/packet_scoreboard_objective.py similarity index 97% rename from aiocraft/mc/proto/play/clientbound/packet_scoreboard_objective.py rename to aiocraft/proto/play/clientbound/packet_scoreboard_objective.py index 0eabf8e..f200303 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_scoreboard_objective.py +++ b/aiocraft/proto/play/clientbound/packet_scoreboard_objective.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketScoreboardObjective(Packet): __slots__ = ( 'id', 'action', 'displayText', 'name', 'type' ) @@ -13,14 +13,14 @@ class PacketScoreboardObjective(Packet): name : str type : Union[Union[None, int],Union[None, str]] - def __init__(self, proto:int, - action:int=None, - displayText:Union[None, str]=None, - name:str=None, - type:Union[Union[None, int],Union[None, str]]=None, + def __init__(self, + action:int | None = None, + displayText:Union[None, str] | None = None, + name:str | None = None, + type:Union[Union[None, int],Union[None, str]] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( action=action, displayText=displayText, name=name, diff --git a/aiocraft/mc/proto/play/clientbound/packet_scoreboard_score.py b/aiocraft/proto/play/clientbound/packet_scoreboard_score.py similarity index 97% rename from aiocraft/mc/proto/play/clientbound/packet_scoreboard_score.py rename to aiocraft/proto/play/clientbound/packet_scoreboard_score.py index abbc70d..7ca7171 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_scoreboard_score.py +++ b/aiocraft/proto/play/clientbound/packet_scoreboard_score.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketScoreboardScore(Packet): __slots__ = ( 'id', 'action', 'itemName', 'scoreName', 'value' ) @@ -13,14 +13,14 @@ class PacketScoreboardScore(Packet): scoreName : str value : Union[None, int] - def __init__(self, proto:int, - action:int=None, - itemName:str=None, - scoreName:str=None, - value:Union[None, int]=None, + def __init__(self, + action:int | None = None, + itemName:str | None = None, + scoreName:str | None = None, + value:Union[None, int] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( action=action, itemName=itemName, scoreName=scoreName, diff --git a/aiocraft/mc/proto/play/clientbound/packet_scoreboard_team.py b/aiocraft/proto/play/clientbound/packet_scoreboard_team.py similarity index 82% rename from aiocraft/mc/proto/play/clientbound/packet_scoreboard_team.py rename to aiocraft/proto/play/clientbound/packet_scoreboard_team.py index 300c80a..ea63d3a 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_scoreboard_team.py +++ b/aiocraft/proto/play/clientbound/packet_scoreboard_team.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketScoreboardTeam(Packet): __slots__ = ( 'id', 'collisionRule', 'color', 'friendlyFire', 'mode', 'name', 'nameTagVisibility', 'players', 'prefix', 'suffix', 'team' ) @@ -19,20 +19,20 @@ class PacketScoreboardTeam(Packet): suffix : Union[None, str] team : str - def __init__(self, proto:int, - collisionRule:Union[None, str]=None, - color:Union[None, int]=None, - friendlyFire:Union[None, int]=None, - mode:int=None, - name:Union[None, str]=None, - nameTagVisibility:Union[None, str]=None, - players:Union[None, list]=None, - prefix:Union[None, str]=None, - suffix:Union[None, str]=None, - team:str=None, + def __init__(self, + collisionRule:Union[None, str] | None = None, + color:Union[None, int] | None = None, + friendlyFire:Union[None, int] | None = None, + mode:int | None = None, + name:Union[None, str] | None = None, + nameTagVisibility:Union[None, str] | None = None, + players:Union[None, list] | None = None, + prefix:Union[None, str] | None = None, + suffix:Union[None, str] | None = None, + team:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( collisionRule=collisionRule, color=color, friendlyFire=friendlyFire, diff --git a/aiocraft/mc/proto/play/clientbound/packet_sculk_vibration_signal.py b/aiocraft/proto/play/clientbound/packet_sculk_vibration_signal.py similarity index 86% rename from aiocraft/mc/proto/play/clientbound/packet_sculk_vibration_signal.py rename to aiocraft/proto/play/clientbound/packet_sculk_vibration_signal.py index e3c466b..57469a6 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_sculk_vibration_signal.py +++ b/aiocraft/proto/play/clientbound/packet_sculk_vibration_signal.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSculkVibrationSignal(Packet): __slots__ = ( 'id', 'arrivalTicks', 'destination', 'destinationIdentifier', 'sourcePosition' ) @@ -13,14 +13,14 @@ class PacketSculkVibrationSignal(Packet): destinationIdentifier : str sourcePosition : tuple - def __init__(self, proto:int, - arrivalTicks:int=None, - destination:Union[None, int, tuple]=None, - destinationIdentifier:str=None, - sourcePosition:tuple=None, + def __init__(self, + arrivalTicks:int | None = None, + destination:Union[None, int, tuple] | None = None, + destinationIdentifier:str | None = None, + sourcePosition:tuple | None = None, **kwargs ): - super().__init__(proto, + super().__init__( arrivalTicks=arrivalTicks, destination=destination, destinationIdentifier=destinationIdentifier, diff --git a/aiocraft/mc/proto/play/clientbound/packet_select_advancement_tab.py b/aiocraft/proto/play/clientbound/packet_select_advancement_tab.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_select_advancement_tab.py rename to aiocraft/proto/play/clientbound/packet_select_advancement_tab.py index b7cdf66..42672f4 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_select_advancement_tab.py +++ b/aiocraft/proto/play/clientbound/packet_select_advancement_tab.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSelectAdvancementTab(Packet): __slots__ = ( 'id', 'id' ) id : tuple - def __init__(self, proto:int, - id:tuple=None, + def __init__(self, + id:tuple | None = None, **kwargs ): - super().__init__(proto, + super().__init__( id=id ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_server_data.py b/aiocraft/proto/play/clientbound/packet_server_data.py similarity index 82% rename from aiocraft/mc/proto/play/clientbound/packet_server_data.py rename to aiocraft/proto/play/clientbound/packet_server_data.py index 0257720..66a5409 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_server_data.py +++ b/aiocraft/proto/play/clientbound/packet_server_data.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketServerData(Packet): __slots__ = ( 'id', 'enforcesSecureChat', 'icon', 'motd', 'previewsChat' ) @@ -13,14 +13,14 @@ class PacketServerData(Packet): motd : tuple previewsChat : bool - def __init__(self, proto:int, - enforcesSecureChat:bool=None, - icon:tuple=None, - motd:tuple=None, - previewsChat:bool=None, + def __init__(self, + enforcesSecureChat:bool | None = None, + icon:tuple | None = None, + motd:tuple | None = None, + previewsChat:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( enforcesSecureChat=enforcesSecureChat, icon=icon, motd=motd, diff --git a/aiocraft/mc/proto/play/clientbound/packet_set_compression.py b/aiocraft/proto/play/clientbound/packet_set_compression.py similarity index 81% rename from aiocraft/mc/proto/play/clientbound/packet_set_compression.py rename to aiocraft/proto/play/clientbound/packet_set_compression.py index 5c0fd2a..bfd0486 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_set_compression.py +++ b/aiocraft/proto/play/clientbound/packet_set_compression.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSetCompression(Packet): __slots__ = ( 'id', 'threshold' ) threshold : int - def __init__(self, proto:int, - threshold:int=None, + def __init__(self, + threshold:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( threshold=threshold ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_set_cooldown.py b/aiocraft/proto/play/clientbound/packet_set_cooldown.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_set_cooldown.py rename to aiocraft/proto/play/clientbound/packet_set_cooldown.py index cf2df09..163780b 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_set_cooldown.py +++ b/aiocraft/proto/play/clientbound/packet_set_cooldown.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSetCooldown(Packet): __slots__ = ( 'id', 'cooldownTicks', 'itemID' ) @@ -11,12 +11,12 @@ class PacketSetCooldown(Packet): cooldownTicks : int itemID : int - def __init__(self, proto:int, - cooldownTicks:int=None, - itemID:int=None, + def __init__(self, + cooldownTicks:int | None = None, + itemID:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( cooldownTicks=cooldownTicks, itemID=itemID ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_set_passengers.py b/aiocraft/proto/play/clientbound/packet_set_passengers.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_set_passengers.py rename to aiocraft/proto/play/clientbound/packet_set_passengers.py index ee1b4ff..7803d2a 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_set_passengers.py +++ b/aiocraft/proto/play/clientbound/packet_set_passengers.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSetPassengers(Packet): __slots__ = ( 'id', 'entityId', 'passengers' ) @@ -11,12 +11,12 @@ class PacketSetPassengers(Packet): entityId : int passengers : list - def __init__(self, proto:int, - entityId:int=None, - passengers:list=None, + def __init__(self, + entityId:int | None = None, + passengers:list | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, passengers=passengers ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_set_slot.py b/aiocraft/proto/play/clientbound/packet_set_slot.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_set_slot.py rename to aiocraft/proto/play/clientbound/packet_set_slot.py index 4563ba8..2e16328 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_set_slot.py +++ b/aiocraft/proto/play/clientbound/packet_set_slot.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSetSlot(Packet): __slots__ = ( 'id', 'item', 'slot', 'stateId', 'windowId' ) @@ -13,14 +13,14 @@ class PacketSetSlot(Packet): stateId : int windowId : int - def __init__(self, proto:int, - item:Item=None, - slot:int=None, - stateId:int=None, - windowId:int=None, + def __init__(self, + item:Item | None = None, + slot:int | None = None, + stateId:int | None = None, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( item=item, slot=slot, stateId=stateId, diff --git a/aiocraft/mc/proto/play/clientbound/packet_set_title_subtitle.py b/aiocraft/proto/play/clientbound/packet_set_title_subtitle.py similarity index 86% rename from aiocraft/mc/proto/play/clientbound/packet_set_title_subtitle.py rename to aiocraft/proto/play/clientbound/packet_set_title_subtitle.py index 7cb8a12..360d039 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_set_title_subtitle.py +++ b/aiocraft/proto/play/clientbound/packet_set_title_subtitle.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSetTitleSubtitle(Packet): __slots__ = ( 'id', 'text' ) text : str - def __init__(self, proto:int, - text:str=None, + def __init__(self, + text:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( text=text ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_set_title_text.py b/aiocraft/proto/play/clientbound/packet_set_title_text.py similarity index 86% rename from aiocraft/mc/proto/play/clientbound/packet_set_title_text.py rename to aiocraft/proto/play/clientbound/packet_set_title_text.py index 369fc3f..b951461 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_set_title_text.py +++ b/aiocraft/proto/play/clientbound/packet_set_title_text.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSetTitleText(Packet): __slots__ = ( 'id', 'text' ) text : str - def __init__(self, proto:int, - text:str=None, + def __init__(self, + text:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( text=text ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_set_title_time.py b/aiocraft/proto/play/clientbound/packet_set_title_time.py similarity index 86% rename from aiocraft/mc/proto/play/clientbound/packet_set_title_time.py rename to aiocraft/proto/play/clientbound/packet_set_title_time.py index f091054..8aa6ffc 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_set_title_time.py +++ b/aiocraft/proto/play/clientbound/packet_set_title_time.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSetTitleTime(Packet): __slots__ = ( 'id', 'fadeIn', 'fadeOut', 'stay' ) @@ -12,13 +12,13 @@ class PacketSetTitleTime(Packet): fadeOut : int stay : int - def __init__(self, proto:int, - fadeIn:int=None, - fadeOut:int=None, - stay:int=None, + def __init__(self, + fadeIn:int | None = None, + fadeOut:int | None = None, + stay:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( fadeIn=fadeIn, fadeOut=fadeOut, stay=stay diff --git a/aiocraft/mc/proto/play/clientbound/packet_should_display_chat_preview.py b/aiocraft/proto/play/clientbound/packet_should_display_chat_preview.py similarity index 82% rename from aiocraft/mc/proto/play/clientbound/packet_should_display_chat_preview.py rename to aiocraft/proto/play/clientbound/packet_should_display_chat_preview.py index 5eac8e1..60cd221 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_should_display_chat_preview.py +++ b/aiocraft/proto/play/clientbound/packet_should_display_chat_preview.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketShouldDisplayChatPreview(Packet): __slots__ = ( 'id', 'should_display_chat_preview' ) should_display_chat_preview : bool - def __init__(self, proto:int, - should_display_chat_preview:bool=None, + def __init__(self, + should_display_chat_preview:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( should_display_chat_preview=should_display_chat_preview ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_simulation_distance.py b/aiocraft/proto/play/clientbound/packet_simulation_distance.py similarity index 85% rename from aiocraft/mc/proto/play/clientbound/packet_simulation_distance.py rename to aiocraft/proto/play/clientbound/packet_simulation_distance.py index 800d4de..afdc4f4 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_simulation_distance.py +++ b/aiocraft/proto/play/clientbound/packet_simulation_distance.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSimulationDistance(Packet): __slots__ = ( 'id', 'distance' ) distance : int - def __init__(self, proto:int, - distance:int=None, + def __init__(self, + distance:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( distance=distance ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_sound_effect.py b/aiocraft/proto/play/clientbound/packet_sound_effect.py similarity index 89% rename from aiocraft/mc/proto/play/clientbound/packet_sound_effect.py rename to aiocraft/proto/play/clientbound/packet_sound_effect.py index 256c841..449105e 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_sound_effect.py +++ b/aiocraft/proto/play/clientbound/packet_sound_effect.py @@ -2,39 +2,42 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSoundEffect(Packet): - __slots__ = ( 'id', 'parrottedEntityType', 'pitch', 'seed', 'soundCategory', 'soundId', 'volume', 'x', 'y', 'z' ) + __slots__ = ( 'id', 'parrottedEntityType', 'pitch', 'seed', 'soundCategory', 'soundEvent', 'soundId', 'volume', 'x', 'y', 'z' ) parrottedEntityType : str pitch : Union[float,int] seed : int soundCategory : int + soundEvent : Union[None, dict] soundId : int volume : float x : int y : int z : int - def __init__(self, proto:int, - parrottedEntityType:str=None, - pitch:Union[float,int]=None, - seed:int=None, - soundCategory:int=None, - soundId:int=None, - volume:float=None, - x:int=None, - y:int=None, - z:int=None, + def __init__(self, + parrottedEntityType:str | None = None, + pitch:Union[float,int] | None = None, + seed:int | None = None, + soundCategory:int | None = None, + soundEvent:Union[None, dict] | None = None, + soundId:int | None = None, + volume:float | None = None, + x:int | None = None, + y:int | None = None, + z:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( parrottedEntityType=parrottedEntityType, pitch=pitch, seed=seed, soundCategory=soundCategory, + soundEvent=soundEvent, soundId=soundId, volume=volume, x=x, @@ -124,5 +127,5 @@ class PacketSoundEffect(Packet): 758 : [ ( 'soundId', VarInt ), ( 'soundCategory', VarInt ), ( 'x', Int ), ( 'y', Int ), ( 'z', Int ), ( 'volume', Float ), ( 'pitch', Float ) ], 759 : [ ( 'soundId', VarInt ), ( 'soundCategory', VarInt ), ( 'x', Int ), ( 'y', Int ), ( 'z', Int ), ( 'volume', Float ), ( 'pitch', Float ), ( 'seed', Long ) ], 760 : [ ( 'soundId', VarInt ), ( 'soundCategory', VarInt ), ( 'x', Int ), ( 'y', Int ), ( 'z', Int ), ( 'volume', Float ), ( 'pitch', Float ), ( 'seed', Long ) ], - 761 : [ ( 'soundId', VarInt ), ( 'soundCategory', VarInt ), ( 'x', Int ), ( 'y', Int ), ( 'z', Int ), ( 'volume', Float ), ( 'pitch', Float ), ( 'seed', Long ) ] + 761 : [ ( 'soundId', VarInt ), ( 'soundEvent', SwitchType('soundId', { 0 : StructType(( 'resource', String ), ( 'range', OptionalType(Float, ) ), ) }, None, ) ), ( 'soundCategory', VarInt ), ( 'x', Int ), ( 'y', Int ), ( 'z', Int ), ( 'volume', Float ), ( 'pitch', Float ), ( 'seed', Long ) ] } diff --git a/aiocraft/mc/proto/play/clientbound/packet_spawn_entity.py b/aiocraft/proto/play/clientbound/packet_spawn_entity.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_spawn_entity.py rename to aiocraft/proto/play/clientbound/packet_spawn_entity.py index 4fd6c56..882f450 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_spawn_entity.py +++ b/aiocraft/proto/play/clientbound/packet_spawn_entity.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSpawnEntity(Packet): __slots__ = ( 'id', 'entityId', 'entityUUID', 'headPitch', 'objectData', 'objectUUID', 'pitch', 'type', 'velocityX', 'velocityY', 'velocityZ', 'x', 'y', 'yaw', 'z' ) @@ -23,24 +23,24 @@ class PacketSpawnEntity(Packet): yaw : int z : Union[float,int] - def __init__(self, proto:int, - entityId:int=None, - entityUUID:str=None, - headPitch:int=None, - objectData:Union[dict,int]=None, - objectUUID:str=None, - pitch:int=None, - type:int=None, - velocityX:int=None, - velocityY:int=None, - velocityZ:int=None, - x:Union[float,int]=None, - y:Union[float,int]=None, - yaw:int=None, - z:Union[float,int]=None, + def __init__(self, + entityId:int | None = None, + entityUUID:str | None = None, + headPitch:int | None = None, + objectData:Union[dict,int] | None = None, + objectUUID:str | None = None, + pitch:int | None = None, + type:int | None = None, + velocityX:int | None = None, + velocityY:int | None = None, + velocityZ:int | None = None, + x:Union[float,int] | None = None, + y:Union[float,int] | None = None, + yaw:int | None = None, + z:Union[float,int] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, entityUUID=entityUUID, headPitch=headPitch, diff --git a/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_experience_orb.py b/aiocraft/proto/play/clientbound/packet_spawn_entity_experience_orb.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_spawn_entity_experience_orb.py rename to aiocraft/proto/play/clientbound/packet_spawn_entity_experience_orb.py index 5f0c63b..a786cd8 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_experience_orb.py +++ b/aiocraft/proto/play/clientbound/packet_spawn_entity_experience_orb.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSpawnEntityExperienceOrb(Packet): __slots__ = ( 'id', 'count', 'entityId', 'x', 'y', 'z' ) @@ -14,15 +14,15 @@ class PacketSpawnEntityExperienceOrb(Packet): y : Union[float,int] z : Union[float,int] - def __init__(self, proto:int, - count:int=None, - entityId:int=None, - x:Union[float,int]=None, - y:Union[float,int]=None, - z:Union[float,int]=None, + def __init__(self, + count:int | None = None, + entityId:int | None = None, + x:Union[float,int] | None = None, + y:Union[float,int] | None = None, + z:Union[float,int] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( count=count, entityId=entityId, x=x, diff --git a/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_living.py b/aiocraft/proto/play/clientbound/packet_spawn_entity_living.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_spawn_entity_living.py rename to aiocraft/proto/play/clientbound/packet_spawn_entity_living.py index 6fd7d6b..3eca72e 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_living.py +++ b/aiocraft/proto/play/clientbound/packet_spawn_entity_living.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSpawnEntityLiving(Packet): __slots__ = ( 'id', 'entityId', 'entityUUID', 'headPitch', 'metadata', 'pitch', 'type', 'velocityX', 'velocityY', 'velocityZ', 'x', 'y', 'yaw', 'z' ) @@ -22,23 +22,23 @@ class PacketSpawnEntityLiving(Packet): yaw : int z : Union[float,int] - def __init__(self, proto:int, - entityId:int=None, - entityUUID:str=None, - headPitch:int=None, - metadata:dict=None, - pitch:int=None, - type:int=None, - velocityX:int=None, - velocityY:int=None, - velocityZ:int=None, - x:Union[float,int]=None, - y:Union[float,int]=None, - yaw:int=None, - z:Union[float,int]=None, + def __init__(self, + entityId:int | None = None, + entityUUID:str | None = None, + headPitch:int | None = None, + metadata:dict | None = None, + pitch:int | None = None, + type:int | None = None, + velocityX:int | None = None, + velocityY:int | None = None, + velocityZ:int | None = None, + x:Union[float,int] | None = None, + y:Union[float,int] | None = None, + yaw:int | None = None, + z:Union[float,int] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, entityUUID=entityUUID, headPitch=headPitch, diff --git a/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_painting.py b/aiocraft/proto/play/clientbound/packet_spawn_entity_painting.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_spawn_entity_painting.py rename to aiocraft/proto/play/clientbound/packet_spawn_entity_painting.py index 7be9765..8a53557 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_painting.py +++ b/aiocraft/proto/play/clientbound/packet_spawn_entity_painting.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSpawnEntityPainting(Packet): __slots__ = ( 'id', 'direction', 'entityId', 'entityUUID', 'location', 'title' ) @@ -14,15 +14,15 @@ class PacketSpawnEntityPainting(Packet): location : tuple title : Union[int,str] - def __init__(self, proto:int, - direction:int=None, - entityId:int=None, - entityUUID:str=None, - location:tuple=None, - title:Union[int,str]=None, + def __init__(self, + direction:int | None = None, + entityId:int | None = None, + entityUUID:str | None = None, + location:tuple | None = None, + title:Union[int,str] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( direction=direction, entityId=entityId, entityUUID=entityUUID, diff --git a/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_weather.py b/aiocraft/proto/play/clientbound/packet_spawn_entity_weather.py similarity index 94% rename from aiocraft/mc/proto/play/clientbound/packet_spawn_entity_weather.py rename to aiocraft/proto/play/clientbound/packet_spawn_entity_weather.py index 5e5dabe..bf9d335 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_spawn_entity_weather.py +++ b/aiocraft/proto/play/clientbound/packet_spawn_entity_weather.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSpawnEntityWeather(Packet): __slots__ = ( 'id', 'entityId', 'type', 'x', 'y', 'z' ) @@ -14,15 +14,15 @@ class PacketSpawnEntityWeather(Packet): y : Union[float,int] z : Union[float,int] - def __init__(self, proto:int, - entityId:int=None, - type:int=None, - x:Union[float,int]=None, - y:Union[float,int]=None, - z:Union[float,int]=None, + def __init__(self, + entityId:int | None = None, + type:int | None = None, + x:Union[float,int] | None = None, + y:Union[float,int] | None = None, + z:Union[float,int] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, type=type, x=x, diff --git a/aiocraft/mc/proto/play/clientbound/packet_spawn_position.py b/aiocraft/proto/play/clientbound/packet_spawn_position.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_spawn_position.py rename to aiocraft/proto/play/clientbound/packet_spawn_position.py index 58e4056..e86a838 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_spawn_position.py +++ b/aiocraft/proto/play/clientbound/packet_spawn_position.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSpawnPosition(Packet): __slots__ = ( 'id', 'angle', 'location' ) @@ -11,12 +11,12 @@ class PacketSpawnPosition(Packet): angle : float location : tuple - def __init__(self, proto:int, - angle:float=None, - location:tuple=None, + def __init__(self, + angle:float | None = None, + location:tuple | None = None, **kwargs ): - super().__init__(proto, + super().__init__( angle=angle, location=location ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_statistics.py b/aiocraft/proto/play/clientbound/packet_statistics.py similarity index 98% rename from aiocraft/mc/proto/play/clientbound/packet_statistics.py rename to aiocraft/proto/play/clientbound/packet_statistics.py index 8f3f20e..56de655 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_statistics.py +++ b/aiocraft/proto/play/clientbound/packet_statistics.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketStatistics(Packet): __slots__ = ( 'id', 'entries' ) entries : list - def __init__(self, proto:int, - entries:list=None, + def __init__(self, + entries:list | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entries=entries ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_stop_sound.py b/aiocraft/proto/play/clientbound/packet_stop_sound.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_stop_sound.py rename to aiocraft/proto/play/clientbound/packet_stop_sound.py index 318bf08..97aeb2c 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_stop_sound.py +++ b/aiocraft/proto/play/clientbound/packet_stop_sound.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketStopSound(Packet): __slots__ = ( 'id', 'flags', 'sound', 'source' ) @@ -12,13 +12,13 @@ class PacketStopSound(Packet): sound : Union[None, str] source : Union[None, int] - def __init__(self, proto:int, - flags:int=None, - sound:Union[None, str]=None, - source:Union[None, int]=None, + def __init__(self, + flags:int | None = None, + sound:Union[None, str] | None = None, + source:Union[None, int] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( flags=flags, sound=sound, source=source diff --git a/aiocraft/mc/proto/play/clientbound/packet_system_chat.py b/aiocraft/proto/play/clientbound/packet_system_chat.py similarity index 81% rename from aiocraft/mc/proto/play/clientbound/packet_system_chat.py rename to aiocraft/proto/play/clientbound/packet_system_chat.py index f571567..3268ec1 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_system_chat.py +++ b/aiocraft/proto/play/clientbound/packet_system_chat.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSystemChat(Packet): __slots__ = ( 'id', 'content', 'isActionBar', 'type' ) @@ -12,13 +12,13 @@ class PacketSystemChat(Packet): isActionBar : bool type : int - def __init__(self, proto:int, - content:str=None, - isActionBar:bool=None, - type:int=None, + def __init__(self, + content:str | None = None, + isActionBar:bool | None = None, + type:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( content=content, isActionBar=isActionBar, type=type diff --git a/aiocraft/mc/proto/play/clientbound/packet_tab_complete.py b/aiocraft/proto/play/clientbound/packet_tab_complete.py similarity index 97% rename from aiocraft/mc/proto/play/clientbound/packet_tab_complete.py rename to aiocraft/proto/play/clientbound/packet_tab_complete.py index 00b9f6e..0deb195 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_tab_complete.py +++ b/aiocraft/proto/play/clientbound/packet_tab_complete.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketTabComplete(Packet): __slots__ = ( 'id', 'length', 'matches', 'start', 'transactionId' ) @@ -13,14 +13,14 @@ class PacketTabComplete(Packet): start : int transactionId : int - def __init__(self, proto:int, - length:int=None, - matches:list=None, - start:int=None, - transactionId:int=None, + def __init__(self, + length:int | None = None, + matches:list | None = None, + start:int | None = None, + transactionId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( length=length, matches=matches, start=start, diff --git a/aiocraft/mc/proto/play/clientbound/packet_tags.py b/aiocraft/proto/play/clientbound/packet_tags.py similarity index 94% rename from aiocraft/mc/proto/play/clientbound/packet_tags.py rename to aiocraft/proto/play/clientbound/packet_tags.py index 501ccd3..3318a9a 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_tags.py +++ b/aiocraft/proto/play/clientbound/packet_tags.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketTags(Packet): __slots__ = ( 'id', 'blockTags', 'entityTags', 'fluidTags', 'itemTags', 'tags' ) @@ -14,15 +14,15 @@ class PacketTags(Packet): itemTags : list tags : list - def __init__(self, proto:int, - blockTags:list=None, - entityTags:list=None, - fluidTags:list=None, - itemTags:list=None, - tags:list=None, + def __init__(self, + blockTags:list | None = None, + entityTags:list | None = None, + fluidTags:list | None = None, + itemTags:list | None = None, + tags:list | None = None, **kwargs ): - super().__init__(proto, + super().__init__( blockTags=blockTags, entityTags=entityTags, fluidTags=fluidTags, diff --git a/aiocraft/mc/proto/play/clientbound/packet_teams.py b/aiocraft/proto/play/clientbound/packet_teams.py similarity index 98% rename from aiocraft/mc/proto/play/clientbound/packet_teams.py rename to aiocraft/proto/play/clientbound/packet_teams.py index f26c587..566fefa 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_teams.py +++ b/aiocraft/proto/play/clientbound/packet_teams.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketTeams(Packet): __slots__ = ( 'id', 'collisionRule', 'color', 'formatting', 'friendlyFire', 'mode', 'name', 'nameTagVisibility', 'players', 'prefix', 'suffix', 'team' ) @@ -20,21 +20,21 @@ class PacketTeams(Packet): suffix : Union[None, str] team : str - def __init__(self, proto:int, - collisionRule:Union[None, str]=None, - color:Union[None, int]=None, - formatting:Union[None, int]=None, - friendlyFire:Union[None, int]=None, - mode:int=None, - name:Union[None, str]=None, - nameTagVisibility:Union[None, str]=None, - players:Union[None, list]=None, - prefix:Union[None, str]=None, - suffix:Union[None, str]=None, - team:str=None, + def __init__(self, + collisionRule:Union[None, str] | None = None, + color:Union[None, int] | None = None, + formatting:Union[None, int] | None = None, + friendlyFire:Union[None, int] | None = None, + mode:int | None = None, + name:Union[None, str] | None = None, + nameTagVisibility:Union[None, str] | None = None, + players:Union[None, list] | None = None, + prefix:Union[None, str] | None = None, + suffix:Union[None, str] | None = None, + team:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( collisionRule=collisionRule, color=color, formatting=formatting, diff --git a/aiocraft/mc/proto/play/clientbound/packet_tile_entity_data.py b/aiocraft/proto/play/clientbound/packet_tile_entity_data.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_tile_entity_data.py rename to aiocraft/proto/play/clientbound/packet_tile_entity_data.py index a33bdad..624ee8b 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_tile_entity_data.py +++ b/aiocraft/proto/play/clientbound/packet_tile_entity_data.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketTileEntityData(Packet): __slots__ = ( 'id', 'action', 'location', 'nbtData' ) @@ -12,13 +12,13 @@ class PacketTileEntityData(Packet): location : tuple nbtData : Optional[dict] - def __init__(self, proto:int, - action:int=None, - location:tuple=None, - nbtData:Optional[dict]=None, + def __init__(self, + action:int | None = None, + location:tuple | None = None, + nbtData:Optional[dict] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( action=action, location=location, nbtData=nbtData diff --git a/aiocraft/mc/proto/play/clientbound/packet_title.py b/aiocraft/proto/play/clientbound/packet_title.py similarity index 97% rename from aiocraft/mc/proto/play/clientbound/packet_title.py rename to aiocraft/proto/play/clientbound/packet_title.py index 4f0d4f8..fc8616e 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_title.py +++ b/aiocraft/proto/play/clientbound/packet_title.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketTitle(Packet): __slots__ = ( 'id', 'action', 'fadeIn', 'fadeOut', 'stay', 'text' ) @@ -14,15 +14,15 @@ class PacketTitle(Packet): stay : Union[None, int] text : Union[None, str] - def __init__(self, proto:int, - action:int=None, - fadeIn:Union[None, int]=None, - fadeOut:Union[None, int]=None, - stay:Union[None, int]=None, - text:Union[None, str]=None, + def __init__(self, + action:int | None = None, + fadeIn:Union[None, int] | None = None, + fadeOut:Union[None, int] | None = None, + stay:Union[None, int] | None = None, + text:Union[None, str] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( action=action, fadeIn=fadeIn, fadeOut=fadeOut, diff --git a/aiocraft/mc/proto/play/clientbound/packet_trade_list.py b/aiocraft/proto/play/clientbound/packet_trade_list.py similarity index 97% rename from aiocraft/mc/proto/play/clientbound/packet_trade_list.py rename to aiocraft/proto/play/clientbound/packet_trade_list.py index 79cc18e..bff64d7 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_trade_list.py +++ b/aiocraft/proto/play/clientbound/packet_trade_list.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketTradeList(Packet): __slots__ = ( 'id', 'canRestock', 'experience', 'isRegularVillager', 'trades', 'villagerLevel', 'windowId' ) @@ -15,16 +15,16 @@ class PacketTradeList(Packet): villagerLevel : int windowId : int - def __init__(self, proto:int, - canRestock:bool=None, - experience:int=None, - isRegularVillager:bool=None, - trades:list=None, - villagerLevel:int=None, - windowId:int=None, + def __init__(self, + canRestock:bool | None = None, + experience:int | None = None, + isRegularVillager:bool | None = None, + trades:list | None = None, + villagerLevel:int | None = None, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( canRestock=canRestock, experience=experience, isRegularVillager=isRegularVillager, diff --git a/aiocraft/mc/proto/play/clientbound/packet_transaction.py b/aiocraft/proto/play/clientbound/packet_transaction.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_transaction.py rename to aiocraft/proto/play/clientbound/packet_transaction.py index db80cdb..3e167f8 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_transaction.py +++ b/aiocraft/proto/play/clientbound/packet_transaction.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketTransaction(Packet): __slots__ = ( 'id', 'accepted', 'action', 'windowId' ) @@ -12,13 +12,13 @@ class PacketTransaction(Packet): action : int windowId : int - def __init__(self, proto:int, - accepted:bool=None, - action:int=None, - windowId:int=None, + def __init__(self, + accepted:bool | None = None, + action:int | None = None, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( accepted=accepted, action=action, windowId=windowId diff --git a/aiocraft/mc/proto/play/clientbound/packet_unload_chunk.py b/aiocraft/proto/play/clientbound/packet_unload_chunk.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_unload_chunk.py rename to aiocraft/proto/play/clientbound/packet_unload_chunk.py index bd20c87..7e354f7 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_unload_chunk.py +++ b/aiocraft/proto/play/clientbound/packet_unload_chunk.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUnloadChunk(Packet): __slots__ = ( 'id', 'chunkX', 'chunkZ' ) @@ -11,12 +11,12 @@ class PacketUnloadChunk(Packet): chunkX : int chunkZ : int - def __init__(self, proto:int, - chunkX:int=None, - chunkZ:int=None, + def __init__(self, + chunkX:int | None = None, + chunkZ:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( chunkX=chunkX, chunkZ=chunkZ ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_unlock_recipes.py b/aiocraft/proto/play/clientbound/packet_unlock_recipes.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_unlock_recipes.py rename to aiocraft/proto/play/clientbound/packet_unlock_recipes.py index 5717f48..0e18e21 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_unlock_recipes.py +++ b/aiocraft/proto/play/clientbound/packet_unlock_recipes.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUnlockRecipes(Packet): __slots__ = ( 'id', 'action', 'blastFurnaceOpen', 'craftingBookOpen', 'filteringBlastFurnace', 'filteringCraftable', 'filteringSmeltable', 'filteringSmoker', 'notification', 'recipes', 'recipes1', 'recipes2', 'smeltingBookOpen', 'smokerBookOpen' ) @@ -22,23 +22,23 @@ class PacketUnlockRecipes(Packet): smeltingBookOpen : bool smokerBookOpen : bool - def __init__(self, proto:int, - action:int=None, - blastFurnaceOpen:bool=None, - craftingBookOpen:bool=None, - filteringBlastFurnace:bool=None, - filteringCraftable:bool=None, - filteringSmeltable:bool=None, - filteringSmoker:bool=None, - notification:bool=None, - recipes:list=None, - recipes1:list=None, - recipes2:Union[Union[None, list],list]=None, - smeltingBookOpen:bool=None, - smokerBookOpen:bool=None, + def __init__(self, + action:int | None = None, + blastFurnaceOpen:bool | None = None, + craftingBookOpen:bool | None = None, + filteringBlastFurnace:bool | None = None, + filteringCraftable:bool | None = None, + filteringSmeltable:bool | None = None, + filteringSmoker:bool | None = None, + notification:bool | None = None, + recipes:list | None = None, + recipes1:list | None = None, + recipes2:Union[Union[None, list],list] | None = None, + smeltingBookOpen:bool | None = None, + smokerBookOpen:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( action=action, blastFurnaceOpen=blastFurnaceOpen, craftingBookOpen=craftingBookOpen, diff --git a/aiocraft/mc/proto/play/clientbound/packet_update_attributes.py b/aiocraft/proto/play/clientbound/packet_update_attributes.py similarity index 87% rename from aiocraft/mc/proto/play/clientbound/packet_update_attributes.py rename to aiocraft/proto/play/clientbound/packet_update_attributes.py index 01b5be7..1cb4b3f 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_update_attributes.py +++ b/aiocraft/proto/play/clientbound/packet_update_attributes.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUpdateAttributes(Packet): __slots__ = ( 'id', 'entityId', 'properties' ) @@ -11,12 +11,12 @@ class PacketUpdateAttributes(Packet): entityId : int properties : list - def __init__(self, proto:int, - entityId:int=None, - properties:list=None, + def __init__(self, + entityId:int | None = None, + properties:list | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, properties=properties ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_update_entity_nbt.py b/aiocraft/proto/play/clientbound/packet_update_entity_nbt.py similarity index 79% rename from aiocraft/mc/proto/play/clientbound/packet_update_entity_nbt.py rename to aiocraft/proto/play/clientbound/packet_update_entity_nbt.py index ac9f284..750dfa0 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_update_entity_nbt.py +++ b/aiocraft/proto/play/clientbound/packet_update_entity_nbt.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUpdateEntityNbt(Packet): __slots__ = ( 'id', 'entityId', 'tag' ) @@ -11,12 +11,12 @@ class PacketUpdateEntityNbt(Packet): entityId : int tag : dict - def __init__(self, proto:int, - entityId:int=None, - tag:dict=None, + def __init__(self, + entityId:int | None = None, + tag:dict | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, tag=tag ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_update_health.py b/aiocraft/proto/play/clientbound/packet_update_health.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_update_health.py rename to aiocraft/proto/play/clientbound/packet_update_health.py index f4974ab..8e63106 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_update_health.py +++ b/aiocraft/proto/play/clientbound/packet_update_health.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUpdateHealth(Packet): __slots__ = ( 'id', 'food', 'foodSaturation', 'health' ) @@ -12,13 +12,13 @@ class PacketUpdateHealth(Packet): foodSaturation : float health : float - def __init__(self, proto:int, - food:int=None, - foodSaturation:float=None, - health:float=None, + def __init__(self, + food:int | None = None, + foodSaturation:float | None = None, + health:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( food=food, foodSaturation=foodSaturation, health=health diff --git a/aiocraft/mc/proto/play/clientbound/packet_update_light.py b/aiocraft/proto/play/clientbound/packet_update_light.py similarity index 93% rename from aiocraft/mc/proto/play/clientbound/packet_update_light.py rename to aiocraft/proto/play/clientbound/packet_update_light.py index bbe0ace..cdb79bb 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_update_light.py +++ b/aiocraft/proto/play/clientbound/packet_update_light.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUpdateLight(Packet): __slots__ = ( 'id', 'blockLight', 'blockLightMask', 'chunkX', 'chunkZ', 'data', 'emptyBlockLightMask', 'emptySkyLightMask', 'skyLight', 'skyLightMask', 'trustEdges' ) @@ -19,20 +19,20 @@ class PacketUpdateLight(Packet): skyLightMask : Union[int,list] trustEdges : bool - def __init__(self, proto:int, - blockLight:list=None, - blockLightMask:Union[int,list]=None, - chunkX:int=None, - chunkZ:int=None, - data:bytes=None, - emptyBlockLightMask:Union[int,list]=None, - emptySkyLightMask:Union[int,list]=None, - skyLight:list=None, - skyLightMask:Union[int,list]=None, - trustEdges:bool=None, + def __init__(self, + blockLight:list | None = None, + blockLightMask:Union[int,list] | None = None, + chunkX:int | None = None, + chunkZ:int | None = None, + data:bytes | None = None, + emptyBlockLightMask:Union[int,list] | None = None, + emptySkyLightMask:Union[int,list] | None = None, + skyLight:list | None = None, + skyLightMask:Union[int,list] | None = None, + trustEdges:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( blockLight=blockLight, blockLightMask=blockLightMask, chunkX=chunkX, diff --git a/aiocraft/mc/proto/play/clientbound/packet_update_sign.py b/aiocraft/proto/play/clientbound/packet_update_sign.py similarity index 85% rename from aiocraft/mc/proto/play/clientbound/packet_update_sign.py rename to aiocraft/proto/play/clientbound/packet_update_sign.py index 890041c..7055bcc 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_update_sign.py +++ b/aiocraft/proto/play/clientbound/packet_update_sign.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUpdateSign(Packet): __slots__ = ( 'id', 'location', 'text1', 'text2', 'text3', 'text4' ) @@ -14,15 +14,15 @@ class PacketUpdateSign(Packet): text3 : str text4 : str - def __init__(self, proto:int, - location:tuple=None, - text1:str=None, - text2:str=None, - text3:str=None, - text4:str=None, + def __init__(self, + location:tuple | None = None, + text1:str | None = None, + text2:str | None = None, + text3:str | None = None, + text4:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( location=location, text1=text1, text2=text2, diff --git a/aiocraft/mc/proto/play/clientbound/packet_update_time.py b/aiocraft/proto/play/clientbound/packet_update_time.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_update_time.py rename to aiocraft/proto/play/clientbound/packet_update_time.py index 8bd3ce7..c2cf7e9 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_update_time.py +++ b/aiocraft/proto/play/clientbound/packet_update_time.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUpdateTime(Packet): __slots__ = ( 'id', 'age', 'time' ) @@ -11,12 +11,12 @@ class PacketUpdateTime(Packet): age : int time : int - def __init__(self, proto:int, - age:int=None, - time:int=None, + def __init__(self, + age:int | None = None, + time:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( age=age, time=time ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_update_view_distance.py b/aiocraft/proto/play/clientbound/packet_update_view_distance.py similarity index 92% rename from aiocraft/mc/proto/play/clientbound/packet_update_view_distance.py rename to aiocraft/proto/play/clientbound/packet_update_view_distance.py index cb2cc74..998e5e1 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_update_view_distance.py +++ b/aiocraft/proto/play/clientbound/packet_update_view_distance.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUpdateViewDistance(Packet): __slots__ = ( 'id', 'viewDistance' ) viewDistance : int - def __init__(self, proto:int, - viewDistance:int=None, + def __init__(self, + viewDistance:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( viewDistance=viewDistance ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_update_view_position.py b/aiocraft/proto/play/clientbound/packet_update_view_position.py similarity index 93% rename from aiocraft/mc/proto/play/clientbound/packet_update_view_position.py rename to aiocraft/proto/play/clientbound/packet_update_view_position.py index 5c96d7d..ab561ac 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_update_view_position.py +++ b/aiocraft/proto/play/clientbound/packet_update_view_position.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUpdateViewPosition(Packet): __slots__ = ( 'id', 'chunkX', 'chunkZ' ) @@ -11,12 +11,12 @@ class PacketUpdateViewPosition(Packet): chunkX : int chunkZ : int - def __init__(self, proto:int, - chunkX:int=None, - chunkZ:int=None, + def __init__(self, + chunkX:int | None = None, + chunkZ:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( chunkX=chunkX, chunkZ=chunkZ ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_vehicle_move.py b/aiocraft/proto/play/clientbound/packet_vehicle_move.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_vehicle_move.py rename to aiocraft/proto/play/clientbound/packet_vehicle_move.py index 1aeefac..0faf3ca 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_vehicle_move.py +++ b/aiocraft/proto/play/clientbound/packet_vehicle_move.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketVehicleMove(Packet): __slots__ = ( 'id', 'pitch', 'x', 'y', 'yaw', 'z' ) @@ -14,15 +14,15 @@ class PacketVehicleMove(Packet): yaw : float z : float - def __init__(self, proto:int, - pitch:float=None, - x:float=None, - y:float=None, - yaw:float=None, - z:float=None, + def __init__(self, + pitch:float | None = None, + x:float | None = None, + y:float | None = None, + yaw:float | None = None, + z:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( pitch=pitch, x=x, y=y, diff --git a/aiocraft/mc/proto/play/clientbound/packet_window_items.py b/aiocraft/proto/play/clientbound/packet_window_items.py similarity index 95% rename from aiocraft/mc/proto/play/clientbound/packet_window_items.py rename to aiocraft/proto/play/clientbound/packet_window_items.py index acde428..e633a34 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_window_items.py +++ b/aiocraft/proto/play/clientbound/packet_window_items.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketWindowItems(Packet): __slots__ = ( 'id', 'carriedItem', 'items', 'stateId', 'windowId' ) @@ -13,14 +13,14 @@ class PacketWindowItems(Packet): stateId : int windowId : int - def __init__(self, proto:int, - carriedItem:Item=None, - items:list=None, - stateId:int=None, - windowId:int=None, + def __init__(self, + carriedItem:Item | None = None, + items:list | None = None, + stateId:int | None = None, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( carriedItem=carriedItem, items=items, stateId=stateId, diff --git a/aiocraft/mc/proto/play/clientbound/packet_world_border.py b/aiocraft/proto/play/clientbound/packet_world_border.py similarity index 98% rename from aiocraft/mc/proto/play/clientbound/packet_world_border.py rename to aiocraft/proto/play/clientbound/packet_world_border.py index 50bfed0..05fad5c 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_world_border.py +++ b/aiocraft/proto/play/clientbound/packet_world_border.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketWorldBorder(Packet): __slots__ = ( 'id', 'action', 'new_radius', 'old_radius', 'portalBoundary', 'radius', 'speed', 'warning_blocks', 'warning_time', 'x', 'z' ) @@ -19,20 +19,20 @@ class PacketWorldBorder(Packet): x : Union[None, float] z : Union[None, float] - def __init__(self, proto:int, - action:int=None, - new_radius:Union[None, float]=None, - old_radius:Union[None, float]=None, - portalBoundary:Union[None, int]=None, - radius:Union[None, float]=None, - speed:Union[None, int]=None, - warning_blocks:Union[None, int]=None, - warning_time:Union[None, int]=None, - x:Union[None, float]=None, - z:Union[None, float]=None, + def __init__(self, + action:int | None = None, + new_radius:Union[None, float] | None = None, + old_radius:Union[None, float] | None = None, + portalBoundary:Union[None, int] | None = None, + radius:Union[None, float] | None = None, + speed:Union[None, int] | None = None, + warning_blocks:Union[None, int] | None = None, + warning_time:Union[None, int] | None = None, + x:Union[None, float] | None = None, + z:Union[None, float] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( action=action, new_radius=new_radius, old_radius=old_radius, diff --git a/aiocraft/mc/proto/play/clientbound/packet_world_border_center.py b/aiocraft/proto/play/clientbound/packet_world_border_center.py similarity index 86% rename from aiocraft/mc/proto/play/clientbound/packet_world_border_center.py rename to aiocraft/proto/play/clientbound/packet_world_border_center.py index 284a27c..deb2aec 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_world_border_center.py +++ b/aiocraft/proto/play/clientbound/packet_world_border_center.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketWorldBorderCenter(Packet): __slots__ = ( 'id', 'x', 'z' ) @@ -11,12 +11,12 @@ class PacketWorldBorderCenter(Packet): x : float z : float - def __init__(self, proto:int, - x:float=None, - z:float=None, + def __init__(self, + x:float | None = None, + z:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( x=x, z=z ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_world_border_lerp_size.py b/aiocraft/proto/play/clientbound/packet_world_border_lerp_size.py similarity index 87% rename from aiocraft/mc/proto/play/clientbound/packet_world_border_lerp_size.py rename to aiocraft/proto/play/clientbound/packet_world_border_lerp_size.py index 13707f7..be16344 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_world_border_lerp_size.py +++ b/aiocraft/proto/play/clientbound/packet_world_border_lerp_size.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketWorldBorderLerpSize(Packet): __slots__ = ( 'id', 'newDiameter', 'oldDiameter', 'speed' ) @@ -12,13 +12,13 @@ class PacketWorldBorderLerpSize(Packet): oldDiameter : float speed : int - def __init__(self, proto:int, - newDiameter:float=None, - oldDiameter:float=None, - speed:int=None, + def __init__(self, + newDiameter:float | None = None, + oldDiameter:float | None = None, + speed:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( newDiameter=newDiameter, oldDiameter=oldDiameter, speed=speed diff --git a/aiocraft/mc/proto/play/clientbound/packet_world_border_size.py b/aiocraft/proto/play/clientbound/packet_world_border_size.py similarity index 86% rename from aiocraft/mc/proto/play/clientbound/packet_world_border_size.py rename to aiocraft/proto/play/clientbound/packet_world_border_size.py index cdc1c78..3023c87 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_world_border_size.py +++ b/aiocraft/proto/play/clientbound/packet_world_border_size.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketWorldBorderSize(Packet): __slots__ = ( 'id', 'diameter' ) diameter : float - def __init__(self, proto:int, - diameter:float=None, + def __init__(self, + diameter:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( diameter=diameter ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_world_border_warning_delay.py b/aiocraft/proto/play/clientbound/packet_world_border_warning_delay.py similarity index 87% rename from aiocraft/mc/proto/play/clientbound/packet_world_border_warning_delay.py rename to aiocraft/proto/play/clientbound/packet_world_border_warning_delay.py index 16c57a2..14b8450 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_world_border_warning_delay.py +++ b/aiocraft/proto/play/clientbound/packet_world_border_warning_delay.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketWorldBorderWarningDelay(Packet): __slots__ = ( 'id', 'warningTime' ) warningTime : int - def __init__(self, proto:int, - warningTime:int=None, + def __init__(self, + warningTime:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( warningTime=warningTime ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_world_border_warning_reach.py b/aiocraft/proto/play/clientbound/packet_world_border_warning_reach.py similarity index 87% rename from aiocraft/mc/proto/play/clientbound/packet_world_border_warning_reach.py rename to aiocraft/proto/play/clientbound/packet_world_border_warning_reach.py index 2a18111..7fe3a75 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_world_border_warning_reach.py +++ b/aiocraft/proto/play/clientbound/packet_world_border_warning_reach.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketWorldBorderWarningReach(Packet): __slots__ = ( 'id', 'warningBlocks' ) warningBlocks : int - def __init__(self, proto:int, - warningBlocks:int=None, + def __init__(self, + warningBlocks:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( warningBlocks=warningBlocks ) diff --git a/aiocraft/mc/proto/play/clientbound/packet_world_event.py b/aiocraft/proto/play/clientbound/packet_world_event.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_world_event.py rename to aiocraft/proto/play/clientbound/packet_world_event.py index 3d90ae2..87b74d9 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_world_event.py +++ b/aiocraft/proto/play/clientbound/packet_world_event.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketWorldEvent(Packet): __slots__ = ( 'id', 'data', 'effectId', 'is_global', 'location' ) @@ -13,14 +13,14 @@ class PacketWorldEvent(Packet): is_global : bool location : tuple - def __init__(self, proto:int, - data:int=None, - effectId:int=None, - is_global:bool=None, - location:tuple=None, + def __init__(self, + data:int | None = None, + effectId:int | None = None, + is_global:bool | None = None, + location:tuple | None = None, **kwargs ): - super().__init__(proto, + super().__init__( data=data, effectId=effectId, is_global=is_global, diff --git a/aiocraft/mc/proto/play/clientbound/packet_world_particles.py b/aiocraft/proto/play/clientbound/packet_world_particles.py similarity index 96% rename from aiocraft/mc/proto/play/clientbound/packet_world_particles.py rename to aiocraft/proto/play/clientbound/packet_world_particles.py index 9a012b7..1bdf600 100644 --- a/aiocraft/mc/proto/play/clientbound/packet_world_particles.py +++ b/aiocraft/proto/play/clientbound/packet_world_particles.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketWorldParticles(Packet): __slots__ = ( 'id', 'data', 'longDistance', 'offsetX', 'offsetY', 'offsetZ', 'particleData', 'particleId', 'particles', 'x', 'y', 'z' ) @@ -20,21 +20,21 @@ class PacketWorldParticles(Packet): y : float z : float - def __init__(self, proto:int, - data:Union[Union[Item, None, int],Union[None, list],bytes]=None, - longDistance:bool=None, - offsetX:float=None, - offsetY:float=None, - offsetZ:float=None, - particleData:float=None, - particleId:int=None, - particles:int=None, - x:float=None, - y:float=None, - z:float=None, + def __init__(self, + data:Union[Union[Item, None, int],Union[None, list],bytes] | None = None, + longDistance:bool | None = None, + offsetX:float | None = None, + offsetY:float | None = None, + offsetZ:float | None = None, + particleData:float | None = None, + particleId:int | None = None, + particles:int | None = None, + x:float | None = None, + y:float | None = None, + z:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( data=data, longDistance=longDistance, offsetX=offsetX, diff --git a/aiocraft/mc/proto/play/serverbound/__init__.py b/aiocraft/proto/play/serverbound/__init__.py similarity index 98% rename from aiocraft/mc/proto/play/serverbound/__init__.py rename to aiocraft/proto/play/serverbound/__init__.py index 0b78842..848c5aa 100644 --- a/aiocraft/mc/proto/play/serverbound/__init__.py +++ b/aiocraft/proto/play/serverbound/__init__.py @@ -55,7 +55,7 @@ from .packet_chat_command import PacketChatCommand from .packet_chat_message import PacketChatMessage from .packet_chat_preview import PacketChatPreview from .packet_message_acknowledgement import PacketMessageAcknowledgement -from .packet_session import PacketSession +from .packet_chat_session_update import PacketChatSessionUpdate REGISTRY = { 47 : { 0 : PacketKeepAlive, 1 : PacketChat, 2 : PacketUseEntity, 3 : PacketFlying, 4 : PacketPosition, 5 : PacketLook, 6 : PacketPositionLook, 7 : PacketBlockDig, 8 : PacketBlockPlace, 9 : PacketHeldItemSlot, 10 : PacketArmAnimation, 11 : PacketEntityAction, 12 : PacketSteerVehicle, 13 : PacketCloseWindow, 14 : PacketWindowClick, 15 : PacketTransaction, 16 : PacketSetCreativeSlot, 17 : PacketEnchantItem, 18 : PacketUpdateSign, 19 : PacketAbilities, 20 : PacketTabComplete, 21 : PacketSettings, 22 : PacketClientCommand, 23 : PacketCustomPayload, 24 : PacketSpectate, 25 : PacketResourcePackReceive }, @@ -98,5 +98,5 @@ REGISTRY = { 758 : { 0 : PacketTeleportConfirm, 1 : PacketQueryBlockNbt, 2 : PacketSetDifficulty, 3 : PacketChat, 4 : PacketClientCommand, 5 : PacketSettings, 6 : PacketTabComplete, 7 : PacketEnchantItem, 8 : PacketWindowClick, 9 : PacketCloseWindow, 10 : PacketCustomPayload, 11 : PacketEditBook, 12 : PacketQueryEntityNbt, 13 : PacketUseEntity, 14 : PacketGenerateStructure, 15 : PacketKeepAlive, 16 : PacketLockDifficulty, 17 : PacketPosition, 18 : PacketPositionLook, 19 : PacketLook, 20 : PacketFlying, 21 : PacketVehicleMove, 22 : PacketSteerBoat, 23 : PacketPickItem, 24 : PacketCraftRecipeRequest, 25 : PacketAbilities, 26 : PacketBlockDig, 27 : PacketEntityAction, 28 : PacketSteerVehicle, 29 : PacketPong, 30 : PacketRecipeBook, 31 : PacketDisplayedRecipe, 32 : PacketNameItem, 33 : PacketResourcePackReceive, 34 : PacketAdvancementTab, 35 : PacketSelectTrade, 36 : PacketSetBeaconEffect, 37 : PacketHeldItemSlot, 38 : PacketUpdateCommandBlock, 39 : PacketUpdateCommandBlockMinecart, 40 : PacketSetCreativeSlot, 41 : PacketUpdateJigsawBlock, 42 : PacketUpdateStructureBlock, 43 : PacketUpdateSign, 44 : PacketArmAnimation, 45 : PacketSpectate, 46 : PacketBlockPlace, 47 : PacketUseItem }, 759 : { 0 : PacketTeleportConfirm, 1 : PacketQueryBlockNbt, 2 : PacketSetDifficulty, 3 : PacketChatCommand, 4 : PacketChatMessage, 5 : PacketChatPreview, 6 : PacketClientCommand, 7 : PacketSettings, 8 : PacketTabComplete, 9 : PacketEnchantItem, 10 : PacketWindowClick, 11 : PacketCloseWindow, 12 : PacketCustomPayload, 13 : PacketEditBook, 14 : PacketQueryEntityNbt, 15 : PacketUseEntity, 16 : PacketGenerateStructure, 17 : PacketKeepAlive, 18 : PacketLockDifficulty, 19 : PacketPosition, 20 : PacketPositionLook, 21 : PacketLook, 22 : PacketFlying, 23 : PacketVehicleMove, 24 : PacketSteerBoat, 25 : PacketPickItem, 26 : PacketCraftRecipeRequest, 27 : PacketAbilities, 28 : PacketBlockDig, 29 : PacketEntityAction, 30 : PacketSteerVehicle, 31 : PacketPong, 32 : PacketRecipeBook, 33 : PacketDisplayedRecipe, 34 : PacketNameItem, 35 : PacketResourcePackReceive, 36 : PacketAdvancementTab, 37 : PacketSelectTrade, 38 : PacketSetBeaconEffect, 39 : PacketHeldItemSlot, 40 : PacketUpdateCommandBlock, 41 : PacketUpdateCommandBlockMinecart, 42 : PacketSetCreativeSlot, 43 : PacketUpdateJigsawBlock, 44 : PacketUpdateStructureBlock, 45 : PacketUpdateSign, 46 : PacketArmAnimation, 47 : PacketSpectate, 48 : PacketBlockPlace, 49 : PacketUseItem }, 760 : { 0 : PacketTeleportConfirm, 1 : PacketQueryBlockNbt, 2 : PacketSetDifficulty, 3 : PacketMessageAcknowledgement, 4 : PacketChatCommand, 5 : PacketChatMessage, 6 : PacketChatPreview, 7 : PacketClientCommand, 8 : PacketSettings, 9 : PacketTabComplete, 10 : PacketEnchantItem, 11 : PacketWindowClick, 12 : PacketCloseWindow, 13 : PacketCustomPayload, 14 : PacketEditBook, 15 : PacketQueryEntityNbt, 16 : PacketUseEntity, 17 : PacketGenerateStructure, 18 : PacketKeepAlive, 19 : PacketLockDifficulty, 20 : PacketPosition, 21 : PacketPositionLook, 22 : PacketLook, 23 : PacketFlying, 24 : PacketVehicleMove, 25 : PacketSteerBoat, 26 : PacketPickItem, 27 : PacketCraftRecipeRequest, 28 : PacketAbilities, 29 : PacketBlockDig, 30 : PacketEntityAction, 31 : PacketSteerVehicle, 32 : PacketPong, 33 : PacketRecipeBook, 34 : PacketDisplayedRecipe, 35 : PacketNameItem, 36 : PacketResourcePackReceive, 37 : PacketAdvancementTab, 38 : PacketSelectTrade, 39 : PacketSetBeaconEffect, 40 : PacketHeldItemSlot, 41 : PacketUpdateCommandBlock, 42 : PacketUpdateCommandBlockMinecart, 43 : PacketSetCreativeSlot, 44 : PacketUpdateJigsawBlock, 45 : PacketUpdateStructureBlock, 46 : PacketUpdateSign, 47 : PacketArmAnimation, 48 : PacketSpectate, 49 : PacketBlockPlace, 50 : PacketUseItem }, - 761 : { 0 : PacketTeleportConfirm, 1 : PacketQueryBlockNbt, 2 : PacketSetDifficulty, 3 : PacketMessageAcknowledgement, 4 : PacketChatCommand, 5 : PacketChatMessage, 6 : PacketClientCommand, 7 : PacketSettings, 8 : PacketTabComplete, 9 : PacketEnchantItem, 10 : PacketWindowClick, 11 : PacketCloseWindow, 12 : PacketCustomPayload, 13 : PacketEditBook, 14 : PacketQueryEntityNbt, 15 : PacketUseEntity, 16 : PacketGenerateStructure, 17 : PacketKeepAlive, 18 : PacketLockDifficulty, 19 : PacketPosition, 20 : PacketPositionLook, 21 : PacketLook, 22 : PacketFlying, 23 : PacketVehicleMove, 24 : PacketSteerBoat, 25 : PacketPickItem, 26 : PacketCraftRecipeRequest, 27 : PacketAbilities, 28 : PacketBlockDig, 29 : PacketEntityAction, 30 : PacketSteerVehicle, 31 : PacketPong, 32 : PacketSession, 33 : PacketRecipeBook, 34 : PacketDisplayedRecipe, 35 : PacketNameItem, 36 : PacketResourcePackReceive, 37 : PacketAdvancementTab, 38 : PacketSelectTrade, 39 : PacketSetBeaconEffect, 40 : PacketHeldItemSlot, 41 : PacketUpdateCommandBlock, 42 : PacketUpdateCommandBlockMinecart, 43 : PacketSetCreativeSlot, 44 : PacketUpdateJigsawBlock, 45 : PacketUpdateStructureBlock, 46 : PacketUpdateSign, 47 : PacketArmAnimation, 48 : PacketSpectate, 49 : PacketBlockPlace, 50 : PacketUseItem } + 761 : { 0 : PacketTeleportConfirm, 1 : PacketQueryBlockNbt, 2 : PacketSetDifficulty, 3 : PacketMessageAcknowledgement, 4 : PacketChatCommand, 5 : PacketChatMessage, 6 : PacketClientCommand, 7 : PacketSettings, 8 : PacketTabComplete, 9 : PacketEnchantItem, 10 : PacketWindowClick, 11 : PacketCloseWindow, 12 : PacketCustomPayload, 13 : PacketEditBook, 14 : PacketQueryEntityNbt, 15 : PacketUseEntity, 16 : PacketGenerateStructure, 17 : PacketKeepAlive, 18 : PacketLockDifficulty, 19 : PacketPosition, 20 : PacketPositionLook, 21 : PacketLook, 22 : PacketFlying, 23 : PacketVehicleMove, 24 : PacketSteerBoat, 25 : PacketPickItem, 26 : PacketCraftRecipeRequest, 27 : PacketAbilities, 28 : PacketBlockDig, 29 : PacketEntityAction, 30 : PacketSteerVehicle, 31 : PacketPong, 32 : PacketChatSessionUpdate, 33 : PacketRecipeBook, 34 : PacketDisplayedRecipe, 35 : PacketNameItem, 36 : PacketResourcePackReceive, 37 : PacketAdvancementTab, 38 : PacketSelectTrade, 39 : PacketSetBeaconEffect, 40 : PacketHeldItemSlot, 41 : PacketUpdateCommandBlock, 42 : PacketUpdateCommandBlockMinecart, 43 : PacketSetCreativeSlot, 44 : PacketUpdateJigsawBlock, 45 : PacketUpdateStructureBlock, 46 : PacketUpdateSign, 47 : PacketArmAnimation, 48 : PacketSpectate, 49 : PacketBlockPlace, 50 : PacketUseItem } } diff --git a/aiocraft/mc/proto/play/serverbound/packet_abilities.py b/aiocraft/proto/play/serverbound/packet_abilities.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_abilities.py rename to aiocraft/proto/play/serverbound/packet_abilities.py index 6305498..849ede4 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_abilities.py +++ b/aiocraft/proto/play/serverbound/packet_abilities.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketAbilities(Packet): __slots__ = ( 'id', 'flags', 'flyingSpeed', 'walkingSpeed' ) @@ -12,13 +12,13 @@ class PacketAbilities(Packet): flyingSpeed : float walkingSpeed : float - def __init__(self, proto:int, - flags:int=None, - flyingSpeed:float=None, - walkingSpeed:float=None, + def __init__(self, + flags:int | None = None, + flyingSpeed:float | None = None, + walkingSpeed:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( flags=flags, flyingSpeed=flyingSpeed, walkingSpeed=walkingSpeed diff --git a/aiocraft/mc/proto/play/serverbound/packet_advancement_tab.py b/aiocraft/proto/play/serverbound/packet_advancement_tab.py similarity index 96% rename from aiocraft/mc/proto/play/serverbound/packet_advancement_tab.py rename to aiocraft/proto/play/serverbound/packet_advancement_tab.py index 845b0c1..9c09056 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_advancement_tab.py +++ b/aiocraft/proto/play/serverbound/packet_advancement_tab.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketAdvancementTab(Packet): __slots__ = ( 'id', 'action', 'tabId' ) @@ -11,12 +11,12 @@ class PacketAdvancementTab(Packet): action : int tabId : Union[None, str] - def __init__(self, proto:int, - action:int=None, - tabId:Union[None, str]=None, + def __init__(self, + action:int | None = None, + tabId:Union[None, str] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( action=action, tabId=tabId ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_arm_animation.py b/aiocraft/proto/play/serverbound/packet_arm_animation.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_arm_animation.py rename to aiocraft/proto/play/serverbound/packet_arm_animation.py index 3cfee89..0e79de4 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_arm_animation.py +++ b/aiocraft/proto/play/serverbound/packet_arm_animation.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketArmAnimation(Packet): __slots__ = ( 'id', 'hand' ) hand : int - def __init__(self, proto:int, - hand:int=None, + def __init__(self, + hand:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( hand=hand ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_block_dig.py b/aiocraft/proto/play/serverbound/packet_block_dig.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_block_dig.py rename to aiocraft/proto/play/serverbound/packet_block_dig.py index fc97cdc..3b208fb 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_block_dig.py +++ b/aiocraft/proto/play/serverbound/packet_block_dig.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketBlockDig(Packet): __slots__ = ( 'id', 'face', 'location', 'sequence', 'status' ) @@ -13,14 +13,14 @@ class PacketBlockDig(Packet): sequence : int status : int - def __init__(self, proto:int, - face:int=None, - location:tuple=None, - sequence:int=None, - status:int=None, + def __init__(self, + face:int | None = None, + location:tuple | None = None, + sequence:int | None = None, + status:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( face=face, location=location, sequence=sequence, diff --git a/aiocraft/mc/proto/play/serverbound/packet_block_place.py b/aiocraft/proto/play/serverbound/packet_block_place.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_block_place.py rename to aiocraft/proto/play/serverbound/packet_block_place.py index cf1e25a..33bd702 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_block_place.py +++ b/aiocraft/proto/play/serverbound/packet_block_place.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketBlockPlace(Packet): __slots__ = ( 'id', 'cursorX', 'cursorY', 'cursorZ', 'direction', 'hand', 'heldItem', 'insideBlock', 'location', 'sequence' ) @@ -18,19 +18,19 @@ class PacketBlockPlace(Packet): location : tuple sequence : int - def __init__(self, proto:int, - cursorX:Union[float,int]=None, - cursorY:Union[float,int]=None, - cursorZ:Union[float,int]=None, - direction:int=None, - hand:int=None, - heldItem:Item=None, - insideBlock:bool=None, - location:tuple=None, - sequence:int=None, + def __init__(self, + cursorX:Union[float,int] | None = None, + cursorY:Union[float,int] | None = None, + cursorZ:Union[float,int] | None = None, + direction:int | None = None, + hand:int | None = None, + heldItem:Item | None = None, + insideBlock:bool | None = None, + location:tuple | None = None, + sequence:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( cursorX=cursorX, cursorY=cursorY, cursorZ=cursorZ, diff --git a/aiocraft/mc/proto/play/serverbound/packet_chat.py b/aiocraft/proto/play/serverbound/packet_chat.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_chat.py rename to aiocraft/proto/play/serverbound/packet_chat.py index e8f14aa..a4a6d98 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_chat.py +++ b/aiocraft/proto/play/serverbound/packet_chat.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketChat(Packet): __slots__ = ( 'id', 'message' ) message : str - def __init__(self, proto:int, - message:str=None, + def __init__(self, + message:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( message=message ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_chat_command.py b/aiocraft/proto/play/serverbound/packet_chat_command.py similarity index 82% rename from aiocraft/mc/proto/play/serverbound/packet_chat_command.py rename to aiocraft/proto/play/serverbound/packet_chat_command.py index cd87668..bab6344 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_chat_command.py +++ b/aiocraft/proto/play/serverbound/packet_chat_command.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketChatCommand(Packet): __slots__ = ( 'id', 'acknowledged', 'argumentSignatures', 'command', 'lastRejectedMessage', 'messageCount', 'previousMessages', 'salt', 'signedPreview', 'timestamp' ) @@ -18,19 +18,19 @@ class PacketChatCommand(Packet): signedPreview : bool timestamp : int - def __init__(self, proto:int, - acknowledged:bytes=None, - argumentSignatures:list=None, - command:str=None, - lastRejectedMessage:tuple=None, - messageCount:int=None, - previousMessages:bytes=None, - salt:int=None, - signedPreview:bool=None, - timestamp:int=None, + def __init__(self, + acknowledged:bytes | None = None, + argumentSignatures:list | None = None, + command:str | None = None, + lastRejectedMessage:tuple | None = None, + messageCount:int | None = None, + previousMessages:bytes | None = None, + salt:int | None = None, + signedPreview:bool | None = None, + timestamp:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( acknowledged=acknowledged, argumentSignatures=argumentSignatures, command=command, diff --git a/aiocraft/mc/proto/play/serverbound/packet_chat_message.py b/aiocraft/proto/play/serverbound/packet_chat_message.py similarity index 79% rename from aiocraft/mc/proto/play/serverbound/packet_chat_message.py rename to aiocraft/proto/play/serverbound/packet_chat_message.py index 4e22fb2..b8b11e3 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_chat_message.py +++ b/aiocraft/proto/play/serverbound/packet_chat_message.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketChatMessage(Packet): __slots__ = ( 'id', 'acknowledged', 'lastRejectedMessage', 'message', 'offset', 'previousMessages', 'salt', 'signature', 'signedPreview', 'timestamp' ) @@ -18,19 +18,19 @@ class PacketChatMessage(Packet): signedPreview : bool timestamp : int - def __init__(self, proto:int, - acknowledged:bytes=None, - lastRejectedMessage:tuple=None, - message:str=None, - offset:int=None, - previousMessages:bytes=None, - salt:int=None, - signature:Union[bytes,tuple]=None, - signedPreview:bool=None, - timestamp:int=None, + def __init__(self, + acknowledged:bytes | None = None, + lastRejectedMessage:tuple | None = None, + message:str | None = None, + offset:int | None = None, + previousMessages:bytes | None = None, + salt:int | None = None, + signature:Union[bytes,tuple] | None = None, + signedPreview:bool | None = None, + timestamp:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( acknowledged=acknowledged, lastRejectedMessage=lastRejectedMessage, message=message, diff --git a/aiocraft/mc/proto/play/serverbound/packet_chat_preview.py b/aiocraft/proto/play/serverbound/packet_chat_preview.py similarity index 81% rename from aiocraft/mc/proto/play/serverbound/packet_chat_preview.py rename to aiocraft/proto/play/serverbound/packet_chat_preview.py index d1a9c6a..a965720 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_chat_preview.py +++ b/aiocraft/proto/play/serverbound/packet_chat_preview.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketChatPreview(Packet): __slots__ = ( 'id', 'message', 'query' ) @@ -11,12 +11,12 @@ class PacketChatPreview(Packet): message : str query : int - def __init__(self, proto:int, - message:str=None, - query:int=None, + def __init__(self, + message:str | None = None, + query:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( message=message, query=query ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_session.py b/aiocraft/proto/play/serverbound/packet_chat_session_update.py similarity index 73% rename from aiocraft/mc/proto/play/serverbound/packet_session.py rename to aiocraft/proto/play/serverbound/packet_chat_session_update.py index 3c97979..9c0451a 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_session.py +++ b/aiocraft/proto/play/serverbound/packet_chat_session_update.py @@ -2,10 +2,10 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * -class PacketSession(Packet): +class PacketChatSessionUpdate(Packet): __slots__ = ( 'id', 'expireTime', 'publicKey', 'sessionUUID', 'signature' ) expireTime : int @@ -13,14 +13,14 @@ class PacketSession(Packet): sessionUUID : str signature : bytes - def __init__(self, proto:int, - expireTime:int=None, - publicKey:bytes=None, - sessionUUID:str=None, - signature:bytes=None, + def __init__(self, + expireTime:int | None = None, + publicKey:bytes | None = None, + sessionUUID:str | None = None, + signature:bytes | None = None, **kwargs ): - super().__init__(proto, + super().__init__( expireTime=expireTime, publicKey=publicKey, sessionUUID=sessionUUID, diff --git a/aiocraft/mc/proto/play/serverbound/packet_client_command.py b/aiocraft/proto/play/serverbound/packet_client_command.py similarity index 94% rename from aiocraft/mc/proto/play/serverbound/packet_client_command.py rename to aiocraft/proto/play/serverbound/packet_client_command.py index 16c6480..4b8410c 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_client_command.py +++ b/aiocraft/proto/play/serverbound/packet_client_command.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketClientCommand(Packet): __slots__ = ( 'id', 'actionId', 'payload' ) @@ -11,12 +11,12 @@ class PacketClientCommand(Packet): actionId : int payload : int - def __init__(self, proto:int, - actionId:int=None, - payload:int=None, + def __init__(self, + actionId:int | None = None, + payload:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( actionId=actionId, payload=payload ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_close_window.py b/aiocraft/proto/play/serverbound/packet_close_window.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_close_window.py rename to aiocraft/proto/play/serverbound/packet_close_window.py index 18f70cc..f3f4279 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_close_window.py +++ b/aiocraft/proto/play/serverbound/packet_close_window.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketCloseWindow(Packet): __slots__ = ( 'id', 'windowId' ) windowId : int - def __init__(self, proto:int, - windowId:int=None, + def __init__(self, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( windowId=windowId ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_craft_recipe_request.py b/aiocraft/proto/play/serverbound/packet_craft_recipe_request.py similarity index 94% rename from aiocraft/mc/proto/play/serverbound/packet_craft_recipe_request.py rename to aiocraft/proto/play/serverbound/packet_craft_recipe_request.py index dd0d104..01f7ac5 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_craft_recipe_request.py +++ b/aiocraft/proto/play/serverbound/packet_craft_recipe_request.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketCraftRecipeRequest(Packet): __slots__ = ( 'id', 'makeAll', 'recipe', 'windowId' ) @@ -12,13 +12,13 @@ class PacketCraftRecipeRequest(Packet): recipe : Union[int,str] windowId : int - def __init__(self, proto:int, - makeAll:bool=None, - recipe:Union[int,str]=None, - windowId:int=None, + def __init__(self, + makeAll:bool | None = None, + recipe:Union[int,str] | None = None, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( makeAll=makeAll, recipe=recipe, windowId=windowId diff --git a/aiocraft/mc/proto/play/serverbound/packet_crafting_book_data.py b/aiocraft/proto/play/serverbound/packet_crafting_book_data.py similarity index 92% rename from aiocraft/mc/proto/play/serverbound/packet_crafting_book_data.py rename to aiocraft/proto/play/serverbound/packet_crafting_book_data.py index 6ff2696..d43cb57 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_crafting_book_data.py +++ b/aiocraft/proto/play/serverbound/packet_crafting_book_data.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketCraftingBookData(Packet): __slots__ = ( 'id', 'type' ) type : int - def __init__(self, proto:int, - type:int=None, + def __init__(self, + type:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( type=type ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_custom_payload.py b/aiocraft/proto/play/serverbound/packet_custom_payload.py similarity index 96% rename from aiocraft/mc/proto/play/serverbound/packet_custom_payload.py rename to aiocraft/proto/play/serverbound/packet_custom_payload.py index e3bbb90..1a1bfdb 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_custom_payload.py +++ b/aiocraft/proto/play/serverbound/packet_custom_payload.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketCustomPayload(Packet): __slots__ = ( 'id', 'channel', 'data' ) @@ -11,12 +11,12 @@ class PacketCustomPayload(Packet): channel : str data : bytes - def __init__(self, proto:int, - channel:str=None, - data:bytes=None, + def __init__(self, + channel:str | None = None, + data:bytes | None = None, **kwargs ): - super().__init__(proto, + super().__init__( channel=channel, data=data ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_displayed_recipe.py b/aiocraft/proto/play/serverbound/packet_displayed_recipe.py similarity index 87% rename from aiocraft/mc/proto/play/serverbound/packet_displayed_recipe.py rename to aiocraft/proto/play/serverbound/packet_displayed_recipe.py index 7e84bf0..a73159f 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_displayed_recipe.py +++ b/aiocraft/proto/play/serverbound/packet_displayed_recipe.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketDisplayedRecipe(Packet): __slots__ = ( 'id', 'recipeId' ) recipeId : str - def __init__(self, proto:int, - recipeId:str=None, + def __init__(self, + recipeId:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( recipeId=recipeId ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_edit_book.py b/aiocraft/proto/play/serverbound/packet_edit_book.py similarity index 93% rename from aiocraft/mc/proto/play/serverbound/packet_edit_book.py rename to aiocraft/proto/play/serverbound/packet_edit_book.py index 3962c38..1c1de86 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_edit_book.py +++ b/aiocraft/proto/play/serverbound/packet_edit_book.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEditBook(Packet): __slots__ = ( 'id', 'hand', 'new_book', 'pages', 'signing', 'title' ) @@ -14,15 +14,15 @@ class PacketEditBook(Packet): signing : bool title : tuple - def __init__(self, proto:int, - hand:int=None, - new_book:Item=None, - pages:list=None, - signing:bool=None, - title:tuple=None, + def __init__(self, + hand:int | None = None, + new_book:Item | None = None, + pages:list | None = None, + signing:bool | None = None, + title:tuple | None = None, **kwargs ): - super().__init__(proto, + super().__init__( hand=hand, new_book=new_book, pages=pages, diff --git a/aiocraft/mc/proto/play/serverbound/packet_enchant_item.py b/aiocraft/proto/play/serverbound/packet_enchant_item.py similarity index 96% rename from aiocraft/mc/proto/play/serverbound/packet_enchant_item.py rename to aiocraft/proto/play/serverbound/packet_enchant_item.py index 571e485..7be6d25 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_enchant_item.py +++ b/aiocraft/proto/play/serverbound/packet_enchant_item.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEnchantItem(Packet): __slots__ = ( 'id', 'enchantment', 'windowId' ) @@ -11,12 +11,12 @@ class PacketEnchantItem(Packet): enchantment : int windowId : int - def __init__(self, proto:int, - enchantment:int=None, - windowId:int=None, + def __init__(self, + enchantment:int | None = None, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( enchantment=enchantment, windowId=windowId ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_entity_action.py b/aiocraft/proto/play/serverbound/packet_entity_action.py similarity index 96% rename from aiocraft/mc/proto/play/serverbound/packet_entity_action.py rename to aiocraft/proto/play/serverbound/packet_entity_action.py index 4fc15d6..852f55c 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_entity_action.py +++ b/aiocraft/proto/play/serverbound/packet_entity_action.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketEntityAction(Packet): __slots__ = ( 'id', 'actionId', 'entityId', 'jumpBoost' ) @@ -12,13 +12,13 @@ class PacketEntityAction(Packet): entityId : int jumpBoost : int - def __init__(self, proto:int, - actionId:int=None, - entityId:int=None, - jumpBoost:int=None, + def __init__(self, + actionId:int | None = None, + entityId:int | None = None, + jumpBoost:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( actionId=actionId, entityId=entityId, jumpBoost=jumpBoost diff --git a/aiocraft/mc/proto/play/serverbound/packet_flying.py b/aiocraft/proto/play/serverbound/packet_flying.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_flying.py rename to aiocraft/proto/play/serverbound/packet_flying.py index b932618..6b90313 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_flying.py +++ b/aiocraft/proto/play/serverbound/packet_flying.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketFlying(Packet): __slots__ = ( 'id', 'onGround' ) onGround : bool - def __init__(self, proto:int, - onGround:bool=None, + def __init__(self, + onGround:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( onGround=onGround ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_generate_structure.py b/aiocraft/proto/play/serverbound/packet_generate_structure.py similarity index 90% rename from aiocraft/mc/proto/play/serverbound/packet_generate_structure.py rename to aiocraft/proto/play/serverbound/packet_generate_structure.py index dc677ac..e1ea367 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_generate_structure.py +++ b/aiocraft/proto/play/serverbound/packet_generate_structure.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketGenerateStructure(Packet): __slots__ = ( 'id', 'keepJigsaws', 'levels', 'location' ) @@ -12,13 +12,13 @@ class PacketGenerateStructure(Packet): levels : int location : tuple - def __init__(self, proto:int, - keepJigsaws:bool=None, - levels:int=None, - location:tuple=None, + def __init__(self, + keepJigsaws:bool | None = None, + levels:int | None = None, + location:tuple | None = None, **kwargs ): - super().__init__(proto, + super().__init__( keepJigsaws=keepJigsaws, levels=levels, location=location diff --git a/aiocraft/mc/proto/play/serverbound/packet_held_item_slot.py b/aiocraft/proto/play/serverbound/packet_held_item_slot.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_held_item_slot.py rename to aiocraft/proto/play/serverbound/packet_held_item_slot.py index 28c4ad9..85929a3 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_held_item_slot.py +++ b/aiocraft/proto/play/serverbound/packet_held_item_slot.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketHeldItemSlot(Packet): __slots__ = ( 'id', 'slotId' ) slotId : int - def __init__(self, proto:int, - slotId:int=None, + def __init__(self, + slotId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( slotId=slotId ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_keep_alive.py b/aiocraft/proto/play/serverbound/packet_keep_alive.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_keep_alive.py rename to aiocraft/proto/play/serverbound/packet_keep_alive.py index e2cf94c..ff6329a 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_keep_alive.py +++ b/aiocraft/proto/play/serverbound/packet_keep_alive.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketKeepAlive(Packet): __slots__ = ( 'id', 'keepAliveId' ) keepAliveId : int - def __init__(self, proto:int, - keepAliveId:int=None, + def __init__(self, + keepAliveId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( keepAliveId=keepAliveId ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_lock_difficulty.py b/aiocraft/proto/play/serverbound/packet_lock_difficulty.py similarity index 92% rename from aiocraft/mc/proto/play/serverbound/packet_lock_difficulty.py rename to aiocraft/proto/play/serverbound/packet_lock_difficulty.py index e6ac76a..0a78689 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_lock_difficulty.py +++ b/aiocraft/proto/play/serverbound/packet_lock_difficulty.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketLockDifficulty(Packet): __slots__ = ( 'id', 'locked' ) locked : bool - def __init__(self, proto:int, - locked:bool=None, + def __init__(self, + locked:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( locked=locked ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_look.py b/aiocraft/proto/play/serverbound/packet_look.py similarity index 96% rename from aiocraft/mc/proto/play/serverbound/packet_look.py rename to aiocraft/proto/play/serverbound/packet_look.py index 2bcf427..86c7b2c 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_look.py +++ b/aiocraft/proto/play/serverbound/packet_look.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketLook(Packet): __slots__ = ( 'id', 'onGround', 'pitch', 'yaw' ) @@ -12,13 +12,13 @@ class PacketLook(Packet): pitch : float yaw : float - def __init__(self, proto:int, - onGround:bool=None, - pitch:float=None, - yaw:float=None, + def __init__(self, + onGround:bool | None = None, + pitch:float | None = None, + yaw:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( onGround=onGround, pitch=pitch, yaw=yaw diff --git a/aiocraft/mc/proto/play/serverbound/packet_message_acknowledgement.py b/aiocraft/proto/play/serverbound/packet_message_acknowledgement.py similarity index 80% rename from aiocraft/mc/proto/play/serverbound/packet_message_acknowledgement.py rename to aiocraft/proto/play/serverbound/packet_message_acknowledgement.py index 79cd89e..101c1fa 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_message_acknowledgement.py +++ b/aiocraft/proto/play/serverbound/packet_message_acknowledgement.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketMessageAcknowledgement(Packet): __slots__ = ( 'id', 'count', 'lastRejectedMessage', 'previousMessages' ) @@ -12,13 +12,13 @@ class PacketMessageAcknowledgement(Packet): lastRejectedMessage : tuple previousMessages : bytes - def __init__(self, proto:int, - count:int=None, - lastRejectedMessage:tuple=None, - previousMessages:bytes=None, + def __init__(self, + count:int | None = None, + lastRejectedMessage:tuple | None = None, + previousMessages:bytes | None = None, **kwargs ): - super().__init__(proto, + super().__init__( count=count, lastRejectedMessage=lastRejectedMessage, previousMessages=previousMessages diff --git a/aiocraft/mc/proto/play/serverbound/packet_name_item.py b/aiocraft/proto/play/serverbound/packet_name_item.py similarity index 93% rename from aiocraft/mc/proto/play/serverbound/packet_name_item.py rename to aiocraft/proto/play/serverbound/packet_name_item.py index ec4402a..0bc2a21 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_name_item.py +++ b/aiocraft/proto/play/serverbound/packet_name_item.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketNameItem(Packet): __slots__ = ( 'id', 'name' ) name : str - def __init__(self, proto:int, - name:str=None, + def __init__(self, + name:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( name=name ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_pick_item.py b/aiocraft/proto/play/serverbound/packet_pick_item.py similarity index 93% rename from aiocraft/mc/proto/play/serverbound/packet_pick_item.py rename to aiocraft/proto/play/serverbound/packet_pick_item.py index b661b94..ed6c88a 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_pick_item.py +++ b/aiocraft/proto/play/serverbound/packet_pick_item.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPickItem(Packet): __slots__ = ( 'id', 'slot' ) slot : int - def __init__(self, proto:int, - slot:int=None, + def __init__(self, + slot:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( slot=slot ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_pong.py b/aiocraft/proto/play/serverbound/packet_pong.py similarity index 85% rename from aiocraft/mc/proto/play/serverbound/packet_pong.py rename to aiocraft/proto/play/serverbound/packet_pong.py index 1d128e6..e9d8a30 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_pong.py +++ b/aiocraft/proto/play/serverbound/packet_pong.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPong(Packet): __slots__ = ( 'id', 'id' ) id : int - def __init__(self, proto:int, - id:int=None, + def __init__(self, + id:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( id=id ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_position.py b/aiocraft/proto/play/serverbound/packet_position.py similarity index 96% rename from aiocraft/mc/proto/play/serverbound/packet_position.py rename to aiocraft/proto/play/serverbound/packet_position.py index 1d2e96d..6be137a 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_position.py +++ b/aiocraft/proto/play/serverbound/packet_position.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPosition(Packet): __slots__ = ( 'id', 'onGround', 'x', 'y', 'z' ) @@ -13,14 +13,14 @@ class PacketPosition(Packet): y : float z : float - def __init__(self, proto:int, - onGround:bool=None, - x:float=None, - y:float=None, - z:float=None, + def __init__(self, + onGround:bool | None = None, + x:float | None = None, + y:float | None = None, + z:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( onGround=onGround, x=x, y=y, diff --git a/aiocraft/mc/proto/play/serverbound/packet_position_look.py b/aiocraft/proto/play/serverbound/packet_position_look.py similarity index 96% rename from aiocraft/mc/proto/play/serverbound/packet_position_look.py rename to aiocraft/proto/play/serverbound/packet_position_look.py index e499383..d329679 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_position_look.py +++ b/aiocraft/proto/play/serverbound/packet_position_look.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPositionLook(Packet): __slots__ = ( 'id', 'onGround', 'pitch', 'x', 'y', 'yaw', 'z' ) @@ -15,16 +15,16 @@ class PacketPositionLook(Packet): yaw : float z : float - def __init__(self, proto:int, - onGround:bool=None, - pitch:float=None, - x:float=None, - y:float=None, - yaw:float=None, - z:float=None, + def __init__(self, + onGround:bool | None = None, + pitch:float | None = None, + x:float | None = None, + y:float | None = None, + yaw:float | None = None, + z:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( onGround=onGround, pitch=pitch, x=x, diff --git a/aiocraft/mc/proto/play/serverbound/packet_prepare_crafting_grid.py b/aiocraft/proto/play/serverbound/packet_prepare_crafting_grid.py similarity index 90% rename from aiocraft/mc/proto/play/serverbound/packet_prepare_crafting_grid.py rename to aiocraft/proto/play/serverbound/packet_prepare_crafting_grid.py index 5dfa1b6..46d9010 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_prepare_crafting_grid.py +++ b/aiocraft/proto/play/serverbound/packet_prepare_crafting_grid.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPrepareCraftingGrid(Packet): __slots__ = ( 'id', 'actionNumber', 'prepareEntry', 'returnEntry', 'windowId' ) @@ -13,14 +13,14 @@ class PacketPrepareCraftingGrid(Packet): returnEntry : list windowId : int - def __init__(self, proto:int, - actionNumber:int=None, - prepareEntry:list=None, - returnEntry:list=None, - windowId:int=None, + def __init__(self, + actionNumber:int | None = None, + prepareEntry:list | None = None, + returnEntry:list | None = None, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( actionNumber=actionNumber, prepareEntry=prepareEntry, returnEntry=returnEntry, diff --git a/aiocraft/mc/proto/play/serverbound/packet_query_block_nbt.py b/aiocraft/proto/play/serverbound/packet_query_block_nbt.py similarity index 94% rename from aiocraft/mc/proto/play/serverbound/packet_query_block_nbt.py rename to aiocraft/proto/play/serverbound/packet_query_block_nbt.py index df52be0..64142ac 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_query_block_nbt.py +++ b/aiocraft/proto/play/serverbound/packet_query_block_nbt.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketQueryBlockNbt(Packet): __slots__ = ( 'id', 'location', 'transactionId' ) @@ -11,12 +11,12 @@ class PacketQueryBlockNbt(Packet): location : tuple transactionId : int - def __init__(self, proto:int, - location:tuple=None, - transactionId:int=None, + def __init__(self, + location:tuple | None = None, + transactionId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( location=location, transactionId=transactionId ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_query_entity_nbt.py b/aiocraft/proto/play/serverbound/packet_query_entity_nbt.py similarity index 94% rename from aiocraft/mc/proto/play/serverbound/packet_query_entity_nbt.py rename to aiocraft/proto/play/serverbound/packet_query_entity_nbt.py index 5ac0ed5..f3bbd67 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_query_entity_nbt.py +++ b/aiocraft/proto/play/serverbound/packet_query_entity_nbt.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketQueryEntityNbt(Packet): __slots__ = ( 'id', 'entityId', 'transactionId' ) @@ -11,12 +11,12 @@ class PacketQueryEntityNbt(Packet): entityId : int transactionId : int - def __init__(self, proto:int, - entityId:int=None, - transactionId:int=None, + def __init__(self, + entityId:int | None = None, + transactionId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( entityId=entityId, transactionId=transactionId ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_recipe_book.py b/aiocraft/proto/play/serverbound/packet_recipe_book.py similarity index 88% rename from aiocraft/mc/proto/play/serverbound/packet_recipe_book.py rename to aiocraft/proto/play/serverbound/packet_recipe_book.py index acb466a..38e80b9 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_recipe_book.py +++ b/aiocraft/proto/play/serverbound/packet_recipe_book.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketRecipeBook(Packet): __slots__ = ( 'id', 'bookId', 'bookOpen', 'filterActive' ) @@ -12,13 +12,13 @@ class PacketRecipeBook(Packet): bookOpen : bool filterActive : bool - def __init__(self, proto:int, - bookId:int=None, - bookOpen:bool=None, - filterActive:bool=None, + def __init__(self, + bookId:int | None = None, + bookOpen:bool | None = None, + filterActive:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( bookId=bookId, bookOpen=bookOpen, filterActive=filterActive diff --git a/aiocraft/mc/proto/play/serverbound/packet_resource_pack_receive.py b/aiocraft/proto/play/serverbound/packet_resource_pack_receive.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_resource_pack_receive.py rename to aiocraft/proto/play/serverbound/packet_resource_pack_receive.py index 7673425..e04c5b4 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_resource_pack_receive.py +++ b/aiocraft/proto/play/serverbound/packet_resource_pack_receive.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketResourcePackReceive(Packet): __slots__ = ( 'id', 'hash', 'result' ) @@ -11,12 +11,12 @@ class PacketResourcePackReceive(Packet): hash : str result : int - def __init__(self, proto:int, - hash:str=None, - result:int=None, + def __init__(self, + hash:str | None = None, + result:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( hash=hash, result=result ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_select_trade.py b/aiocraft/proto/play/serverbound/packet_select_trade.py similarity index 93% rename from aiocraft/mc/proto/play/serverbound/packet_select_trade.py rename to aiocraft/proto/play/serverbound/packet_select_trade.py index 5035062..903d02b 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_select_trade.py +++ b/aiocraft/proto/play/serverbound/packet_select_trade.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSelectTrade(Packet): __slots__ = ( 'id', 'slot' ) slot : int - def __init__(self, proto:int, - slot:int=None, + def __init__(self, + slot:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( slot=slot ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_set_beacon_effect.py b/aiocraft/proto/play/serverbound/packet_set_beacon_effect.py similarity index 94% rename from aiocraft/mc/proto/play/serverbound/packet_set_beacon_effect.py rename to aiocraft/proto/play/serverbound/packet_set_beacon_effect.py index 90dd14b..b0186f5 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_set_beacon_effect.py +++ b/aiocraft/proto/play/serverbound/packet_set_beacon_effect.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSetBeaconEffect(Packet): __slots__ = ( 'id', 'primary_effect', 'secondary_effect' ) @@ -11,12 +11,12 @@ class PacketSetBeaconEffect(Packet): primary_effect : Union[int,tuple] secondary_effect : Union[int,tuple] - def __init__(self, proto:int, - primary_effect:Union[int,tuple]=None, - secondary_effect:Union[int,tuple]=None, + def __init__(self, + primary_effect:Union[int,tuple] | None = None, + secondary_effect:Union[int,tuple] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( primary_effect=primary_effect, secondary_effect=secondary_effect ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_set_creative_slot.py b/aiocraft/proto/play/serverbound/packet_set_creative_slot.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_set_creative_slot.py rename to aiocraft/proto/play/serverbound/packet_set_creative_slot.py index 2ec55ff..3ac9e44 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_set_creative_slot.py +++ b/aiocraft/proto/play/serverbound/packet_set_creative_slot.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSetCreativeSlot(Packet): __slots__ = ( 'id', 'item', 'slot' ) @@ -11,12 +11,12 @@ class PacketSetCreativeSlot(Packet): item : Item slot : int - def __init__(self, proto:int, - item:Item=None, - slot:int=None, + def __init__(self, + item:Item | None = None, + slot:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( item=item, slot=slot ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_set_difficulty.py b/aiocraft/proto/play/serverbound/packet_set_difficulty.py similarity index 92% rename from aiocraft/mc/proto/play/serverbound/packet_set_difficulty.py rename to aiocraft/proto/play/serverbound/packet_set_difficulty.py index c239a31..0403848 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_set_difficulty.py +++ b/aiocraft/proto/play/serverbound/packet_set_difficulty.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSetDifficulty(Packet): __slots__ = ( 'id', 'newDifficulty' ) newDifficulty : int - def __init__(self, proto:int, - newDifficulty:int=None, + def __init__(self, + newDifficulty:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( newDifficulty=newDifficulty ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_settings.py b/aiocraft/proto/play/serverbound/packet_settings.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_settings.py rename to aiocraft/proto/play/serverbound/packet_settings.py index f5a90a3..fd7baa1 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_settings.py +++ b/aiocraft/proto/play/serverbound/packet_settings.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSettings(Packet): __slots__ = ( 'id', 'chatColors', 'chatFlags', 'disableTextFiltering', 'enableServerListing', 'enableTextFiltering', 'locale', 'mainHand', 'skinParts', 'viewDistance' ) @@ -18,19 +18,19 @@ class PacketSettings(Packet): skinParts : int viewDistance : int - def __init__(self, proto:int, - chatColors:bool=None, - chatFlags:int=None, - disableTextFiltering:bool=None, - enableServerListing:bool=None, - enableTextFiltering:bool=None, - locale:str=None, - mainHand:int=None, - skinParts:int=None, - viewDistance:int=None, + def __init__(self, + chatColors:bool | None = None, + chatFlags:int | None = None, + disableTextFiltering:bool | None = None, + enableServerListing:bool | None = None, + enableTextFiltering:bool | None = None, + locale:str | None = None, + mainHand:int | None = None, + skinParts:int | None = None, + viewDistance:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( chatColors=chatColors, chatFlags=chatFlags, disableTextFiltering=disableTextFiltering, diff --git a/aiocraft/mc/proto/play/serverbound/packet_spectate.py b/aiocraft/proto/play/serverbound/packet_spectate.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_spectate.py rename to aiocraft/proto/play/serverbound/packet_spectate.py index 0063bef..d78354b 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_spectate.py +++ b/aiocraft/proto/play/serverbound/packet_spectate.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSpectate(Packet): __slots__ = ( 'id', 'target' ) target : str - def __init__(self, proto:int, - target:str=None, + def __init__(self, + target:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( target=target ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_steer_boat.py b/aiocraft/proto/play/serverbound/packet_steer_boat.py similarity index 96% rename from aiocraft/mc/proto/play/serverbound/packet_steer_boat.py rename to aiocraft/proto/play/serverbound/packet_steer_boat.py index 8cb7186..059d7fb 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_steer_boat.py +++ b/aiocraft/proto/play/serverbound/packet_steer_boat.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSteerBoat(Packet): __slots__ = ( 'id', 'leftPaddle', 'rightPaddle' ) @@ -11,12 +11,12 @@ class PacketSteerBoat(Packet): leftPaddle : bool rightPaddle : bool - def __init__(self, proto:int, - leftPaddle:bool=None, - rightPaddle:bool=None, + def __init__(self, + leftPaddle:bool | None = None, + rightPaddle:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( leftPaddle=leftPaddle, rightPaddle=rightPaddle ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_steer_vehicle.py b/aiocraft/proto/play/serverbound/packet_steer_vehicle.py similarity index 96% rename from aiocraft/mc/proto/play/serverbound/packet_steer_vehicle.py rename to aiocraft/proto/play/serverbound/packet_steer_vehicle.py index 180494f..08c3c3f 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_steer_vehicle.py +++ b/aiocraft/proto/play/serverbound/packet_steer_vehicle.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketSteerVehicle(Packet): __slots__ = ( 'id', 'forward', 'jump', 'sideways' ) @@ -12,13 +12,13 @@ class PacketSteerVehicle(Packet): jump : int sideways : float - def __init__(self, proto:int, - forward:float=None, - jump:int=None, - sideways:float=None, + def __init__(self, + forward:float | None = None, + jump:int | None = None, + sideways:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( forward=forward, jump=jump, sideways=sideways diff --git a/aiocraft/mc/proto/play/serverbound/packet_tab_complete.py b/aiocraft/proto/play/serverbound/packet_tab_complete.py similarity index 94% rename from aiocraft/mc/proto/play/serverbound/packet_tab_complete.py rename to aiocraft/proto/play/serverbound/packet_tab_complete.py index db1e8fc..fd77776 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_tab_complete.py +++ b/aiocraft/proto/play/serverbound/packet_tab_complete.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketTabComplete(Packet): __slots__ = ( 'id', 'assumeCommand', 'block', 'lookedAtBlock', 'text', 'transactionId' ) @@ -14,15 +14,15 @@ class PacketTabComplete(Packet): text : str transactionId : int - def __init__(self, proto:int, - assumeCommand:bool=None, - block:tuple=None, - lookedAtBlock:tuple=None, - text:str=None, - transactionId:int=None, + def __init__(self, + assumeCommand:bool | None = None, + block:tuple | None = None, + lookedAtBlock:tuple | None = None, + text:str | None = None, + transactionId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( assumeCommand=assumeCommand, block=block, lookedAtBlock=lookedAtBlock, diff --git a/aiocraft/mc/proto/play/serverbound/packet_teleport_confirm.py b/aiocraft/proto/play/serverbound/packet_teleport_confirm.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_teleport_confirm.py rename to aiocraft/proto/play/serverbound/packet_teleport_confirm.py index cd41ad0..021a47e 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_teleport_confirm.py +++ b/aiocraft/proto/play/serverbound/packet_teleport_confirm.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketTeleportConfirm(Packet): __slots__ = ( 'id', 'teleportId' ) teleportId : int - def __init__(self, proto:int, - teleportId:int=None, + def __init__(self, + teleportId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( teleportId=teleportId ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_transaction.py b/aiocraft/proto/play/serverbound/packet_transaction.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_transaction.py rename to aiocraft/proto/play/serverbound/packet_transaction.py index 8f68efb..95786f3 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_transaction.py +++ b/aiocraft/proto/play/serverbound/packet_transaction.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketTransaction(Packet): __slots__ = ( 'id', 'accepted', 'action', 'windowId' ) @@ -12,13 +12,13 @@ class PacketTransaction(Packet): action : int windowId : int - def __init__(self, proto:int, - accepted:bool=None, - action:int=None, - windowId:int=None, + def __init__(self, + accepted:bool | None = None, + action:int | None = None, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( accepted=accepted, action=action, windowId=windowId diff --git a/aiocraft/mc/proto/play/serverbound/packet_update_command_block.py b/aiocraft/proto/play/serverbound/packet_update_command_block.py similarity index 94% rename from aiocraft/mc/proto/play/serverbound/packet_update_command_block.py rename to aiocraft/proto/play/serverbound/packet_update_command_block.py index 57e4854..3e8282b 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_update_command_block.py +++ b/aiocraft/proto/play/serverbound/packet_update_command_block.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUpdateCommandBlock(Packet): __slots__ = ( 'id', 'command', 'flags', 'location', 'mode' ) @@ -13,14 +13,14 @@ class PacketUpdateCommandBlock(Packet): location : tuple mode : int - def __init__(self, proto:int, - command:str=None, - flags:int=None, - location:tuple=None, - mode:int=None, + def __init__(self, + command:str | None = None, + flags:int | None = None, + location:tuple | None = None, + mode:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( command=command, flags=flags, location=location, diff --git a/aiocraft/mc/proto/play/serverbound/packet_update_command_block_minecart.py b/aiocraft/proto/play/serverbound/packet_update_command_block_minecart.py similarity index 94% rename from aiocraft/mc/proto/play/serverbound/packet_update_command_block_minecart.py rename to aiocraft/proto/play/serverbound/packet_update_command_block_minecart.py index e3f21ab..1951a29 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_update_command_block_minecart.py +++ b/aiocraft/proto/play/serverbound/packet_update_command_block_minecart.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUpdateCommandBlockMinecart(Packet): __slots__ = ( 'id', 'command', 'entityId', 'track_output' ) @@ -12,13 +12,13 @@ class PacketUpdateCommandBlockMinecart(Packet): entityId : int track_output : bool - def __init__(self, proto:int, - command:str=None, - entityId:int=None, - track_output:bool=None, + def __init__(self, + command:str | None = None, + entityId:int | None = None, + track_output:bool | None = None, **kwargs ): - super().__init__(proto, + super().__init__( command=command, entityId=entityId, track_output=track_output diff --git a/aiocraft/mc/proto/play/serverbound/packet_update_jigsaw_block.py b/aiocraft/proto/play/serverbound/packet_update_jigsaw_block.py similarity index 92% rename from aiocraft/mc/proto/play/serverbound/packet_update_jigsaw_block.py rename to aiocraft/proto/play/serverbound/packet_update_jigsaw_block.py index b1da398..0112668 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_update_jigsaw_block.py +++ b/aiocraft/proto/play/serverbound/packet_update_jigsaw_block.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUpdateJigsawBlock(Packet): __slots__ = ( 'id', 'attachmentType', 'finalState', 'jointType', 'location', 'name', 'pool', 'target', 'targetPool' ) @@ -17,18 +17,18 @@ class PacketUpdateJigsawBlock(Packet): target : str targetPool : str - def __init__(self, proto:int, - attachmentType:str=None, - finalState:str=None, - jointType:str=None, - location:tuple=None, - name:str=None, - pool:str=None, - target:str=None, - targetPool:str=None, + def __init__(self, + attachmentType:str | None = None, + finalState:str | None = None, + jointType:str | None = None, + location:tuple | None = None, + name:str | None = None, + pool:str | None = None, + target:str | None = None, + targetPool:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( attachmentType=attachmentType, finalState=finalState, jointType=jointType, diff --git a/aiocraft/mc/proto/play/serverbound/packet_update_sign.py b/aiocraft/proto/play/serverbound/packet_update_sign.py similarity index 96% rename from aiocraft/mc/proto/play/serverbound/packet_update_sign.py rename to aiocraft/proto/play/serverbound/packet_update_sign.py index 4294c1b..c8644ae 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_update_sign.py +++ b/aiocraft/proto/play/serverbound/packet_update_sign.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUpdateSign(Packet): __slots__ = ( 'id', 'location', 'text1', 'text2', 'text3', 'text4' ) @@ -14,15 +14,15 @@ class PacketUpdateSign(Packet): text3 : str text4 : str - def __init__(self, proto:int, - location:tuple=None, - text1:str=None, - text2:str=None, - text3:str=None, - text4:str=None, + def __init__(self, + location:tuple | None = None, + text1:str | None = None, + text2:str | None = None, + text3:str | None = None, + text4:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( location=location, text1=text1, text2=text2, diff --git a/aiocraft/mc/proto/play/serverbound/packet_update_structure_block.py b/aiocraft/proto/play/serverbound/packet_update_structure_block.py similarity index 94% rename from aiocraft/mc/proto/play/serverbound/packet_update_structure_block.py rename to aiocraft/proto/play/serverbound/packet_update_structure_block.py index 8f6317f..6900ece 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_update_structure_block.py +++ b/aiocraft/proto/play/serverbound/packet_update_structure_block.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUpdateStructureBlock(Packet): __slots__ = ( 'id', 'action', 'flags', 'integrity', 'location', 'metadata', 'mirror', 'mode', 'name', 'offset_x', 'offset_y', 'offset_z', 'rotation', 'seed', 'size_x', 'size_y', 'size_z' ) @@ -25,26 +25,26 @@ class PacketUpdateStructureBlock(Packet): size_y : int size_z : int - def __init__(self, proto:int, - action:int=None, - flags:int=None, - integrity:float=None, - location:tuple=None, - metadata:str=None, - mirror:int=None, - mode:int=None, - name:str=None, - offset_x:int=None, - offset_y:int=None, - offset_z:int=None, - rotation:int=None, - seed:int=None, - size_x:int=None, - size_y:int=None, - size_z:int=None, + def __init__(self, + action:int | None = None, + flags:int | None = None, + integrity:float | None = None, + location:tuple | None = None, + metadata:str | None = None, + mirror:int | None = None, + mode:int | None = None, + name:str | None = None, + offset_x:int | None = None, + offset_y:int | None = None, + offset_z:int | None = None, + rotation:int | None = None, + seed:int | None = None, + size_x:int | None = None, + size_y:int | None = None, + size_z:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( action=action, flags=flags, integrity=integrity, diff --git a/aiocraft/mc/proto/play/serverbound/packet_use_entity.py b/aiocraft/proto/play/serverbound/packet_use_entity.py similarity index 97% rename from aiocraft/mc/proto/play/serverbound/packet_use_entity.py rename to aiocraft/proto/play/serverbound/packet_use_entity.py index 039df60..2961713 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_use_entity.py +++ b/aiocraft/proto/play/serverbound/packet_use_entity.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUseEntity(Packet): __slots__ = ( 'id', 'hand', 'mouse', 'sneaking', 'target', 'x', 'y', 'z' ) @@ -16,17 +16,17 @@ class PacketUseEntity(Packet): y : Union[None, float] z : Union[None, float] - def __init__(self, proto:int, - hand:Union[None, int]=None, - mouse:int=None, - sneaking:bool=None, - target:int=None, - x:Union[None, float]=None, - y:Union[None, float]=None, - z:Union[None, float]=None, + def __init__(self, + hand:Union[None, int] | None = None, + mouse:int | None = None, + sneaking:bool | None = None, + target:int | None = None, + x:Union[None, float] | None = None, + y:Union[None, float] | None = None, + z:Union[None, float] | None = None, **kwargs ): - super().__init__(proto, + super().__init__( hand=hand, mouse=mouse, sneaking=sneaking, diff --git a/aiocraft/mc/proto/play/serverbound/packet_use_item.py b/aiocraft/proto/play/serverbound/packet_use_item.py similarity index 94% rename from aiocraft/mc/proto/play/serverbound/packet_use_item.py rename to aiocraft/proto/play/serverbound/packet_use_item.py index f3c18ed..e3c1384 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_use_item.py +++ b/aiocraft/proto/play/serverbound/packet_use_item.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketUseItem(Packet): __slots__ = ( 'id', 'hand', 'sequence' ) @@ -11,12 +11,12 @@ class PacketUseItem(Packet): hand : int sequence : int - def __init__(self, proto:int, - hand:int=None, - sequence:int=None, + def __init__(self, + hand:int | None = None, + sequence:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( hand=hand, sequence=sequence ) diff --git a/aiocraft/mc/proto/play/serverbound/packet_vehicle_move.py b/aiocraft/proto/play/serverbound/packet_vehicle_move.py similarity index 96% rename from aiocraft/mc/proto/play/serverbound/packet_vehicle_move.py rename to aiocraft/proto/play/serverbound/packet_vehicle_move.py index 93cda90..d401a67 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_vehicle_move.py +++ b/aiocraft/proto/play/serverbound/packet_vehicle_move.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketVehicleMove(Packet): __slots__ = ( 'id', 'pitch', 'x', 'y', 'yaw', 'z' ) @@ -14,15 +14,15 @@ class PacketVehicleMove(Packet): yaw : float z : float - def __init__(self, proto:int, - pitch:float=None, - x:float=None, - y:float=None, - yaw:float=None, - z:float=None, + def __init__(self, + pitch:float | None = None, + x:float | None = None, + y:float | None = None, + yaw:float | None = None, + z:float | None = None, **kwargs ): - super().__init__(proto, + super().__init__( pitch=pitch, x=x, y=y, diff --git a/aiocraft/mc/proto/play/serverbound/packet_window_click.py b/aiocraft/proto/play/serverbound/packet_window_click.py similarity index 95% rename from aiocraft/mc/proto/play/serverbound/packet_window_click.py rename to aiocraft/proto/play/serverbound/packet_window_click.py index 293389e..568f208 100644 --- a/aiocraft/mc/proto/play/serverbound/packet_window_click.py +++ b/aiocraft/proto/play/serverbound/packet_window_click.py @@ -2,8 +2,8 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketWindowClick(Packet): __slots__ = ( 'id', 'action', 'changedSlots', 'cursorItem', 'item', 'mode', 'mouseButton', 'slot', 'stateId', 'windowId' ) @@ -18,19 +18,19 @@ class PacketWindowClick(Packet): stateId : int windowId : int - def __init__(self, proto:int, - action:int=None, - changedSlots:list=None, - cursorItem:Item=None, - item:Item=None, - mode:int=None, - mouseButton:int=None, - slot:int=None, - stateId:int=None, - windowId:int=None, + def __init__(self, + action:int | None = None, + changedSlots:list | None = None, + cursorItem:Item | None = None, + item:Item | None = None, + mode:int | None = None, + mouseButton:int | None = None, + slot:int | None = None, + stateId:int | None = None, + windowId:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( action=action, changedSlots=changedSlots, cursorItem=cursorItem, diff --git a/aiocraft/mc/proto/status/__init__.py b/aiocraft/proto/status/__init__.py similarity index 100% rename from aiocraft/mc/proto/status/__init__.py rename to aiocraft/proto/status/__init__.py diff --git a/aiocraft/mc/proto/status/clientbound/__init__.py b/aiocraft/proto/status/clientbound/__init__.py similarity index 100% rename from aiocraft/mc/proto/status/clientbound/__init__.py rename to aiocraft/proto/status/clientbound/__init__.py diff --git a/aiocraft/mc/proto/status/clientbound/packet_ping.py b/aiocraft/proto/status/clientbound/packet_ping.py similarity index 95% rename from aiocraft/mc/proto/status/clientbound/packet_ping.py rename to aiocraft/proto/status/clientbound/packet_ping.py index 7cac142..9cafb5d 100644 --- a/aiocraft/mc/proto/status/clientbound/packet_ping.py +++ b/aiocraft/proto/status/clientbound/packet_ping.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPing(Packet): __slots__ = ( 'id', 'time' ) time : int - def __init__(self, proto:int, - time:int=None, + def __init__(self, + time:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( time=time ) diff --git a/aiocraft/mc/proto/status/clientbound/packet_server_info.py b/aiocraft/proto/status/clientbound/packet_server_info.py similarity index 95% rename from aiocraft/mc/proto/status/clientbound/packet_server_info.py rename to aiocraft/proto/status/clientbound/packet_server_info.py index de3f359..3ca79ab 100644 --- a/aiocraft/mc/proto/status/clientbound/packet_server_info.py +++ b/aiocraft/proto/status/clientbound/packet_server_info.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketServerInfo(Packet): __slots__ = ( 'id', 'response' ) response : str - def __init__(self, proto:int, - response:str=None, + def __init__(self, + response:str | None = None, **kwargs ): - super().__init__(proto, + super().__init__( response=response ) diff --git a/aiocraft/mc/proto/status/serverbound/__init__.py b/aiocraft/proto/status/serverbound/__init__.py similarity index 100% rename from aiocraft/mc/proto/status/serverbound/__init__.py rename to aiocraft/proto/status/serverbound/__init__.py diff --git a/aiocraft/mc/proto/status/serverbound/packet_ping.py b/aiocraft/proto/status/serverbound/packet_ping.py similarity index 95% rename from aiocraft/mc/proto/status/serverbound/packet_ping.py rename to aiocraft/proto/status/serverbound/packet_ping.py index 7cac142..9cafb5d 100644 --- a/aiocraft/mc/proto/status/serverbound/packet_ping.py +++ b/aiocraft/proto/status/serverbound/packet_ping.py @@ -2,19 +2,19 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPing(Packet): __slots__ = ( 'id', 'time' ) time : int - def __init__(self, proto:int, - time:int=None, + def __init__(self, + time:int | None = None, **kwargs ): - super().__init__(proto, + super().__init__( time=time ) diff --git a/aiocraft/mc/proto/status/serverbound/packet_ping_start.py b/aiocraft/proto/status/serverbound/packet_ping_start.py similarity index 93% rename from aiocraft/mc/proto/status/serverbound/packet_ping_start.py rename to aiocraft/proto/status/serverbound/packet_ping_start.py index 71404e8..48e070b 100644 --- a/aiocraft/mc/proto/status/serverbound/packet_ping_start.py +++ b/aiocraft/proto/status/serverbound/packet_ping_start.py @@ -2,18 +2,18 @@ from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * from ....types import * +from ....primitives import * class PacketPingStart(Packet): __slots__ = ( 'id' ) - def __init__(self, proto:int, + def __init__(self, **kwargs ): - super().__init__(proto, + super().__init__( ) diff --git a/aiocraft/server.py b/aiocraft/server.py index f610c77..2e991c3 100644 --- a/aiocraft/server.py +++ b/aiocraft/server.py @@ -7,24 +7,15 @@ import uuid from dataclasses import dataclass from asyncio import Task, StreamReader, StreamWriter from asyncio.base_events import Server # just for typing -from enum import Enum - -from typing import Dict, List, Callable, Coroutine, Type, Optional, Tuple, AsyncIterator from .dispatcher import Dispatcher -from .mc.packet import Packet -from .mc.auth import AuthException, AuthInterface -from .mc.definitions import Dimension, Difficulty, Gamemode, ConnectionState -from .mc.proto.status.serverbound import PacketPing, PacketPingStart -from .mc.proto.status.clientbound import PacketServerInfo, PacketPing as PacketPong -from .mc.proto.handshaking.serverbound import PacketSetProtocol -from .mc.proto.play.serverbound import PacketKeepAlive as PacketKeepAliveResponse -from .mc.proto.play.clientbound import PacketKeepAlive, PacketSetCompression, PacketKickDisconnect, PacketPosition, PacketLogin -from .mc.proto.login.serverbound import PacketLoginStart, PacketEncryptionBegin as PacketEncryptionResponse -from .mc.proto.login.clientbound import ( - PacketCompress, PacketDisconnect, PacketEncryptionBegin, PacketLoginPluginRequest, PacketSuccess -) -from .util import encryption +from .types import ConnectionState +from .proto.status.serverbound import PacketPing, PacketPingStart +from .proto.status.clientbound import PacketServerInfo, PacketPing as PacketPong +from .proto.handshaking.serverbound import PacketSetProtocol +from .proto.play.clientbound import PacketKickDisconnect, PacketPosition, PacketLogin +from .proto.login.serverbound import PacketLoginStart, PacketEncryptionBegin as PacketEncryptionResponse +from .proto.login.clientbound import PacketDisconnect, PacketSuccess REMOVE_COLOR_FORMATS = re.compile(r"ยง[0-9a-z]") LOGGER = logging.getLogger(__name__) @@ -37,12 +28,12 @@ class ServerOptions: motd : str max_players : int -class MinecraftServer: +class AbstractMinecraftServer: host:str port:int options:ServerOptions - _dispatcher_pool : List[Dispatcher] + _dispatcher_pool : list[Dispatcher] _processing : bool _server : Server _worker : Task @@ -103,7 +94,7 @@ class MinecraftServer: await self._server.wait_closed() async def _server_worker(self, reader:StreamReader, writer:StreamWriter): - dispatcher = Dispatcher(server=True).set_host(self.host, self.port) + dispatcher = Dispatcher(host=self.host, port=self.port, server=True) self._dispatcher_pool.append(dispatcher) self.logger.debug("Starting dispatcher for client") @@ -118,9 +109,9 @@ class MinecraftServer: if dispatcher.connected: await dispatcher.write( - PacketKickDisconnect(dispatcher.proto, reason="Connection terminated") + PacketKickDisconnect(reason="Connection terminated") if dispatcher.state == ConnectionState.PLAY else - PacketDisconnect(dispatcher.proto, reason="Connection terminated") + PacketDisconnect(reason="Connection terminated") ) await dispatcher.disconnect() @@ -129,7 +120,7 @@ class MinecraftServer: async for packet in dispatcher.packets(): if isinstance(packet, PacketSetProtocol): self.logger.info("Received set protocol packet") - dispatcher.proto = packet.protocolVersion + dispatcher._proto = packet.protocolVersion # TODO shouldn't be doing it this way if packet.nextState == 1: self.logger.debug("Changing state to STATUS") dispatcher.state = ConnectionState.STATUS @@ -146,7 +137,6 @@ class MinecraftServer: if isinstance(packet, PacketPingStart): await dispatcher.write( PacketServerInfo( - dispatcher.proto, response=json.dumps({ "online": True, "ip": self.host, @@ -181,7 +171,7 @@ class MinecraftServer: ) ) elif isinstance(packet, PacketPing): - await dispatcher.write(PacketPong(dispatcher.proto, packet.time)) + await dispatcher.write(PacketPong(time=packet.time)) return False async def _login(self, dispatcher:Dispatcher) -> bool: @@ -201,16 +191,15 @@ class MinecraftServer: else: await dispatcher.write( PacketSuccess( - dispatcher.proto, uuid=str(uuid.uuid4()), username=packet.username, ) ) return True elif isinstance(packet, PacketEncryptionResponse): - shared_secret = packet.sharedSecret - verify_token = packet.verifyToken - # TODO enable encryption? + pass # TODO enable encryption? + # shared_secret = packet.sharedSecret + # verify_token = packet.verifyToken # return True return False @@ -220,10 +209,9 @@ class MinecraftServer: if self.options.spawn_player: await dispatcher.write( PacketLogin( - dispatcher.proto, gameMode=3, isFlat=False, - worldNames=b'', + worldNames=[], worldName='aiocraft', previousGameMode=3, entityId=1, @@ -242,7 +230,6 @@ class MinecraftServer: await dispatcher.write( PacketPosition( - dispatcher.proto, dismountVehicle=True, x=0, y=120, diff --git a/aiocraft/mc/definitions.py b/aiocraft/types.py similarity index 97% rename from aiocraft/mc/definitions.py rename to aiocraft/types.py index 9a02d4f..4cd9dab 100644 --- a/aiocraft/mc/definitions.py +++ b/aiocraft/types.py @@ -123,6 +123,18 @@ class BlockPos: def __hash__(self) -> int: return hash(self.to_tuple()) + @property + def i_x(self) -> int: + return int(self.x) + + @property + def i_y(self) -> int: + return int(self.y) + + @property + def i_z(self) -> int: + return int(self.z) + @classmethod def from_tuple(cls, t:Tuple[float, float, float]): return cls(x=float(t[0]), y=float(t[1]), z=float(t[2])) diff --git a/aiocraft/util/encryption.py b/aiocraft/util/encryption.py index 421d632..4927fd8 100644 --- a/aiocraft/util/encryption.py +++ b/aiocraft/util/encryption.py @@ -2,8 +2,6 @@ # TODO read more about this, improve implementation if possible import os from hashlib import sha1 -from asyncio import StreamWriter, StreamReader -from dataclasses import dataclass from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric.padding import PKCS1v15 diff --git a/aiocraft/util/helpers.py b/aiocraft/util/helpers.py index 814ef03..a140efc 100644 --- a/aiocraft/util/helpers.py +++ b/aiocraft/util/helpers.py @@ -1,6 +1,6 @@ import json -from typing import Union, List, Dict +from typing import Union, List from termcolor import colored # TODO don't use a lib and put ANSI escaped by hand maybe? diff --git a/compiler/proto.py b/compiler/proto.py index 68dcc8f..d3e604d 100644 --- a/compiler/proto.py +++ b/compiler/proto.py @@ -13,8 +13,8 @@ DIR_MAP = {"toClient": "clientbound", "toServer": "serverbound"} PREFACE = """\"\"\"[!] This file is autogenerated\"\"\"\n\n""" IMPORTS = """from typing import Tuple, List, Dict, Union, Optional from ....packet import Packet -from ....definitions import * -from ....types import *\n""" +from ....types import * +from ....primitives import *\n""" IMPORT_ALL = """__all__ = [\n\t{all}\n]\n""" REGISTRY_ENTRY = """ REGISTRY = {entries}\n""" @@ -23,8 +23,8 @@ class {name}(Packet): __slots__ = {slots} {fields} - def __init__(self, proto:int,{constructor}): - super().__init__(proto,{constructed}) + def __init__(self, {constructor}): + super().__init__({constructed}) _state : int = {state} @@ -279,7 +279,7 @@ class PacketClassWriter: slots=format_tuple(["id"] + sorted(self.attrs), depth=0), # TODO jank fix when no slots fields="\n\t" + "\n\t".join(f"{a} : {pytype(sorted(self.hints[a]))}" for a in sorted(self.attrs)), state=self.state, - constructor=_format_line([Ref(f"{field}:{pytype(sorted(self.hints[field]))}=None") for field in sorted(self.attrs)] + [Ref("**kwargs")], depth=2), + constructor=_format_line([Ref(f"{field}:{pytype(sorted(self.hints[field]))} | None = None") for field in sorted(self.attrs)] + [Ref("**kwargs")], depth=2), constructed=_format_line((Ref(f"{field}={field}") for field in sorted(self.attrs)), depth=3), ) @@ -319,7 +319,7 @@ def compile(): from urllib.request import urlretrieve base_path = Path(os.getcwd()) - mc_path = base_path / 'aiocraft' / 'mc' + mc_path = base_path / 'aiocraft' # Retrieve proto definitions from PrismarineJS/minecraft-data urlretrieve("https://github.com/PrismarineJS/minecraft-data/zipball/master", mc_path / "minecraft-data.zip") @@ -369,8 +369,8 @@ def compile(): with open(mc_path / f'{folder_name}/data/pc/{v}/version.json') as f: proto_version = json.load(f)['version'] - if proto_version < 47 or proto_version > 1000: - continue # avoid versions before 1.8 + if proto_version < 47 or proto_version > 761: + continue # avoid versions before 1.8 and past 1.19 all_proto_numbers.append(proto_version)