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

View file

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

View file

@ -6,6 +6,7 @@ import com.google.gson.JsonObject;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -47,8 +48,10 @@ public class DuplicationConfig extends Config {
@Override @Override
public DuplicationConfig deserialize(JsonObject json) { public DuplicationConfig deserialize(JsonObject json) {
Set<ResourceLocation> ignoreRecipeTypes = deserializeResourceLocations(json, IGNORED_RECIPE_TYPES); Set<ResourceLocation> ignoreRecipeTypes = deserializeResourceLocations(json,
Set<ResourceLocation> ignoreRecipes = deserializeResourceLocations(json, IGNORED_RECIPES); IGNORED_RECIPE_TYPES,
Defaults.IGNORED_RECIPE_TYPES);
Set<ResourceLocation> ignoreRecipes = deserializeResourceLocations(json, IGNORED_RECIPES, List.of());
JsonCompare.CompareSettings defaultRules = safeGet(() -> createCompareSet(json.getAsJsonObject( JsonCompare.CompareSettings defaultRules = safeGet(() -> createCompareSet(json.getAsJsonObject(
DEFAULT_DUPLICATE_RULES)), 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_TAGS = "ignoredTags";
public static final String IGNORED_RECIPE_TYPES = "ignoredRecipeTypes"; public static final String IGNORED_RECIPE_TYPES = "ignoredRecipeTypes";
public static final String IGNORED_RECIPES = "ignoredRecipes"; public static final String IGNORED_RECIPES = "ignoredRecipes";
public static final String HIDE_JEI_REI = "itemsHidingJeiRei"; public static final String HIDE_JEI_REI = "itemsHidingJeiRei";
@Override @Override
@ -103,8 +102,10 @@ public class UnifyConfig extends Config {
.stream() .stream()
.map(s -> UnifyTag.item(new ResourceLocation(s))) .map(s -> UnifyTag.item(new ResourceLocation(s)))
.collect(Collectors.toSet()), new HashSet<>()); .collect(Collectors.toSet()), new HashSet<>());
Set<ResourceLocation> ignoredRecipeTypes = deserializeResourceLocations(json, IGNORED_RECIPE_TYPES); Set<ResourceLocation> ignoredRecipeTypes = deserializeResourceLocations(json,
Set<ResourceLocation> ignoredRecipes = deserializeResourceLocations(json, IGNORED_RECIPES); 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); boolean hideJeiRei = safeGet(() -> json.getAsJsonPrimitive(HIDE_JEI_REI).getAsBoolean(), true);
return new UnifyConfig(stoneStrata, return new UnifyConfig(stoneStrata,