diff --git a/Common/src/main/java/com/almostreliable/unified/core/AlmostUnifiedRuntimeImpl.java b/Common/src/main/java/com/almostreliable/unified/core/AlmostUnifiedRuntimeImpl.java index f3919bf..16bb2a5 100644 --- a/Common/src/main/java/com/almostreliable/unified/core/AlmostUnifiedRuntimeImpl.java +++ b/Common/src/main/java/com/almostreliable/unified/core/AlmostUnifiedRuntimeImpl.java @@ -50,16 +50,16 @@ import java.util.stream.Collectors; public final class AlmostUnifiedRuntimeImpl implements AlmostUnifiedRuntime { private final Collection unificationSettings; - private final CustomIngredientUnifierRegistry customIngredientUnifierRegistry; + private final CustomIngredientUnifierRegistry ingredientUnifierRegistry; private final RecipeUnifierRegistry recipeUnifierRegistry; private final TagSubstitutions tagSubstitutions; private final Placeholders placeholders; private final UnificationLookup compositeUnificationLookup; private final DebugHandler debugHandler; - private AlmostUnifiedRuntimeImpl(Collection unificationSettings, CustomIngredientUnifierRegistry customIngredientUnifierRegistry, RecipeUnifierRegistry recipeUnifierRegistry, TagSubstitutions tagSubstitutions, Placeholders placeholders, DebugConfig debugConfig) { + private AlmostUnifiedRuntimeImpl(Collection unificationSettings, CustomIngredientUnifierRegistry ingredientUnifierRegistry, RecipeUnifierRegistry recipeUnifierRegistry, TagSubstitutions tagSubstitutions, Placeholders placeholders, DebugConfig debugConfig) { this.unificationSettings = unificationSettings; - this.customIngredientUnifierRegistry = customIngredientUnifierRegistry; + this.ingredientUnifierRegistry = ingredientUnifierRegistry; this.recipeUnifierRegistry = recipeUnifierRegistry; this.tagSubstitutions = tagSubstitutions; this.placeholders = placeholders; @@ -83,8 +83,8 @@ public final class AlmostUnifiedRuntimeImpl implements AlmostUnifiedRuntime { debugConfig.shouldLogInvalidTags() ); - CustomIngredientUnifierRegistry customIngredientUnifierRegistry = new CustomIngredientUnifierRegistryImpl(); - PluginManager.instance().registerCustomIngredientUnifiers(customIngredientUnifierRegistry); + CustomIngredientUnifierRegistry ingredientUnifierRegistry = new CustomIngredientUnifierRegistryImpl(); + PluginManager.instance().registerCustomIngredientUnifiers(ingredientUnifierRegistry); RecipeUnifierRegistry recipeUnifierRegistry = new RecipeUnifierRegistryImpl(); PluginManager.instance().registerRecipeUnifiers(recipeUnifierRegistry); // TODO: add plugin support for registering config defaults @@ -108,7 +108,7 @@ public final class AlmostUnifiedRuntimeImpl implements AlmostUnifiedRuntime { return new AlmostUnifiedRuntimeImpl( unificationSettings, - customIngredientUnifierRegistry, + ingredientUnifierRegistry, recipeUnifierRegistry, tagSubstitutions, placeholderConfig, @@ -197,12 +197,10 @@ public final class AlmostUnifiedRuntimeImpl implements AlmostUnifiedRuntime { public void run(Map recipes) { debugHandler.onRunStart(recipes, compositeUnificationLookup); - debugHandler.measure(() -> { - var transformer = new RecipeTransformer(customIngredientUnifierRegistry, - recipeUnifierRegistry, - unificationSettings); - return transformer.transformRecipes(recipes); - }); + debugHandler.measure(() -> + new RecipeTransformer(ingredientUnifierRegistry, recipeUnifierRegistry, unificationSettings) + .transformRecipes(recipes) + ); debugHandler.onRunEnd(recipes); } diff --git a/Common/src/main/java/com/almostreliable/unified/unification/recipe/RecipeTransformer.java b/Common/src/main/java/com/almostreliable/unified/unification/recipe/RecipeTransformer.java index f1b29b0..3b9b4af 100644 --- a/Common/src/main/java/com/almostreliable/unified/unification/recipe/RecipeTransformer.java +++ b/Common/src/main/java/com/almostreliable/unified/unification/recipe/RecipeTransformer.java @@ -37,15 +37,15 @@ import java.util.stream.Collectors; public class RecipeTransformer { - private final CustomIngredientUnifierRegistry customIngredientUnifierRegistry; - private final RecipeUnifierRegistry factory; + private final CustomIngredientUnifierRegistry ingredientUnifierRegistry; + private final RecipeUnifierRegistry recipeUnifierRegistry; private final Collection unificationSettings; private final DuplicateConfig duplicateConfig; private final RecipeTypePropertiesLogger propertiesLogger = new RecipeTypePropertiesLogger(); - public RecipeTransformer(CustomIngredientUnifierRegistry customIngredientUnifierRegistry, RecipeUnifierRegistry factory, Collection unificationSettings) { - this.customIngredientUnifierRegistry = customIngredientUnifierRegistry; - this.factory = factory; + public RecipeTransformer(CustomIngredientUnifierRegistry ingredientUnifierRegistry, RecipeUnifierRegistry recipeUnifierRegistry, Collection unificationSettings) { + this.ingredientUnifierRegistry = ingredientUnifierRegistry; + this.recipeUnifierRegistry = recipeUnifierRegistry; this.unificationSettings = unificationSettings; this.duplicateConfig = Config.load(DuplicateConfig.NAME, DuplicateConfig.SERIALIZER); } @@ -191,8 +191,8 @@ public class RecipeTransformer { continue; } - UnificationHelperImpl helper = new UnificationHelperImpl(customIngredientUnifierRegistry, settings); - RecipeUnifier unifier = factory.getRecipeUnifier(recipe); + UnificationHelperImpl helper = new UnificationHelperImpl(ingredientUnifierRegistry, settings); + RecipeUnifier unifier = recipeUnifierRegistry.getRecipeUnifier(recipe); unifier.unify(helper, json); } diff --git a/Common/src/main/java/com/almostreliable/unified/unification/recipe/UnificationHelperImpl.java b/Common/src/main/java/com/almostreliable/unified/unification/recipe/UnificationHelperImpl.java index 41c1e38..e610c98 100644 --- a/Common/src/main/java/com/almostreliable/unified/unification/recipe/UnificationHelperImpl.java +++ b/Common/src/main/java/com/almostreliable/unified/unification/recipe/UnificationHelperImpl.java @@ -20,13 +20,15 @@ import com.google.gson.JsonPrimitive; import org.jetbrains.annotations.Nullable; -public record UnificationHelperImpl(CustomIngredientUnifierRegistry customIngredientUnifierRegistry, - UnificationLookup getUnificationLookup) implements UnificationHelper { +public record UnificationHelperImpl( + CustomIngredientUnifierRegistry ingredientUnifierRegistry, + UnificationLookup getUnificationLookup +) implements UnificationHelper { @Nullable @Override public CustomIngredientUnifier getCustomIngredientUnifier(ResourceLocation type) { - return customIngredientUnifierRegistry.getCustomIngredientUnifier(type); + return ingredientUnifierRegistry.getCustomIngredientUnifier(type); } @Override