add cucumber shaped tag to default ignored recipe types

This commit is contained in:
Relentless 2022-08-25 18:26:32 +02:00
parent 1b8c5dc7eb
commit e32e84e523
No known key found for this signature in database
GPG key ID: 759D97B8C6F25265
4 changed files with 17 additions and 11 deletions

View file

@ -14,6 +14,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Collectors;
@ -88,12 +89,13 @@ public class Config {
return defaultValue;
}
protected Set<ResourceLocation> deserializeResourceLocations(JsonObject json, String configKey) {
protected Set<ResourceLocation> deserializeResourceLocations(JsonObject json, String configKey, List<String> defaultValue) {
return safeGet(() -> JsonUtils
.toList(json.getAsJsonArray(configKey))
.stream()
.map(ResourceLocation::new)
.collect(Collectors.toSet()), new HashSet<>());
.toList(json.getAsJsonArray(configKey))
.stream()
.map(ResourceLocation::new)
.collect(Collectors.toSet()),
new HashSet<>(defaultValue.stream().map(ResourceLocation::new).toList()));
}
protected void serializeResourceLocations(JsonObject json, String configKey, Set<ResourceLocation> resourceLocations) {

View file

@ -56,8 +56,8 @@ public final class Defaults {
"tin",
"uranium",
"zinc"
);
public static final List<String> IGNORED_RECIPE_TYPES = List.of("cucumber:shaped_tag");
private Defaults() {}

View file

@ -6,6 +6,7 @@ import com.google.gson.JsonObject;
import net.minecraft.resources.ResourceLocation;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@ -47,8 +48,10 @@ public class DuplicationConfig extends Config {
@Override
public DuplicationConfig deserialize(JsonObject json) {
Set<ResourceLocation> ignoreRecipeTypes = deserializeResourceLocations(json, IGNORED_RECIPE_TYPES);
Set<ResourceLocation> ignoreRecipes = deserializeResourceLocations(json, IGNORED_RECIPES);
Set<ResourceLocation> ignoreRecipeTypes = deserializeResourceLocations(json,
IGNORED_RECIPE_TYPES,
Defaults.IGNORED_RECIPE_TYPES);
Set<ResourceLocation> ignoreRecipes = deserializeResourceLocations(json, IGNORED_RECIPES, List.of());
JsonCompare.CompareSettings defaultRules = safeGet(() -> createCompareSet(json.getAsJsonObject(
DEFAULT_DUPLICATE_RULES)),

View file

@ -85,7 +85,6 @@ public class UnifyConfig extends Config {
public static final String IGNORED_TAGS = "ignoredTags";
public static final String IGNORED_RECIPE_TYPES = "ignoredRecipeTypes";
public static final String IGNORED_RECIPES = "ignoredRecipes";
public static final String HIDE_JEI_REI = "itemsHidingJeiRei";
@Override
@ -103,8 +102,10 @@ public class UnifyConfig extends Config {
.stream()
.map(s -> UnifyTag.item(new ResourceLocation(s)))
.collect(Collectors.toSet()), new HashSet<>());
Set<ResourceLocation> ignoredRecipeTypes = deserializeResourceLocations(json, IGNORED_RECIPE_TYPES);
Set<ResourceLocation> ignoredRecipes = deserializeResourceLocations(json, IGNORED_RECIPES);
Set<ResourceLocation> ignoredRecipeTypes = deserializeResourceLocations(json,
IGNORED_RECIPE_TYPES,
Defaults.IGNORED_RECIPE_TYPES);
Set<ResourceLocation> ignoredRecipes = deserializeResourceLocations(json, IGNORED_RECIPES, List.of());
boolean hideJeiRei = safeGet(() -> json.getAsJsonPrimitive(HIDE_JEI_REI).getAsBoolean(), true);
return new UnifyConfig(stoneStrata,