ClientEvents.highPriorityAssets(event => {
    //Fencier Fences
    let fencierFences = (modID, type, event) => {
        event.add(`${modID}:blockstates/${type}_fence`, {
            "multipart": [
                {
                    "apply": {
                        "model": `${modID}:block/${type}_fence_post`
                    }
                },
                {
                    "apply": {
                        "model": `${modID}:block/${type}_fence_side`,
                        "uvlock": false
                    },
                    "when": {
                        "north": "true"
                    }
                },
                {
                    "apply": {
                        "model": `${modID}:block/${type}_fence_side`,
                        "uvlock": false,
                        "y": 90
                    },
                    "when": {
                        "east": "true"
                    }
                },
                {
                    "apply": {
                        "model": `${modID}:block/${type}_fence_side`,
                        "uvlock": false,
                        "y": 180
                    },
                    "when": {
                        "south": "true"
                    }
                },
                {
                    "apply": {
                        "model": `${modID}:block/${type}_fence_side`,
                        "uvlock": false,
                        "y": 270
                    },
                    "when": {
                        "west": "true"
                    }
                }
            ]
        });
        event.add(`${modID}:blockstates/${type}_fence_gate`, {
            "variants": {
                "facing=east,in_wall=false,open=false": {
                    "model": `${modID}:block/${type}_fence_gate`,
                    "uvlock": false,
                    "y": 270
                },
                "facing=east,in_wall=false,open=true": {
                    "model": `${modID}:block/${type}_fence_gate_open`,
                    "uvlock": false,
                    "y": 270
                },
                "facing=east,in_wall=true,open=false": {
                    "model": `${modID}:block/${type}_fence_gate_wall`,
                    "uvlock": false,
                    "y": 270
                },
                "facing=east,in_wall=true,open=true": {
                    "model": `${modID}:block/${type}_fence_gate_wall_open`,
                    "uvlock": false,
                    "y": 270
                },
                "facing=north,in_wall=false,open=false": {
                    "model": `${modID}:block/${type}_fence_gate`,
                    "uvlock": false,
                    "y": 180
                },
                "facing=north,in_wall=false,open=true": {
                    "model": `${modID}:block/${type}_fence_gate_open`,
                    "uvlock": false,
                    "y": 180
                },
                "facing=north,in_wall=true,open=false": {
                    "model": `${modID}:block/${type}_fence_gate_wall`,
                    "uvlock": false,
                    "y": 180
                },
                "facing=north,in_wall=true,open=true": {
                    "model": `${modID}:block/${type}_fence_gate_wall_open`,
                    "uvlock": false,
                    "y": 180
                },
                "facing=south,in_wall=false,open=false": {
                    "model": `${modID}:block/${type}_fence_gate`,
                    "uvlock": false
                },
                "facing=south,in_wall=false,open=true": {
                    "model": `${modID}:block/${type}_fence_gate_open`,
                    "uvlock": false
                },
                "facing=south,in_wall=true,open=false": {
                    "model": `${modID}:block/${type}_fence_gate_wall`,
                    "uvlock": false
                },
                "facing=south,in_wall=true,open=true": {
                    "model": `${modID}:block/${type}_fence_gate_wall_open`,
                    "uvlock": false
                },
                "facing=west,in_wall=false,open=false": {
                    "model": `${modID}:block/${type}_fence_gate`,
                    "uvlock": false,
                    "y": 90
                },
                "facing=west,in_wall=false,open=true": {
                    "model": `${modID}:block/${type}_fence_gate_open`,
                    "uvlock": false,
                    "y": 90
                },
                "facing=west,in_wall=true,open=false": {
                    "model": `${modID}:block/${type}_fence_gate_wall`,
                    "uvlock": false,
                    "y": 90
                },
                "facing=west,in_wall=true,open=true": {
                    "model": `${modID}:block/${type}_fence_gate_wall_open`,
                    "uvlock": false,
                    "y": 90
                }
            }
        });
        event.add(`${modID}:models/block/${type}_fence_gate`, {
            "parent": "block/fencier_fence_gate",
            "textures": {
                "texture": `${modID}:block/${type}_planks`
            }
        });
        event.add(`${modID}:models/block/${type}_fence_gate_open`, {
            "parent": "block/fencier_fence_gate_open",
            "textures": {
                "texture": `${modID}:block/${type}_planks`
            }
        });
        event.add(`${modID}:models/block/${type}_fence_gate_wall`, {
            "parent": "block/fencier_fence_gate_wall",
            "textures": {
                "texture": `${modID}:block/${type}_planks`
            }
        });
        event.add(`${modID}:models/block/${type}_fence_gate_wall_open`, {
            "parent": "block/fencier_fence_gate_wall_open",
            "textures": {
                "texture": `${modID}:block/${type}_planks`
            }
        });
        event.add(`${modID}:models/block/${type}_fence_inventory`, {
            "parent": "block/fencier_fence_inventory",
            "textures": {
                "texture": `${modID}:block/${type}_planks`
            }
        });
        event.add(`${modID}:models/block/${type}_fence_side`, {
            "parent": "block/fencier_fence_side",
            "textures": {
                "texture": `${modID}:block/${type}_planks`
            }
        });
        event.add(`${modID}:models/block/${type}_fence_post`, {
            "parent": "block/fencier_fence_post",
            "textures": {
                "texture": `${modID}:block/${type}_planks`
            }
        });
    };

    ['blossom', 'ancient', 'azalea'].forEach(material => { fencierFences('quark', material, event); });
});