def parse_respawn(fileobj, socket): result = {} result["Dimension"] = data_type_parser.parse_int(fileobj) result["Difficulty"] = mc_datatype.readByte(fileobj) result["GameMode"] = mc_datatype.readByte(fileobj) result["WorldHeight"] = data_type_parser.parse_short(fileobj) result["LevelType"] = mc_datatype.readString(fileobj) return generate_return_data("Respawn", result)
def parse_encryption_key_request(fileobj, socket): result={} result["ServerID"]=mc_datatype.readString(fileobj) result["PublicKeyLength"]=mc_datatype.readShort(fileobj) result["PublicKey"]=mc_datatype.readByteArray(fileobj,result["PublicKeyLength"]) result["VerifyTokenLength"]=mc_datatype.readShort(fileobj) result["VerifyToken"]=mc_datatype.readByteArray(fileobj,result["VerifyTokenLength"]) return result
def parse_respawn(fileobj, socket): result = {} result["Dimension"] = data_type_parser.parse_int(fileobj) result["Difficulty"] = mc_datatype.readByte(fileobj) result["GameMode"] = mc_datatype.readByte(fileobj) result["WorldHeight"] = data_type_parser.parse_short(fileobj) result["LevelType"] = mc_datatype.readString(fileobj) return generate_return_data("Respawn",result)
def parse_named_sound_effect(fileobj, socket): result = {} result["SoundName"] = mc_datatype.readString(fileobj) result["EffectPositionX"] = mc_datatype.readInt(fileobj) result["EffectPositionY"] = mc_datatype.readInt(fileobj) result["EffectPositionZ"] = mc_datatype.readInt(fileobj) result["Volume"] = mc_datatype.readFloat(fileobj) result["Pitch"] = mc_datatype.readByte(fileobj) return result
def parse_spawn_painting(fileobj, socket): result = {} result["EntitiyID"] = data_type_parser.parse_int(fileobj) result["Title"] = mc_datatype.readString(fileobj) result["X"] = data_type_parser.parse_int(fileobj) result["Y"] = data_type_parser.parse_int(fileobj) result["Z"] = data_type_parser.parse_int(fileobj) result["Direction"] = data_type_parser.parse_int(fileobj) return result
def parse_named_sound_effect(fileobj, socket): result={} result["SoundName"]=mc_datatype.readString(fileobj) result["EffectPositionX"]=mc_datatype.readInt(fileobj) result["EffectPositionY"]=mc_datatype.readInt(fileobj) result["EffectPositionZ"]=mc_datatype.readInt(fileobj) result["Volume"]=mc_datatype.readFloat(fileobj) result["Pitch"]=mc_datatype.readByte(fileobj) return result
def parse_login_request(fileobj, socket): result = {} result['EntityID'] = mc_datatype.readInt(fileobj) result['LevelType'] = mc_datatype.readString(fileobj) result["GameMode"] = mc_datatype.readByte(fileobj) result["Dimension"] = mc_datatype.readByte(fileobj) result["Difficulty"] = mc_datatype.readByte(fileobj) result["NotUsed"] = mc_datatype.readByte(fileobj) result["MaxPlayers"] = mc_datatype.readByte(fileobj) return generate_return_data("Login_Request", result)
def parse_login_request(fileobj, socket): result = {} result['EntityID'] = mc_datatype.readInt(fileobj) result['LevelType'] = mc_datatype.readString(fileobj) result["GameMode"] = mc_datatype.readByte(fileobj) result["Dimension"] = mc_datatype.readByte(fileobj) result["Difficulty"] = mc_datatype.readByte(fileobj) result["NotUsed"] = mc_datatype.readByte(fileobj) result["MaxPlayers"] = mc_datatype.readByte(fileobj) return generate_return_data("Login_Request",result)
def parse_encryption_key_request(fileobj, socket): result = {} result["ServerID"] = mc_datatype.readString(fileobj) result["PublicKeyLength"] = mc_datatype.readShort(fileobj) result["PublicKey"] = mc_datatype.readByteArray(fileobj, result["PublicKeyLength"]) result["VerifyTokenLength"] = mc_datatype.readShort(fileobj) result["VerifyToken"] = mc_datatype.readByteArray( fileobj, result["VerifyTokenLength"]) return result
def parse_entity_properties(FileObject, socket): EntityID = mc_datatype.readInt(FileObject) PropertiesCount = mc_datatype.readInt(FileObject) Properties = {} for i in range(PropertiesCount): key = mc_datatype.readString(FileObject) value = mc_datatype.readDouble(FileObject) Properties[key] = value len = mc_datatype.readShort(FileObject) for x in range(len): uuid_msb = mc_datatype.readLong(FileObject) uuid_lsb = mc_datatype.readLong(FileObject) amount = mc_datatype.readDouble(FileObject) operation = mc_datatype.readByte(FileObject) return {'EntityID': EntityID, 'Properties': Properties}
def parse_entity_properties(FileObject,socket): EntityID = mc_datatype.readInt(FileObject) PropertiesCount = mc_datatype.readInt(FileObject) Properties = {} for i in range(PropertiesCount): key = mc_datatype.readString(FileObject) value = mc_datatype.readDouble(FileObject) Properties[key] = value len = mc_datatype.readShort(FileObject) for x in range(len): uuid_msb = mc_datatype.readLong(FileObject) uuid_lsb = mc_datatype.readLong(FileObject) amount = mc_datatype.readDouble(FileObject) operation = mc_datatype.readByte(FileObject) return {'EntityID': EntityID, 'Properties': Properties }
def parse_chat_message(fileobj, socket): result={} result["ChatMessage"] = mc_datatype.readString(fileobj) return generate_return_data("Chat_Message",result)
def parse_disconnect_kick(fileobj,socket): result={} result["Reason"]=mc_datatype.readString(fileobj) return result
def parse_plugin_message(fileobj,socket): result={} result["Channel"]=mc_datatype.readString(fileobj) result["Length"]=mc_datatype.readShort(fileobj) result["Data"]=mc_datatype.readByteArray(fileobj,result["Length"]) return result
def parse_player_list_item(fileobj, socket): result = {} result["PlayerName"] = mc_datatype.readString(fileobj) result["Online"] = mc_datatype.readBoolean(fileobj) result["Ping"] = data_type_parser.parse_short(fileobj) return result
def parse_chat_message(fileobj, socket): result = {} result["ChatMessage"] = mc_datatype.readString(fileobj) return generate_return_data("Chat_Message", result)
def parse_disconnect_kick(fileobj, socket): result = {} result["Reason"] = mc_datatype.readString(fileobj) return result
def parse_plugin_message(fileobj, socket): result = {} result["Channel"] = mc_datatype.readString(fileobj) result["Length"] = mc_datatype.readShort(fileobj) result["Data"] = mc_datatype.readByteArray(fileobj, result["Length"]) return result