-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add docs on resource-pack merging
- Loading branch information
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ fonts.md | |
language.md | ||
sounds.md | ||
putting-all-together.md | ||
merging.md | ||
examples | ||
serialization | ||
server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Merging | ||
|
||
Developers can merge two resource-packs together using the | ||
`ResourcePack#merge(ResourcePack, MergeStrategy)` method. | ||
|
||
<!--@formatter:off--> | ||
```java | ||
// get our resource packs | ||
ResourcePack base = ...; | ||
ResourcePack other = ...; | ||
|
||
// merge | ||
base.merge(other, MergeStrategy.override()); | ||
|
||
// now base contains all the resources from other | ||
``` | ||
<!--@formatter:on--> | ||
|
||
There are three built-in merge strategies: | ||
|
||
- `override()`: overrides the resources of the base resource-pack with the resources | ||
of the second one if there are duplicates. | ||
- `mergeAndFailOnError()`: merges the resources of the base resource-pack with the | ||
resources of the second one, resulting in a `MergeException` if there are duplicates that | ||
can't be merged. | ||
- `mergeAndKeepFirstOnError()`: merges the resources of the | ||
base resource-pack with the resources of the second one, | ||
keeping only the resources of the first resource-pack if there | ||
are duplicates that can't be merged. |