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)
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)
def read(stream, packet_size): window_id = StreamIO.read_byte(stream) transaction_id = StreamIO.read_short(stream) accepted = StreamIO.read_bool(stream) return ConfirmTransactionServerPacket(window_id, transaction_id, accepted)
def read(stream): values = [] len = StreamIO.read_int(stream) for i in xrange(len): values.append(StreamIO.read_byte(stream)) return NBTTagByteArray(values)
def read(stream, packet_size): x = StreamIO.read_double(stream) y = StreamIO.read_double(stream) z = StreamIO.read_double(stream) yaw = StreamIO.read_float(stream) pitch = StreamIO.read_float(stream) flags = StreamIO.read_byte(stream) return PlayerPositionAndLookClientPacket(x, y, z, yaw, pitch, flags)
def read(stream, packet_size): locale = StreamIO.read_string(stream) view_distance = StreamIO.read_byte(stream) chat_mode = StreamIO.read_varint(stream) chat_colors = StreamIO.read_bool(stream) skin_parts = StreamIO.read_ubyte(stream) return ClientSettingsPacket(locale, view_distance, chat_mode, chat_colors, skin_parts)
def read(stream, packet_size): entity_id = StreamIO.read_int(stream) gamemode = StreamIO.read_ubyte(stream) dimension = StreamIO.read_byte(stream) difficulty = StreamIO.read_ubyte(stream) max_players = StreamIO.read_ubyte(stream) level_type = StreamIO.read_string(stream).decode("utf8") debug_info = StreamIO.read_bool(stream) return JoinGamePacket(entity_id, gamemode, dimension, difficulty, max_players, level_type, debug_info)
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)
def read(stream, packet_size): slot = StreamIO.read_byte(stream) return HeldItemChangeClientPacket(slot)
def read(stream, packet_size): chat = json.loads(StreamIO.read_string(stream).decode("utf8")) position = StreamIO.read_byte(stream) return ChatMessageClientPacket(chat, position)
def read(stream): value = StreamIO.read_byte(stream) return NBTTagByte(value)