def nbt_path_join(*args):
    """Join two NBT paths into a longer path, similar to os.path.join()."""
    if len(args) == 0:
        return '{}'
    if len(args) == 1:
        return args[0]
    if args[-1] == '':
        return nbt_path_join(*args[:-1])
    if args[1].startswith('['):
        return nbt_path_join(f'{args[0]}{args[1]}', *args[2:])
    return nbt_path_join(f'{args[0]}.{args[1]}', *args[2:])