âī¸ 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.
The configuration for conflict resolution is located in the config.yml
file under the section resource-pack.duplicated-files-handler
.
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
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"