def write(stream, packet): StreamIO.write_string(stream, packet.get_locale()) StreamIO.write_byte(stream, packet.get_view_distance()) StreamIO.write_varint(stream, packet.get_chat_mode()) StreamIO.write_bool(stream, packet.is_chat_colors()) StreamIO.write_ubyte(stream, packet.get_skin_parts()) StreamIO.write_varint(stream, packet.get_main_hand())
def write(stream, tag): for i in tag.keys(): StreamIO.write_ubyte(stream, tag[i].__class__.TYPE_ID) StreamIO.write_ushort(stream, len(i.encode("utf8"))) StreamIO.write(stream, i.encode("utf8")) tag[i].__class__.write(stream, tag[i]) StreamIO.write_ubyte(stream, NBTTagEnd.TYPE_ID)
def write(stream, packet): StreamIO.write_ubyte(stream, packet.get_window_id()) StreamIO.write_string(stream, packet.get_window_type().encode("utf8")) StreamIO.write_string( stream, json.dumps(packet.get_window_title()).encode("utf8")) StreamIO.write_ubyte(stream, packet.get_slots_number()) if packet.get_window_type() == "EntityHorse": StreamIO.write_int(stream, packet.get_entity_id())
def write(stream, tag): if tag is None: StreamIO.write_ubyte(0x00) return StreamIO.write_ubyte(stream, NBTTagCompound.TYPE_ID) StreamIO.write_ushort(stream, 0) NBTTagCompound.write(stream, tag)
def write(stream, packet): StreamIO.write_ubyte(stream, packet.get_window_id()) StreamIO.write_short(stream, len(packet.get_slots())) for slot_data in packet.get_slots(): StreamIO.write_short(stream, slot_data.get_id()) if not slot_data.is_empty(): StreamIO.write_byte(stream, slot_data.get_count()) StreamIO.write_short(stream, slot_data.get_damage()) NBTSerializer.write(stream, slot_data.get_tag())
def write(stream, packet): StreamIO.write_ubyte(stream, packet.get_window_id()) StreamIO.write_short(stream, packet.get_slot()) StreamIO.write_byte(stream, packet.get_button()) StreamIO.write_short(stream, packet.get_transaction_id()) StreamIO.write_byte(stream, packet.get_mode()) StreamIO.write_short(stream, packet.get_slot_data().get_id()) if not packet.get_slot_data().is_empty(): StreamIO.write_byte(stream, packet.get_slot_data().get_count()) StreamIO.write_short(stream, packet.get_slot_data().get_damage()) NBTSerializer.write(stream, packet.get_slot_data().get_tag())
def write(stream, packet): StreamIO.write_int(stream, packet.get_entity_id()) StreamIO.write_ubyte(stream, packet.get_gamemode()) StreamIO.write_byte(stream, packet.get_dimension()) StreamIO.write_ubyte(stream, packet.get_difficulty()) StreamIO.write_ubyte(stream, packet.get_max_players()) StreamIO.write_string(stream, packet.get_level_type().encode("utf8")) StreamIO.write_bool(stream, packet.is_debug_info())
def write(stream, tag): StreamIO.write_ubyte(stream, tag.get_tag_type().TYPE_ID) StreamIO.write_int(stream, len(tag)) for i in tag: tag.get_tag_type().write(stream, i)
def write(stream, packet): StreamIO.write_ubyte(stream, packet.get_window_id())