Skip to main content

âš”ī¸ File Conflict

Introduction​

When merging multiple resource packs, we often encounter conflicting files, such as pack.png, sounds.json, and so on. Configuring them into a single file can be quite tedious. Therefore, the plugin provides a conflict resolver that allows you to customize the solution for resolving conflicts. When the plugin detects conflicting files, it will search for the first solution that meets the conditions. If no suitable solution is found, it will issue a warning to the user in the console.

info

The configuration for conflict resolution is located in the config.yml file under the section resource-pack.duplicated-files-handler.

warning

The plugin does not support the merging of shaders, as it is considered unstable.

duplicated-files-handler:
# handle item models
- term:
type: any_of
terms:
- type: parent_path_suffix
suffix: "minecraft/items" # 1.21.4+
- type: parent_path_suffix
suffix: "minecraft/models/item" # 1.20-1.21.3
resolution:
type: merge_json
deeply: true
# handle pack.mcmeta
- term:
type: exact
path: "pack.mcmeta"
resolution:
type: merge_pack_mcmeta
description: "<gray>CraftEngine ResourcePack"
# handle pack.png
- term:
type: exact
path: "pack.png"
resolution:
type: retain_matching
term:
type: contains
path: "resources/default/resourcepack"
# handle sounds
- term:
type: filename
name: "sounds.json"
resolution:
type: merge_json
deeply: false
tip

You can simply understand it as: term determines the matching rules, and resolution decides how to handle the conflicting files. Below are some available matching methods and resolution options:

Matching Rule​

all_of​

All conditions must be satisfied.

type: all_of
terms:
- type: xxx1
aaa: bbb
- type: xxx2
ccc: ddd

any_of​

Satisfy any one of the conditions.

type: any_of
terms:
- type: xxx1
aaa: bbb
- type: xxx2
ccc: ddd

inverted​

Negate the result value of the current condition.

type: inverted
term:
type: xxx

filename​

Match the filename

type: filename
name: "sounds.json"

exact​

Match the exact path

type: exact
path: "assets/minecraft/lang/en_us.json"

type: exact
path: "pack.mcmeta"

parent_path_prefix / parent_path_suffix​

Detect whether a path has a specific prefix or suffix

type: parent_path_prefix 
path: "assets/minecraft"

type: parent_path_suffix
path: "minecraft/models/item"

contains​

Check if the path contains the characters

type: contains
path: "custom/furniture"

pattern​

Use regex to match path

type: pattern
pattern: "Regex Here"

Resolution​

merge_json​

Combine two json files into one

type: merge_json
deeply: true

retain_matching​

When two files conflict, keep the one that meets the specified condition.

type: retain_matching
term:
type: contains
path: "resources/default/resourcepack"

conditional​

Run a conditional resolution

type: conditional
term:
type: xxx
resolution:
type: xxx

merge_pack_mcmeta​

A special resolution customized for pack.mcmeta

type: "merge_pack_mcmeta"
description: "<gray>CraftEngine ResourcePack" # pack description

merge_atlas​

A special resolution customized for atlases/xx.json

type: "merge_atlas"