mirror of
https://github.com/AlmostReliable/almostunified.git
synced 2024-11-14 11:15:23 -05:00
shorten registry field name and update formatting
This commit is contained in:
parent
728b3d3b13
commit
c9995bdabd
3 changed files with 22 additions and 22 deletions
|
@ -50,16 +50,16 @@ import java.util.stream.Collectors;
|
|||
public final class AlmostUnifiedRuntimeImpl implements AlmostUnifiedRuntime {
|
||||
|
||||
private final Collection<? extends UnificationSettings> 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<? extends UnificationSettings> unificationSettings, CustomIngredientUnifierRegistry customIngredientUnifierRegistry, RecipeUnifierRegistry recipeUnifierRegistry, TagSubstitutions tagSubstitutions, Placeholders placeholders, DebugConfig debugConfig) {
|
||||
private AlmostUnifiedRuntimeImpl(Collection<? extends UnificationSettings> 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<ResourceLocation, JsonElement> 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);
|
||||
}
|
||||
|
|
|
@ -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<? extends UnificationSettings> unificationSettings;
|
||||
private final DuplicateConfig duplicateConfig;
|
||||
private final RecipeTypePropertiesLogger propertiesLogger = new RecipeTypePropertiesLogger();
|
||||
|
||||
public RecipeTransformer(CustomIngredientUnifierRegistry customIngredientUnifierRegistry, RecipeUnifierRegistry factory, Collection<? extends UnificationSettings> unificationSettings) {
|
||||
this.customIngredientUnifierRegistry = customIngredientUnifierRegistry;
|
||||
this.factory = factory;
|
||||
public RecipeTransformer(CustomIngredientUnifierRegistry ingredientUnifierRegistry, RecipeUnifierRegistry recipeUnifierRegistry, Collection<? extends UnificationSettings> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue