Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
    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
Exemplo n.º 7
0
    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
Exemplo n.º 8
0
 def __init__(self, keepalive_id):
     BasePacket.__init__(self)
     self._id = int(keepalive_id)
Exemplo n.º 9
0
 def __init__(self, shared_secret, verify_token):
     BasePacket.__init__(self)
     self._shared_secret = shared_secret
     self._verify_token = verify_token
Exemplo n.º 10
0
 def __init__(self, chat, position):
     BasePacket.__init__(self)
     self._chat = chat
     self._position = int(position)
Exemplo n.º 11
0
 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)
Exemplo n.º 12
0
 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)
Exemplo n.º 13
0
 def __init__(self, hand_type):
     BasePacket.__init__(self)
     self._hand_type = int(hand_type)
Exemplo n.º 14
0
 def __init__(self, teleport_id):
     BasePacket.__init__(self)
     self._teleport_id = int(teleport_id)
Exemplo n.º 15
0
 def __init__(self, channel, plugin_bytes):
     BasePacket.__init__(self)
     self._channel = unicode(channel)
     self._bytes = plugin_bytes
Exemplo n.º 16
0
 def __init__(self):
     BasePacket.__init__(self)
Exemplo n.º 17
0
 def __init__(self, reason):
     BasePacket.__init__(self)
     self._reason = reason
Exemplo n.º 18
0
 def __init__(self, uuid, username):
     BasePacket.__init__(self)
     self._uuid = unicode(uuid)
     self._username = unicode(username)
Exemplo n.º 19
0
 def __init__(self, description):
     BasePacket.__init__(self)
     self._description = description
Exemplo n.º 20
0
 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)
Exemplo n.º 21
0
 def __init__(self, threshold):
     BasePacket.__init__(self)
     self._threshold = int(threshold)
Exemplo n.º 22
0
 def __init__(self, window_id):
     BasePacket.__init__(self)
     self._window_id = int(window_id)
Exemplo n.º 23
0
 def __init__(self, window_id, slots):
     BasePacket.__init__(self)
     self._window_id = int(window_id)
     self._slots = slots
Exemplo n.º 24
0
 def __init__(self, action):
     BasePacket.__init__(self)
     self._action = int(action)
Exemplo n.º 25
0
 def __init__(self, message):
     BasePacket.__init__(self)
     self._message = unicode(message)
Exemplo n.º 26
0
 def __init__(self, slot):
     BasePacket.__init__(self)
     self._slot = int(slot)
Exemplo n.º 27
0
 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