mirror of
https://github.com/AlmostReliable/almostunified.git
synced 2024-11-14 19:25:13 -05:00
parent
3558ed2c30
commit
e1c5b3d992
1 changed files with 4 additions and 3 deletions
|
@ -116,7 +116,7 @@ public class RecipeTransformer {
|
||||||
* @param tracker The tracker to add the recipes to. Can be null in a server only environment.
|
* @param tracker The tracker to add the recipes to. Can be null in a server only environment.
|
||||||
*/
|
*/
|
||||||
private void transformRecipes(List<RecipeLink> recipeLinks, Map<ResourceLocation, JsonElement> allRecipes, @Nullable ClientRecipeTracker.RawBuilder tracker) {
|
private void transformRecipes(List<RecipeLink> recipeLinks, Map<ResourceLocation, JsonElement> allRecipes, @Nullable ClientRecipeTracker.RawBuilder tracker) {
|
||||||
var unified = unifyRecipes(recipeLinks, (r) -> allRecipes.put(r.getId(), r.getUnified()));
|
var unified = unifyRecipes(recipeLinks, r -> allRecipes.put(r.getId(), r.getUnified()));
|
||||||
var duplicates = handleDuplicates(duplicationConfig.isStrictMode() ? recipeLinks : unified, recipeLinks);
|
var duplicates = handleDuplicates(duplicationConfig.isStrictMode() ? recipeLinks : unified, recipeLinks);
|
||||||
duplicates
|
duplicates
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -131,6 +131,7 @@ public class RecipeTransformer {
|
||||||
.stream()
|
.stream()
|
||||||
.filter(entry -> includeRecipe(entry.getKey(), entry.getValue()))
|
.filter(entry -> includeRecipe(entry.getKey(), entry.getValue()))
|
||||||
.map(entry -> new RecipeLink(entry.getKey(), entry.getValue().getAsJsonObject()))
|
.map(entry -> new RecipeLink(entry.getKey(), entry.getValue().getAsJsonObject()))
|
||||||
|
.sorted(Comparator.comparing(entry -> entry.getId().toString()))
|
||||||
.collect(Collectors.groupingByConcurrent(RecipeLink::getType));
|
.collect(Collectors.groupingByConcurrent(RecipeLink::getType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,8 +193,8 @@ public class RecipeTransformer {
|
||||||
* @param onUnified A consumer that will be called on each unified recipe.
|
* @param onUnified A consumer that will be called on each unified recipe.
|
||||||
* @return A list of unified recipes.
|
* @return A list of unified recipes.
|
||||||
*/
|
*/
|
||||||
private Set<RecipeLink> unifyRecipes(List<RecipeLink> recipeLinks, Consumer<RecipeLink> onUnified) {
|
private LinkedHashSet<RecipeLink> unifyRecipes(List<RecipeLink> recipeLinks, Consumer<RecipeLink> onUnified) {
|
||||||
Set<RecipeLink> unified = new HashSet<>(recipeLinks.size());
|
LinkedHashSet<RecipeLink> unified = new LinkedHashSet<>(recipeLinks.size());
|
||||||
for (RecipeLink recipeLink : recipeLinks) {
|
for (RecipeLink recipeLink : recipeLinks) {
|
||||||
unifyRecipe(recipeLink);
|
unifyRecipe(recipeLink);
|
||||||
if (recipeLink.isUnified()) {
|
if (recipeLink.isUnified()) {
|
||||||
|
|
Loading…
Reference in a new issue