Пример #1
0
    def read(stream, packet_size):
        position = StreamIO.read_position(stream)
        face = StreamIO.read_byte(stream)
        slot_data = SlotData(StreamIO.read_short(stream))
        if not slot_data.is_empty():
            slot_data.set_count(StreamIO.read_byte(stream))
            slot_data.set_damage(StreamIO.read_short(stream))
            slot_data.set_tag(NBTSerializer.read(stream))
        cursor_x = StreamIO.read_byte(stream)
        cursor_y = StreamIO.read_byte(stream)
        cursor_z = StreamIO.read_byte(stream)

        return PlayerBlockPlacementPacket(position, face, slot_data, cursor_x, cursor_y, cursor_z)
Пример #2
0
    def read(stream, packet_size):
        window_id = StreamIO.read_ubyte(stream)
        slot = StreamIO.read_short(stream)
        button = StreamIO.read_byte(stream)
        transaction_id = StreamIO.read_short(stream)
        mode = StreamIO.read_byte(stream)
        slot_data = SlotData(StreamIO.read_short(stream))
        if not slot_data.is_empty():
            slot_data.set_count(StreamIO.read_byte(stream))
            slot_data.set_damage(StreamIO.read_short(stream))
            slot_data.set_tag(NBTSerializer.read(stream))

        return ClickWindowPacket(window_id, slot, button, transaction_id, mode,
                                 slot_data)
Пример #3
0
    def read(stream, packet_size):
        window_id = StreamIO.read_ubyte(stream)
        slots_len = StreamIO.read_short(stream)
        slots = []

        for i in xrange(slots_len):
            slot_data = SlotData(StreamIO.read_short(stream))
            if not slot_data.is_empty():
                slot_data.set_count(StreamIO.read_byte(stream))
                slot_data.set_damage(StreamIO.read_short(stream))
                slot_data.set_tag(NBTSerializer.read(stream))

            slots.append(slot_data)

        return WindowItemsPacket(window_id, slots)