diff --git a/Common/src/main/java/com/almostreliable/unified/recipe/DuplicateLink.java b/Common/src/main/java/com/almostreliable/unified/recipe/DuplicateLink.java index b472a55..3dbd1cc 100644 --- a/Common/src/main/java/com/almostreliable/unified/recipe/DuplicateLink.java +++ b/Common/src/main/java/com/almostreliable/unified/recipe/DuplicateLink.java @@ -1,5 +1,6 @@ package com.almostreliable.unified.recipe; +import java.util.Collections; import java.util.HashSet; import java.util.Objects; import java.util.Set; @@ -13,19 +14,25 @@ public class DuplicateLink { } void updateMaster(RawRecipe master) { - 4 = {DuplicateLink@28142} Objects.requireNonNull(master); + Objects.requireNonNull(master); addDuplicate(master); this.currentMaster = master; } void addDuplicate(RawRecipe recipe) { - if(recipe == null) { - String s = ""; - } recipes.add(recipe); } public RawRecipe getMaster() { return currentMaster; } + + public Set getRecipes() { + return Collections.unmodifiableSet(recipes); + } + + @Override + public String toString() { + return "Link{currentMaster=" + currentMaster + ", recipes=" + recipes.size() + "}"; + } } diff --git a/Common/src/main/java/com/almostreliable/unified/recipe/RawRecipe.java b/Common/src/main/java/com/almostreliable/unified/recipe/RawRecipe.java index 4c9728d..9c18c4c 100644 --- a/Common/src/main/java/com/almostreliable/unified/recipe/RawRecipe.java +++ b/Common/src/main/java/com/almostreliable/unified/recipe/RawRecipe.java @@ -17,7 +17,6 @@ public class RawRecipe { @Nullable private DuplicateLink duplicateLink; @Nullable private JsonObject transformedRecipe; - public RawRecipe(ResourceLocation id, JsonObject originalRecipe) { this.id = id; this.originalRecipe = originalRecipe; @@ -109,4 +108,11 @@ public class RawRecipe { return null; } + + @Override + public String toString() { + String duplicate = duplicateLink != null ? " (duplicate)" : ""; + String transformed = transformedRecipe != null ? " (transformed)" : ""; + return String.format("['%s'] %s%s%s", type, id, duplicate, transformed); + } } diff --git a/Common/src/main/java/com/almostreliable/unified/recipe/RecipeTransformer.java b/Common/src/main/java/com/almostreliable/unified/recipe/RecipeTransformer.java index 6452024..816c8a3 100644 --- a/Common/src/main/java/com/almostreliable/unified/recipe/RecipeTransformer.java +++ b/Common/src/main/java/com/almostreliable/unified/recipe/RecipeTransformer.java @@ -54,6 +54,7 @@ public class RecipeTransformer { } } + // TODO remove later List duplicateLinks = rawRecipes .stream() .map(RawRecipe::getDuplicateLink)