import os
folder = r"D:\PCL\.minecraft\versions\26.1-Fabric 0.18.5\26.1-Fabric 0.18.5\block"
for json in os.listdir(folder):
    if "_ore" in json:
        print(json)
        with open(folder + '\\' + json, 'r') as txt1:
            dic = eval(txt1.read())
            dic["parent"] = dic["parent"].replace("block/", "block/highlight/")
            
            if "cube_all" in dic["parent"]:
                dic1 = dic["textures"]
                dic1["highlight"] = dic1["all"].replace("block/", "block/highlight/")
                
                if "nether_" in json:
                    dic1["all"] = "minecraft:block/netherrack"
                elif "deepslate_" in json:
                    dic1["all"] = "minecraft:block/deepslate"
                else:
                    dic1["all"] = "minecraft:block/stone"
                
                dic["textures"] = dic1
                
            with open("block/" + json, 'w'):
                pass
            with open("block/" + json, 'a') as txt2:
                txt2.write(str(dic).replace("'", '"'))
                
    elif "raw_" in json:
        print(json)
        with open(folder + '\\' + json, 'r') as txt1:
            dic = eval(txt1.read())
            dic["parent"] = dic["parent"].replace("block/", "block/highlight/")
            
            dic1 = dic["textures"]
            dic1["highlight"] = dic1["all"]
            
            dic["textures"] = dic1
            with open("block/" + json, 'w'):
                pass
            with open("block/" + json, 'a') as txt2:
                txt2.write(str(dic).replace("'", '"'))
