def __init__(self, x, y, z, yaw, pitch, flags): BasePacket.__init__(self) self._x = float(x) self._y = float(y) self._z = float(z) self._yaw = float(yaw) self._pitch = float(pitch) self._flags = int(flags)
def __init__(self, position, face, slot_data, cursor_x, cursor_y, cursor_z): BasePacket.__init__(self) self._position = position self._face = int(face) self._slot_data = slot_data self._cursor_x = int(cursor_x) self._cursor_y = int(cursor_y) self._cursor_z = int(cursor_z)
def __init__(self, locale, view_distance, chat_mode, chat_colors, skin_parts): BasePacket.__init__(self) self._locale = unicode(locale) self._view_distance = int(view_distance) self._chat_mode = int(chat_mode) self._chat_colors = bool(chat_colors) self._skin_parts = int(skin_parts)
def __init__(self, window_id, slot, button, transaction_id, mode, slot_data): BasePacket.__init__(self) self._window_id = int(window_id) self._slot = int(slot) self._button = int(button) self._transaction_id = int(transaction_id) self._mode = int(mode) self._slot_data = slot_data
def __init__(self, entity_id, gamemode, dimension, difficulty, max_players, level_type, debug_info): BasePacket.__init__(self) self._entity_id = int(entity_id) self._gamemode = int(gamemode) self._dimension = int(dimension) self._difficulty = int(difficulty) self._max_players = int(max_players) self._level_type = unicode(level_type) self._debug_info = bool(debug_info)
def __init__(self, window_id, window_type, window_title, slots_number, entity_id=None): BasePacket.__init__(self) self._window_id = int(window_id) self._window_type = unicode(window_type) self._window_title = window_title self._slots_number = int(slots_number) if entity_id is not None: entity_id = int(entity_id) self._entity_id = entity_id
def read(self, stream): packet_size = StreamIO.read_varint(stream) if self.is_compression_enabled(): data_size = StreamIO.read_varint(stream) if data_size == 0: packet_size -= StreamIO.size_varint(0) data = StreamIO.read(stream, packet_size) else: data = StreamIO.read( stream, packet_size - StreamIO.size_varint(data_size)) data = zlib.decompress(data) packet_size = data_size else: data = StreamIO.read(stream, packet_size) buf = StringIO(data) packet_id = StreamIO.read_varint(buf) packet_size -= StreamIO.size_varint(packet_id) packet_direction = None if self._mode == PacketSerializer.Mode.SERVER: packet_direction = PacketDirection.SERVERBOUND elif self._mode == PacketSerializer.Mode.CLIENT: packet_direction = PacketDirection.CLIENTBOUND try: packet_class = PacketProvider.get_packet_class( self._protocol, self._state, packet_direction, packet_id) except KeyError: buf.close() return BasePacket() # Unknown packet packet = packet_class.read(buf, packet_size) buf.close() return packet
def __init__(self, keepalive_id): BasePacket.__init__(self) self._id = int(keepalive_id)
def __init__(self, shared_secret, verify_token): BasePacket.__init__(self) self._shared_secret = shared_secret self._verify_token = verify_token
def __init__(self, chat, position): BasePacket.__init__(self) self._chat = chat self._position = int(position)
def __init__(self, protocol, hostname, port, next_state): BasePacket.__init__(self) self._protocol = int(protocol) self._hostname = unicode(hostname) self._port = int(port) self._next_state = int(next_state)
def __init__(self, window_id, transaction_id, accepted): BasePacket.__init__(self) self._window_id = int(window_id) self._transaction_id = int(transaction_id) self._accepted = bool(accepted)
def __init__(self, hand_type): BasePacket.__init__(self) self._hand_type = int(hand_type)
def __init__(self, teleport_id): BasePacket.__init__(self) self._teleport_id = int(teleport_id)
def __init__(self, channel, plugin_bytes): BasePacket.__init__(self) self._channel = unicode(channel) self._bytes = plugin_bytes
def __init__(self): BasePacket.__init__(self)
def __init__(self, reason): BasePacket.__init__(self) self._reason = reason
def __init__(self, uuid, username): BasePacket.__init__(self) self._uuid = unicode(uuid) self._username = unicode(username)
def __init__(self, description): BasePacket.__init__(self) self._description = description
def __init__(self, x, y, z, on_ground): BasePacket.__init__(self) self._x = float(x) self._y = float(y) self._z = float(z) self._on_ground = bool(on_ground)
def __init__(self, threshold): BasePacket.__init__(self) self._threshold = int(threshold)
def __init__(self, window_id): BasePacket.__init__(self) self._window_id = int(window_id)
def __init__(self, window_id, slots): BasePacket.__init__(self) self._window_id = int(window_id) self._slots = slots
def __init__(self, action): BasePacket.__init__(self) self._action = int(action)
def __init__(self, message): BasePacket.__init__(self) self._message = unicode(message)
def __init__(self, slot): BasePacket.__init__(self) self._slot = int(slot)
def __init__(self, server_id, public_key, verify_token): BasePacket.__init__(self) self._server_id = unicode(server_id) self._public_key = public_key self._verify_token = verify_token