-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a method to data generator entrypoints to register custom keys wi…
…th priorities (#3087) * Add JsonKeySortOrderCallback * Use an entry point rather than an event for sort keys and priorities * Resolve static imports * Add a bit of javadoc * Check if a key is null and modify the javadoc * Add a field reference in the javadoc * Rename JsonKeySortOrderAdder to JsonKeySortOrderCallback (cherry picked from commit 0883a8d)
- Loading branch information
1 parent
5c13385
commit bbae80f
Showing
5 changed files
with
67 additions
and
0 deletions.
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
32 changes: 32 additions & 0 deletions
32
...ion-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/JsonKeySortOrderCallback.java
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,32 @@ | ||
/* | ||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.fabric.api.datagen.v1; | ||
|
||
/** | ||
* Provides a callback for setting the sort priority of object keys in generated JSON files. | ||
*/ | ||
@FunctionalInterface | ||
public interface JsonKeySortOrderCallback { | ||
/** | ||
* Sets the sort priority for a given object key within generated JSON files. | ||
* @param key the key to set priority for | ||
* @param priority the priority for the key, where keys with lower priority are sorted before keys with higher priority | ||
* @implNote The default priority is 2. | ||
* @see net.minecraft.data.DataProvider#JSON_KEY_SORT_ORDER | ||
*/ | ||
void add(String key, int priority); | ||
} |
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
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