mirror of
https://github.com/AlmostReliable/almostunified.git
synced 2024-11-23 16:18:24 -05:00
change continuation indent to 4
This commit is contained in:
parent
a3f8d8f6ef
commit
6972e7ff58
67 changed files with 2168 additions and 2167 deletions
|
@ -6,7 +6,8 @@ indent_style = space
|
|||
insert_final_newline = true
|
||||
max_line_length = 120
|
||||
tab_width = 4
|
||||
ij_continuation_indent_size = 8
|
||||
trim_trailing_whitespace = true
|
||||
ij_continuation_indent_size = 4
|
||||
ij_formatter_off_tag = @formatter:off
|
||||
ij_formatter_on_tag = @formatter:on
|
||||
ij_formatter_tags_enabled = true
|
||||
|
@ -15,7 +16,6 @@ ij_visual_guides = 120
|
|||
ij_wrap_on_typing = false
|
||||
|
||||
[*.java]
|
||||
ij_visual_guides = none
|
||||
ij_java_align_consecutive_assignments = false
|
||||
ij_java_align_consecutive_variable_declarations = false
|
||||
ij_java_align_group_field_declarations = false
|
||||
|
@ -61,6 +61,7 @@ ij_java_blank_lines_before_imports = 1
|
|||
ij_java_blank_lines_before_method_body = 0
|
||||
ij_java_blank_lines_before_package = 0
|
||||
ij_java_block_brace_style = end_of_line
|
||||
ij_java_block_comment_add_space = true
|
||||
ij_java_block_comment_at_first_column = true
|
||||
ij_java_builder_methods = none
|
||||
ij_java_call_parameters_new_line_after_left_paren = false
|
||||
|
|
|
@ -6,8 +6,8 @@ import java.util.ServiceLoader;
|
|||
public interface AlmostUnifiedPlatform {
|
||||
|
||||
AlmostUnifiedPlatform INSTANCE = ServiceLoader.load(AlmostUnifiedPlatform.class)
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new NullPointerException("Failed to load platform service."));
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new NullPointerException("Failed to load platform service."));
|
||||
|
||||
/**
|
||||
* Gets the current platform
|
||||
|
|
|
@ -27,26 +27,26 @@ public interface RecipeConstants {
|
|||
|
||||
// defaults
|
||||
String[] DEFAULT_INPUT_KEYS = {
|
||||
INPUT,
|
||||
INPUTS,
|
||||
INGREDIENT,
|
||||
INGREDIENTS,
|
||||
INPUT_ITEMS
|
||||
INPUT,
|
||||
INPUTS,
|
||||
INGREDIENT,
|
||||
INGREDIENTS,
|
||||
INPUT_ITEMS
|
||||
};
|
||||
String[] DEFAULT_INPUT_INNER_KEYS = {
|
||||
VALUE,
|
||||
BASE,
|
||||
INGREDIENT
|
||||
VALUE,
|
||||
BASE,
|
||||
INGREDIENT
|
||||
};
|
||||
String[] DEFAULT_OUTPUT_KEYS = {
|
||||
OUTPUT,
|
||||
OUTPUTS,
|
||||
RESULT,
|
||||
RESULTS,
|
||||
OUTPUT_ITEMS
|
||||
OUTPUT,
|
||||
OUTPUTS,
|
||||
RESULT,
|
||||
RESULTS,
|
||||
OUTPUT_ITEMS
|
||||
};
|
||||
String[] DEFAULT_OUTPUT_INNER_KEYS = {
|
||||
ITEM,
|
||||
INGREDIENT
|
||||
ITEM,
|
||||
INGREDIENT
|
||||
};
|
||||
}
|
||||
|
|
|
@ -50,10 +50,10 @@ public final class PluginManager {
|
|||
});
|
||||
|
||||
String ids = sortedPlugins
|
||||
.stream()
|
||||
.map(AlmostUnifiedPlugin::getPluginId)
|
||||
.map(ResourceLocation::toString)
|
||||
.collect(Collectors.joining(", "));
|
||||
.stream()
|
||||
.map(AlmostUnifiedPlugin::getPluginId)
|
||||
.map(ResourceLocation::toString)
|
||||
.collect(Collectors.joining(", "));
|
||||
AlmostUnifiedCommon.LOGGER.info("Loaded plugins: {}", ids);
|
||||
|
||||
INSTANCE = new PluginManager(sortedPlugins);
|
||||
|
|
|
@ -24,21 +24,21 @@ public final class AlmostKube {
|
|||
|
||||
public static Set<String> getTags() {
|
||||
return getRuntime()
|
||||
.getUnificationLookup()
|
||||
.getTags()
|
||||
.stream()
|
||||
.map(tag -> tag.location().toString())
|
||||
.collect(Collectors.toSet());
|
||||
.getUnificationLookup()
|
||||
.getTags()
|
||||
.stream()
|
||||
.map(tag -> tag.location().toString())
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
public static Set<String> getTagEntries(ResourceLocation tag) {
|
||||
var tagKey = TagKey.create(Registries.ITEM, tag);
|
||||
return getRuntime()
|
||||
.getUnificationLookup()
|
||||
.getTagEntries(tagKey)
|
||||
.stream()
|
||||
.map(holder -> holder.id().toString())
|
||||
.collect(Collectors.toSet());
|
||||
.getUnificationLookup()
|
||||
.getTagEntries(tagKey)
|
||||
.stream()
|
||||
.map(holder -> holder.id().toString())
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -64,8 +64,8 @@ public final class AlmostKube {
|
|||
|
||||
private static ResourceLocation getId(ItemStack stack) {
|
||||
return BuiltInRegistries.ITEM
|
||||
.getResourceKey(stack.getItem())
|
||||
.map(ResourceKey::location)
|
||||
.orElseThrow(() -> new IllegalArgumentException("Item not found in registry"));
|
||||
.getResourceKey(stack.getItem())
|
||||
.map(ResourceKey::location)
|
||||
.orElseThrow(() -> new IllegalArgumentException("Item not found in registry"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,11 @@ public class GregTechModernRecipeUnifier implements RecipeUnifier {
|
|||
doUnify(recipe, TICK_INPUTS, helper::unifyInputElement);
|
||||
|
||||
doUnify(recipe,
|
||||
RecipeConstants.OUTPUTS,
|
||||
json -> helper.unifyOutputObject(json, true, RecipeConstants.ITEM, RecipeConstants.INGREDIENT));
|
||||
RecipeConstants.OUTPUTS,
|
||||
json -> helper.unifyOutputObject(json, true, RecipeConstants.ITEM, RecipeConstants.INGREDIENT));
|
||||
doUnify(recipe,
|
||||
TICK_OUTPUTS,
|
||||
json -> helper.unifyOutputObject(json, true, RecipeConstants.ITEM, RecipeConstants.INGREDIENT));
|
||||
TICK_OUTPUTS,
|
||||
json -> helper.unifyOutputObject(json, true, RecipeConstants.ITEM, RecipeConstants.INGREDIENT));
|
||||
}
|
||||
|
||||
private void doUnify(RecipeJson recipe, String key, Consumer<JsonObject> callback) {
|
||||
|
|
|
@ -50,7 +50,7 @@ public class AlmostEMI implements EmiPlugin {
|
|||
int size = RecipeIndicator.RENDER_SIZE - 1;
|
||||
|
||||
widgets.addDrawable(0, 0, 0, 0, (guiGraphics, mX, mY, delta) ->
|
||||
RecipeIndicator.renderIndicator(guiGraphics, pX, pY, size));
|
||||
RecipeIndicator.renderIndicator(guiGraphics, pX, pY, size));
|
||||
widgets.addTooltipText(RecipeIndicator.constructTooltip(link), pX, pY, size, size);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,15 +68,15 @@ public class AlmostREI implements REIClientPlugin {
|
|||
|
||||
@SuppressWarnings("OverrideOnly")
|
||||
private record IndicatorExtension(@Nullable ButtonArea plusButtonArea)
|
||||
implements CategoryExtensionProvider<Display> {
|
||||
implements CategoryExtensionProvider<Display> {
|
||||
|
||||
@Override
|
||||
public DisplayCategoryView<Display> provide(Display display, DisplayCategory<Display> category, DisplayCategoryView<Display> lastView) {
|
||||
return display
|
||||
.getDisplayLocation()
|
||||
.map(CRTLookup::getLink)
|
||||
.map(link -> (DisplayCategoryView<Display>) new IndicatorView(lastView, link))
|
||||
.orElse(lastView);
|
||||
.getDisplayLocation()
|
||||
.map(CRTLookup::getLink)
|
||||
.map(link -> (DisplayCategoryView<Display>) new IndicatorView(lastView, link))
|
||||
.orElse(lastView);
|
||||
}
|
||||
|
||||
private final class IndicatorView implements DisplayCategoryView<Display> {
|
||||
|
@ -113,7 +113,7 @@ public class AlmostREI implements REIClientPlugin {
|
|||
|
||||
var widgets = lastView.setupDisplay(display, bounds);
|
||||
widgets.add(Widgets.createDrawableWidget(
|
||||
(guiGraphics, mX, mY, delta) -> RecipeIndicator.renderIndicator(guiGraphics, pX, pY, size)
|
||||
(guiGraphics, mX, mY, delta) -> RecipeIndicator.renderIndicator(guiGraphics, pX, pY, size)
|
||||
));
|
||||
|
||||
var tooltipArea = new Rectangle(pX, pY, size, size);
|
||||
|
|
|
@ -18,12 +18,12 @@ public final class CRTLookup {
|
|||
}
|
||||
|
||||
return Minecraft.getInstance().level
|
||||
.getRecipeManager()
|
||||
.byKey(link)
|
||||
.map(RecipeHolder::value)
|
||||
.filter(ClientRecipeTracker.class::isInstance)
|
||||
.map(ClientRecipeTracker.class::cast)
|
||||
.map(tracker -> tracker.getLink(recipeId))
|
||||
.orElse(null);
|
||||
.getRecipeManager()
|
||||
.byKey(link)
|
||||
.map(RecipeHolder::value)
|
||||
.filter(ClientRecipeTracker.class::isInstance)
|
||||
.map(ClientRecipeTracker.class::cast)
|
||||
.map(tracker -> tracker.getLink(recipeId))
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.util.Map;
|
|||
* Each tracker will hold one namespace with a list of recipes that were unified for it.
|
||||
*/
|
||||
public record ClientRecipeTracker(String namespace, Map<ResourceLocation, ClientRecipeLink> recipes)
|
||||
implements Recipe<RecipeInput> {
|
||||
implements Recipe<RecipeInput> {
|
||||
|
||||
public static final ResourceLocation ID = Utils.getRL("client_recipe_tracker");
|
||||
public static final String RECIPES = "recipes";
|
||||
|
@ -128,11 +128,11 @@ public record ClientRecipeTracker(String namespace, Map<ResourceLocation, Client
|
|||
* </pre>
|
||||
*/
|
||||
public static final MapCodec<ClientRecipeTracker> CODEC = RecordCodecBuilder.mapCodec(instance -> instance
|
||||
.group(
|
||||
Codec.STRING.fieldOf("namespace").forGetter(ClientRecipeTracker::namespace),
|
||||
Codec.list(Codec.STRING).fieldOf("recipes").forGetter(ClientRecipeTracker::getLinkStrings)
|
||||
)
|
||||
.apply(instance, Serializer::of));
|
||||
.group(
|
||||
Codec.STRING.fieldOf("namespace").forGetter(ClientRecipeTracker::namespace),
|
||||
Codec.list(Codec.STRING).fieldOf("recipes").forGetter(ClientRecipeTracker::getLinkStrings)
|
||||
)
|
||||
.apply(instance, Serializer::of));
|
||||
|
||||
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, ClientRecipeTracker> STREAM_CODEC = new StreamCodec<>() {
|
||||
|
@ -172,8 +172,8 @@ public record ClientRecipeTracker(String namespace, Map<ResourceLocation, Client
|
|||
buffer.writeUtf(recipe.namespace);
|
||||
for (ClientRecipeLink clientRecipeLink : recipe.recipes.values()) {
|
||||
String raw = createRaw(clientRecipeLink.isUnified(),
|
||||
clientRecipeLink.isDuplicate(),
|
||||
clientRecipeLink.id().getPath());
|
||||
clientRecipeLink.isDuplicate(),
|
||||
clientRecipeLink.id().getPath());
|
||||
buffer.writeUtf(raw);
|
||||
}
|
||||
}
|
||||
|
@ -213,9 +213,9 @@ public record ClientRecipeTracker(String namespace, Map<ResourceLocation, Client
|
|||
boolean isUnified = (flag & UNIFIED_FLAG) != 0;
|
||||
boolean isDuplicate = (flag & DUPLICATE_FLAG) != 0;
|
||||
return new ClientRecipeLink(
|
||||
ResourceLocation.fromNamespaceAndPath(namespace, split[1]),
|
||||
isUnified,
|
||||
isDuplicate
|
||||
ResourceLocation.fromNamespaceAndPath(namespace, split[1]),
|
||||
isUnified,
|
||||
isDuplicate
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,11 +69,11 @@ public final class ItemHider {
|
|||
if (toHide.isEmpty()) continue;
|
||||
|
||||
AlmostUnifiedCommon.LOGGER.info(
|
||||
"[AutoHiding] Hiding {}/{} items for tag '#{}' -> {}",
|
||||
toHide.size(),
|
||||
entriesByTag.size(),
|
||||
tag.location(),
|
||||
toHideIds
|
||||
"[AutoHiding] Hiding {}/{} items for tag '#{}' -> {}",
|
||||
toHide.size(),
|
||||
entriesByTag.size(),
|
||||
tag.location(),
|
||||
toHideIds
|
||||
);
|
||||
|
||||
hidings.addAll(toHide);
|
||||
|
|
|
@ -32,22 +32,22 @@ final class RecipeIndicator {
|
|||
|
||||
static List<Component> constructTooltip(ClientRecipeLink link) {
|
||||
var unified = Component.translatable(Utils.prefix("unified")).append(": ")
|
||||
.withStyle(c -> c.withColor(ChatFormatting.AQUA));
|
||||
.withStyle(c -> c.withColor(ChatFormatting.AQUA));
|
||||
unified.append(Component.translatable(Utils.prefix(link.isUnified() ? "yes" : "no"))
|
||||
.withStyle(c -> c.withColor(ChatFormatting.WHITE)));
|
||||
.withStyle(c -> c.withColor(ChatFormatting.WHITE)));
|
||||
|
||||
var duplicate = Component.translatable(Utils.prefix("duplicate")).append(": ")
|
||||
.withStyle(c -> c.withColor(ChatFormatting.AQUA));
|
||||
.withStyle(c -> c.withColor(ChatFormatting.AQUA));
|
||||
duplicate.append(Component.translatable(Utils.prefix(link.isDuplicate() ? "yes" : "no"))
|
||||
.withStyle(c -> c.withColor(ChatFormatting.WHITE)));
|
||||
.withStyle(c -> c.withColor(ChatFormatting.WHITE)));
|
||||
|
||||
return List.of(
|
||||
Component.translatable(Utils.prefix("description")).withStyle(c -> c.withColor(ChatFormatting.GOLD)),
|
||||
Component.literal(" "),
|
||||
unified,
|
||||
duplicate,
|
||||
Component.literal(" "),
|
||||
Component.translatable(Utils.prefix("warning")).withStyle(c -> c.withColor(ChatFormatting.RED))
|
||||
Component.translatable(Utils.prefix("description")).withStyle(c -> c.withColor(ChatFormatting.GOLD)),
|
||||
Component.literal(" "),
|
||||
unified,
|
||||
duplicate,
|
||||
Component.literal(" "),
|
||||
Component.translatable(Utils.prefix("warning")).withStyle(c -> c.withColor(ChatFormatting.RED))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -58,15 +58,15 @@ final class RecipeIndicator {
|
|||
if (screen == null) return;
|
||||
|
||||
var tooltip = constructTooltip(link).stream()
|
||||
.map(c -> font.split(c, screen.width - (int) mouseX - 200))
|
||||
.flatMap(List::stream)
|
||||
.toList();
|
||||
.map(c -> font.split(c, screen.width - (int) mouseX - 200))
|
||||
.flatMap(List::stream)
|
||||
.toList();
|
||||
|
||||
guiGraphics.renderTooltip(
|
||||
font,
|
||||
tooltip,
|
||||
(int) mouseX,
|
||||
(int) mouseY
|
||||
font,
|
||||
tooltip,
|
||||
(int) mouseX,
|
||||
(int) mouseY
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,10 +74,10 @@ public class Config {
|
|||
String jsonString = gson.toJson(json);
|
||||
try {
|
||||
Files.writeString(
|
||||
path,
|
||||
jsonString,
|
||||
StandardOpenOption.CREATE,
|
||||
StandardOpenOption.WRITE
|
||||
path,
|
||||
jsonString,
|
||||
StandardOpenOption.CREATE,
|
||||
StandardOpenOption.WRITE
|
||||
);
|
||||
} catch (IOException e) {
|
||||
AlmostUnifiedCommon.LOGGER.error("Failed to save config '{}'.", config.getName(), e);
|
||||
|
@ -132,12 +132,12 @@ public class Config {
|
|||
|
||||
Set<Pattern> deserializePatterns(JsonObject json, String configKey, List<String> defaultValue) {
|
||||
return safeGet(
|
||||
() -> JsonUtils
|
||||
.toList(json.getAsJsonArray(configKey))
|
||||
.stream()
|
||||
.map(Pattern::compile)
|
||||
.collect(Collectors.toSet()),
|
||||
new HashSet<>(defaultValue.stream().map(Pattern::compile).toList())
|
||||
() -> JsonUtils
|
||||
.toList(json.getAsJsonArray(configKey))
|
||||
.stream()
|
||||
.map(Pattern::compile)
|
||||
.collect(Collectors.toSet()),
|
||||
new HashSet<>(defaultValue.stream().map(Pattern::compile).toList())
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,11 +55,11 @@ public final class DebugConfig extends Config {
|
|||
@Override
|
||||
public DebugConfig handleDeserialization(JsonObject json) {
|
||||
return new DebugConfig(
|
||||
safeGet(() -> json.get(DUMP_DUPLICATES).getAsBoolean(), false),
|
||||
safeGet(() -> json.get(DUMP_OVERVIEW).getAsBoolean(), false),
|
||||
safeGet(() -> json.get(DUMP_RECIPES).getAsBoolean(), false),
|
||||
safeGet(() -> json.get(DUMP_TAGS).getAsBoolean(), false),
|
||||
safeGet(() -> json.get(DUMP_UNIFICATION).getAsBoolean(), false)
|
||||
safeGet(() -> json.get(DUMP_DUPLICATES).getAsBoolean(), false),
|
||||
safeGet(() -> json.get(DUMP_OVERVIEW).getAsBoolean(), false),
|
||||
safeGet(() -> json.get(DUMP_RECIPES).getAsBoolean(), false),
|
||||
safeGet(() -> json.get(DUMP_TAGS).getAsBoolean(), false),
|
||||
safeGet(() -> json.get(DUMP_UNIFICATION).getAsBoolean(), false)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,94 +18,94 @@ public final class Defaults {
|
|||
private Defaults() {}
|
||||
|
||||
public static final List<String> STONE_VARIANTS = List.of(
|
||||
"stone",
|
||||
"andesite",
|
||||
"deepslate",
|
||||
"diorite",
|
||||
"granite",
|
||||
"nether",
|
||||
"end"
|
||||
"stone",
|
||||
"andesite",
|
||||
"deepslate",
|
||||
"diorite",
|
||||
"granite",
|
||||
"nether",
|
||||
"end"
|
||||
);
|
||||
|
||||
public static final Map<String, Collection<String>> PLACEHOLDERS = Util.make(() -> {
|
||||
ImmutableMap.Builder<String, Collection<String>> builder = ImmutableMap.builder();
|
||||
|
||||
builder.put("material", List.of(
|
||||
"aeternium",
|
||||
"aluminum",
|
||||
"amber",
|
||||
"apatite",
|
||||
"bitumen",
|
||||
"brass",
|
||||
"bronze",
|
||||
"chrome",
|
||||
"cinnabar",
|
||||
"cobalt",
|
||||
"constantan",
|
||||
"copper",
|
||||
"diamond",
|
||||
"electrum",
|
||||
"elementium",
|
||||
"emerald",
|
||||
"enderium",
|
||||
"fluorite",
|
||||
"gold",
|
||||
"graphite",
|
||||
"invar",
|
||||
"iridium",
|
||||
"iron",
|
||||
"lapis",
|
||||
"lead",
|
||||
"lumium",
|
||||
"mithril",
|
||||
"netherite",
|
||||
"nickel",
|
||||
"obsidian",
|
||||
"osmium",
|
||||
"peridot",
|
||||
"platinum",
|
||||
"potassium_nitrate",
|
||||
"ruby",
|
||||
"sapphire",
|
||||
"signalum",
|
||||
"silver",
|
||||
"steel",
|
||||
"sulfur",
|
||||
"tin",
|
||||
"tungsten",
|
||||
"uranium",
|
||||
"zinc"
|
||||
"aeternium",
|
||||
"aluminum",
|
||||
"amber",
|
||||
"apatite",
|
||||
"bitumen",
|
||||
"brass",
|
||||
"bronze",
|
||||
"chrome",
|
||||
"cinnabar",
|
||||
"cobalt",
|
||||
"constantan",
|
||||
"copper",
|
||||
"diamond",
|
||||
"electrum",
|
||||
"elementium",
|
||||
"emerald",
|
||||
"enderium",
|
||||
"fluorite",
|
||||
"gold",
|
||||
"graphite",
|
||||
"invar",
|
||||
"iridium",
|
||||
"iron",
|
||||
"lapis",
|
||||
"lead",
|
||||
"lumium",
|
||||
"mithril",
|
||||
"netherite",
|
||||
"nickel",
|
||||
"obsidian",
|
||||
"osmium",
|
||||
"peridot",
|
||||
"platinum",
|
||||
"potassium_nitrate",
|
||||
"ruby",
|
||||
"sapphire",
|
||||
"signalum",
|
||||
"silver",
|
||||
"steel",
|
||||
"sulfur",
|
||||
"tin",
|
||||
"tungsten",
|
||||
"uranium",
|
||||
"zinc"
|
||||
));
|
||||
|
||||
return builder.build();
|
||||
});
|
||||
|
||||
public static final List<String> MOD_PRIORITIES = Stream.of(
|
||||
"minecraft",
|
||||
"kubejs",
|
||||
"crafttweaker",
|
||||
"create",
|
||||
"thermal",
|
||||
"immersiveengineering",
|
||||
"mekanism",
|
||||
"techreborn",
|
||||
"modern_industrialization",
|
||||
"indrev"
|
||||
"minecraft",
|
||||
"kubejs",
|
||||
"crafttweaker",
|
||||
"create",
|
||||
"thermal",
|
||||
"immersiveengineering",
|
||||
"mekanism",
|
||||
"techreborn",
|
||||
"modern_industrialization",
|
||||
"indrev"
|
||||
).filter(AlmostUnifiedPlatform.INSTANCE::isModLoaded).toList();
|
||||
|
||||
public static final List<String> TAGS = List.of(
|
||||
"c:dusts/{material}",
|
||||
"c:gears/{material}",
|
||||
"c:gems/{material}",
|
||||
"c:ingots/{material}",
|
||||
"c:nuggets/{material}",
|
||||
"c:ores/{material}",
|
||||
"c:plates/{material}",
|
||||
"c:raw_materials/{material}",
|
||||
"c:rods/{material}",
|
||||
"c:storage_blocks/raw_{material}",
|
||||
"c:storage_blocks/{material}",
|
||||
"c:wires/{material}"
|
||||
"c:dusts/{material}",
|
||||
"c:gears/{material}",
|
||||
"c:gems/{material}",
|
||||
"c:ingots/{material}",
|
||||
"c:nuggets/{material}",
|
||||
"c:ores/{material}",
|
||||
"c:plates/{material}",
|
||||
"c:raw_materials/{material}",
|
||||
"c:rods/{material}",
|
||||
"c:storage_blocks/raw_{material}",
|
||||
"c:storage_blocks/{material}",
|
||||
"c:wires/{material}"
|
||||
);
|
||||
|
||||
public static final List<String> IGNORED_RECIPE_TYPES = List.of("cucumber:shaped_tag");
|
||||
|
|
|
@ -90,25 +90,25 @@ public final class DuplicateConfig extends Config {
|
|||
public DuplicateConfig handleDeserialization(JsonObject json) {
|
||||
var platform = AlmostUnifiedPlatform.INSTANCE.getPlatform();
|
||||
Set<Pattern> ignoreRecipeTypes = deserializePatterns(
|
||||
json,
|
||||
IGNORED_RECIPE_TYPES,
|
||||
Defaults.IGNORED_RECIPE_TYPES
|
||||
json,
|
||||
IGNORED_RECIPE_TYPES,
|
||||
Defaults.IGNORED_RECIPE_TYPES
|
||||
);
|
||||
Set<Pattern> ignoreRecipeIds = deserializePatterns(json, IGNORED_RECIPE_IDS, List.of());
|
||||
|
||||
JsonCompare.CompareSettings defaultRules = safeGet(() -> createCompareSet(json.getAsJsonObject(
|
||||
DEFAULT_DUPLICATE_RULES)),
|
||||
Defaults.getDefaultDuplicateRules(platform));
|
||||
DEFAULT_DUPLICATE_RULES)),
|
||||
Defaults.getDefaultDuplicateRules(platform));
|
||||
LinkedHashMap<ResourceLocation, JsonCompare.CompareSettings> overrideRules = safeGet(() -> getOverrideRules(
|
||||
json), Defaults.getDefaultDuplicateOverrides(platform));
|
||||
json), Defaults.getDefaultDuplicateOverrides(platform));
|
||||
boolean compareAll = safeGet(() -> json.get(COMPARE_ALL).getAsBoolean(), false);
|
||||
|
||||
return new DuplicateConfig(
|
||||
defaultRules,
|
||||
overrideRules,
|
||||
ignoreRecipeTypes,
|
||||
ignoreRecipeIds,
|
||||
compareAll
|
||||
defaultRules,
|
||||
overrideRules,
|
||||
ignoreRecipeTypes,
|
||||
ignoreRecipeIds,
|
||||
compareAll
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -116,13 +116,13 @@ public final class DuplicateConfig extends Config {
|
|||
// https://bugs.openjdk.org/browse/JDK-8324860
|
||||
private LinkedHashMap<ResourceLocation, JsonCompare.CompareSettings> getOverrideRules(JsonObject json) {
|
||||
return json
|
||||
.getAsJsonObject(OVERRIDE_DUPLICATE_RULES)
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(entry -> ResourceLocation.parse(entry.getKey()),
|
||||
entry -> createCompareSet(entry.getValue().getAsJsonObject()),
|
||||
(a, b) -> b,
|
||||
LinkedHashMap::new));
|
||||
.getAsJsonObject(OVERRIDE_DUPLICATE_RULES)
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(entry -> ResourceLocation.parse(entry.getKey()),
|
||||
entry -> createCompareSet(entry.getValue().getAsJsonObject()),
|
||||
(a, b) -> b,
|
||||
LinkedHashMap::new));
|
||||
}
|
||||
|
||||
private JsonCompare.CompareSettings createCompareSet(JsonObject rules) {
|
||||
|
@ -140,7 +140,7 @@ public final class DuplicateConfig extends Config {
|
|||
json.add(DEFAULT_DUPLICATE_RULES, config.defaultRules.serialize());
|
||||
JsonObject overrides = new JsonObject();
|
||||
config.overrideRules.forEach((rl, compareSettings) ->
|
||||
overrides.add(rl.toString(), compareSettings.serialize()));
|
||||
overrides.add(rl.toString(), compareSettings.serialize()));
|
||||
json.add(OVERRIDE_DUPLICATE_RULES, overrides);
|
||||
json.addProperty(COMPARE_ALL, false);
|
||||
|
||||
|
|
|
@ -46,9 +46,9 @@ public final class TagConfig extends Config {
|
|||
|
||||
public TagInheritance getTagInheritance() {
|
||||
return new TagInheritance(itemTagInheritanceMode,
|
||||
itemTagInheritance,
|
||||
blockTagInheritanceMode,
|
||||
blockTagInheritance);
|
||||
itemTagInheritance,
|
||||
blockTagInheritanceMode,
|
||||
blockTagInheritance);
|
||||
}
|
||||
|
||||
public Map<ResourceLocation, Set<ResourceLocation>> getCustomTags() {
|
||||
|
@ -78,39 +78,39 @@ public final class TagConfig extends Config {
|
|||
@Override
|
||||
public TagConfig handleDeserialization(JsonObject json) {
|
||||
Map<ResourceLocation, Set<ResourceLocation>> customTags = safeGet(() -> JsonUtils.deserializeMapSet(json,
|
||||
CUSTOM_TAGS,
|
||||
e -> ResourceLocation.parse(e.getKey()),
|
||||
ResourceLocation::parse), new HashMap<>());
|
||||
CUSTOM_TAGS,
|
||||
e -> ResourceLocation.parse(e.getKey()),
|
||||
ResourceLocation::parse), new HashMap<>());
|
||||
|
||||
Map<ResourceLocation, Set<ResourceLocation>> tagSubstitutions = safeGet(() -> JsonUtils.deserializeMapSet(
|
||||
json,
|
||||
TAG_SUBSTITUTIONS,
|
||||
e -> ResourceLocation.parse(e.getKey()),
|
||||
ResourceLocation::parse), new HashMap<>());
|
||||
json,
|
||||
TAG_SUBSTITUTIONS,
|
||||
e -> ResourceLocation.parse(e.getKey()),
|
||||
ResourceLocation::parse), new HashMap<>());
|
||||
|
||||
TagInheritance.Mode itemTagInheritanceMode = deserializeTagInheritanceMode(json,
|
||||
ITEM_TAG_INHERITANCE_MODE);
|
||||
ITEM_TAG_INHERITANCE_MODE);
|
||||
Map<TagKey<Item>, Set<Pattern>> itemTagInheritance = deserializePatternsForLocations(Registries.ITEM,
|
||||
json,
|
||||
ITEM_TAG_INHERITANCE);
|
||||
json,
|
||||
ITEM_TAG_INHERITANCE);
|
||||
TagInheritance.Mode blockTagInheritanceMode = deserializeTagInheritanceMode(json,
|
||||
BLOCK_TAG_INHERITANCE_MODE);
|
||||
BLOCK_TAG_INHERITANCE_MODE);
|
||||
Map<TagKey<Block>, Set<Pattern>> blockTagInheritance = deserializePatternsForLocations(Registries.BLOCK,
|
||||
json,
|
||||
BLOCK_TAG_INHERITANCE);
|
||||
json,
|
||||
BLOCK_TAG_INHERITANCE);
|
||||
|
||||
boolean emiStrictHiding = AlmostUnifiedPlatform.INSTANCE.isModLoaded(ModConstants.EMI) ?
|
||||
safeGet(() -> json.get(EMI_STRICT_HIDING).getAsBoolean(), true) :
|
||||
false;
|
||||
|
||||
return new TagConfig(
|
||||
customTags,
|
||||
tagSubstitutions,
|
||||
itemTagInheritanceMode,
|
||||
itemTagInheritance,
|
||||
blockTagInheritanceMode,
|
||||
blockTagInheritance,
|
||||
emiStrictHiding
|
||||
customTags,
|
||||
tagSubstitutions,
|
||||
itemTagInheritanceMode,
|
||||
itemTagInheritance,
|
||||
blockTagInheritanceMode,
|
||||
blockTagInheritance,
|
||||
emiStrictHiding
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -121,21 +121,21 @@ public final class TagConfig extends Config {
|
|||
JsonObject customTags = new JsonObject();
|
||||
config.customTags.forEach((parent, child) -> {
|
||||
customTags.add(parent.toString(),
|
||||
JsonUtils.toArray(child.stream().map(ResourceLocation::toString).toList()));
|
||||
JsonUtils.toArray(child.stream().map(ResourceLocation::toString).toList()));
|
||||
});
|
||||
json.add(CUSTOM_TAGS, customTags);
|
||||
|
||||
JsonObject tagSubstitutions = new JsonObject();
|
||||
config.tagSubstitutions.forEach((parent, child) -> {
|
||||
tagSubstitutions.add(parent.toString(),
|
||||
JsonUtils.toArray(child.stream().map(ResourceLocation::toString).toList()));
|
||||
JsonUtils.toArray(child.stream().map(ResourceLocation::toString).toList()));
|
||||
});
|
||||
json.add(TAG_SUBSTITUTIONS, tagSubstitutions);
|
||||
|
||||
JsonObject itemTagInheritance = new JsonObject();
|
||||
config.itemTagInheritance.forEach((tag, patterns) -> {
|
||||
itemTagInheritance.add(tag.toString(),
|
||||
JsonUtils.toArray(patterns.stream().map(Pattern::toString).toList()));
|
||||
JsonUtils.toArray(patterns.stream().map(Pattern::toString).toList()));
|
||||
});
|
||||
json.add(ITEM_TAG_INHERITANCE_MODE, new JsonPrimitive(config.itemTagInheritanceMode.toString()));
|
||||
json.add(ITEM_TAG_INHERITANCE, itemTagInheritance);
|
||||
|
@ -143,7 +143,7 @@ public final class TagConfig extends Config {
|
|||
JsonObject blockTagInheritance = new JsonObject();
|
||||
config.blockTagInheritance.forEach((tag, patterns) -> {
|
||||
blockTagInheritance.add(tag.toString(),
|
||||
JsonUtils.toArray(patterns.stream().map(Pattern::toString).toList()));
|
||||
JsonUtils.toArray(patterns.stream().map(Pattern::toString).toList()));
|
||||
});
|
||||
json.add(BLOCK_TAG_INHERITANCE_MODE, new JsonPrimitive(config.blockTagInheritanceMode.toString()));
|
||||
json.add(BLOCK_TAG_INHERITANCE, blockTagInheritance);
|
||||
|
@ -172,22 +172,22 @@ public final class TagConfig extends Config {
|
|||
*/
|
||||
private <T> Map<TagKey<T>, Set<Pattern>> unsafeDeserializePatternsForLocations(ResourceKey<Registry<T>> registry, JsonObject rawConfigJson, String baseKey) {
|
||||
return JsonUtils.deserializeMapSet(rawConfigJson,
|
||||
baseKey,
|
||||
e -> TagKey.create(registry, ResourceLocation.parse(e.getKey())),
|
||||
Pattern::compile);
|
||||
baseKey,
|
||||
e -> TagKey.create(registry, ResourceLocation.parse(e.getKey())),
|
||||
Pattern::compile);
|
||||
}
|
||||
|
||||
private <T> Map<TagKey<T>, Set<Pattern>> deserializePatternsForLocations(ResourceKey<Registry<T>> registry, JsonObject rawConfigJson, String baseKey) {
|
||||
return safeGet(() -> unsafeDeserializePatternsForLocations(registry, rawConfigJson, baseKey),
|
||||
new HashMap<>());
|
||||
new HashMap<>());
|
||||
}
|
||||
|
||||
|
||||
private TagInheritance.Mode deserializeTagInheritanceMode(JsonObject json, String key) {
|
||||
return safeGet(() -> TagInheritance.Mode.valueOf(json
|
||||
.getAsJsonPrimitive(key)
|
||||
.getAsString()
|
||||
.toUpperCase()), TagInheritance.Mode.ALLOW);
|
||||
.getAsJsonPrimitive(key)
|
||||
.getAsString()
|
||||
.toUpperCase()), TagInheritance.Mode.ALLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,16 +119,16 @@ public final class UnificationConfig extends Config {
|
|||
|
||||
private static void logMissingPriorityMods(Collection<UnificationConfig> unificationConfigs) {
|
||||
Set<String> mods = unificationConfigs
|
||||
.stream()
|
||||
.map(UnificationConfig::getModPriorities)
|
||||
.flatMap(ModPriorities::stream)
|
||||
.filter(m -> !AlmostUnifiedPlatform.INSTANCE.isModLoaded(m))
|
||||
.collect(Collectors.toSet());
|
||||
.stream()
|
||||
.map(UnificationConfig::getModPriorities)
|
||||
.flatMap(ModPriorities::stream)
|
||||
.filter(m -> !AlmostUnifiedPlatform.INSTANCE.isModLoaded(m))
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
if (mods.isEmpty()) return;
|
||||
AlmostUnifiedCommon.LOGGER.warn(
|
||||
"The following mods are used in unification settings, but are not loaded: {}",
|
||||
mods
|
||||
"The following mods are used in unification settings, but are not loaded: {}",
|
||||
mods
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -255,65 +255,65 @@ public final class UnificationConfig extends Config {
|
|||
@Override
|
||||
public UnificationConfig handleDeserialization(JsonObject json) {
|
||||
List<String> modPriorities = safeGet(
|
||||
() -> JsonUtils.toList(json.getAsJsonArray(MOD_PRIORITIES)),
|
||||
Defaults.MOD_PRIORITIES
|
||||
() -> JsonUtils.toList(json.getAsJsonArray(MOD_PRIORITIES)),
|
||||
Defaults.MOD_PRIORITIES
|
||||
);
|
||||
Map<TagKey<Item>, String> priorityOverrides = safeGet(
|
||||
() -> JsonUtils.deserializeMap(
|
||||
json,
|
||||
PRIORITY_OVERRIDES,
|
||||
e -> TagKey.create(Registries.ITEM, ResourceLocation.parse(e.getKey())),
|
||||
e -> e.getValue().getAsString()
|
||||
),
|
||||
new HashMap<>()
|
||||
() -> JsonUtils.deserializeMap(
|
||||
json,
|
||||
PRIORITY_OVERRIDES,
|
||||
e -> TagKey.create(Registries.ITEM, ResourceLocation.parse(e.getKey())),
|
||||
e -> e.getValue().getAsString()
|
||||
),
|
||||
new HashMap<>()
|
||||
);
|
||||
|
||||
List<String> stoneVariants = safeGet(
|
||||
() -> JsonUtils.toList(json.getAsJsonArray(STONE_VARIANTS)),
|
||||
Defaults.STONE_VARIANTS
|
||||
() -> JsonUtils.toList(json.getAsJsonArray(STONE_VARIANTS)),
|
||||
Defaults.STONE_VARIANTS
|
||||
);
|
||||
|
||||
List<String> tags = safeGet(() -> JsonUtils.toList(json.getAsJsonArray(TAGS)), Defaults.TAGS);
|
||||
Set<TagKey<Item>> ignoredTags = safeGet(
|
||||
() -> JsonUtils
|
||||
.toList(json.getAsJsonArray(IGNORED_TAGS))
|
||||
.stream()
|
||||
.map(s -> TagKey.create(Registries.ITEM, ResourceLocation.parse(s)))
|
||||
.collect(Collectors.toSet()),
|
||||
new HashSet<>()
|
||||
() -> JsonUtils
|
||||
.toList(json.getAsJsonArray(IGNORED_TAGS))
|
||||
.stream()
|
||||
.map(s -> TagKey.create(Registries.ITEM, ResourceLocation.parse(s)))
|
||||
.collect(Collectors.toSet()),
|
||||
new HashSet<>()
|
||||
);
|
||||
Set<Pattern> ignoredItems = deserializePatterns(json, IGNORED_ITEMS, List.of());
|
||||
Set<Pattern> ignoredRecipeTypes = deserializePatterns(
|
||||
json,
|
||||
IGNORED_RECIPE_TYPES,
|
||||
Defaults.IGNORED_RECIPE_TYPES
|
||||
json,
|
||||
IGNORED_RECIPE_TYPES,
|
||||
Defaults.IGNORED_RECIPE_TYPES
|
||||
);
|
||||
Set<Pattern> ignoredRecipeIds = deserializePatterns(json, IGNORED_RECIPES_IDS, List.of());
|
||||
|
||||
boolean recipeViewerHiding = safeGet(
|
||||
() -> json.getAsJsonPrimitive(RECIPE_VIEWER_HIDING).getAsBoolean(),
|
||||
true
|
||||
() -> json.getAsJsonPrimitive(RECIPE_VIEWER_HIDING).getAsBoolean(),
|
||||
true
|
||||
);
|
||||
|
||||
boolean lootUnification = safeGet(
|
||||
() -> json.getAsJsonPrimitive(LOOT_UNIFICATION).getAsBoolean(),
|
||||
false
|
||||
() -> json.getAsJsonPrimitive(LOOT_UNIFICATION).getAsBoolean(),
|
||||
false
|
||||
);
|
||||
Set<Pattern> ignoredLootTables = deserializePatterns(json, IGNORED_LOOT_TABLES, List.of());
|
||||
|
||||
return new UnificationConfig(
|
||||
name,
|
||||
modPriorities,
|
||||
priorityOverrides,
|
||||
stoneVariants,
|
||||
tags,
|
||||
ignoredTags,
|
||||
ignoredItems,
|
||||
ignoredRecipeTypes,
|
||||
ignoredRecipeIds,
|
||||
recipeViewerHiding,
|
||||
lootUnification,
|
||||
ignoredLootTables
|
||||
name,
|
||||
modPriorities,
|
||||
priorityOverrides,
|
||||
stoneVariants,
|
||||
tags,
|
||||
ignoredTags,
|
||||
ignoredItems,
|
||||
ignoredRecipeTypes,
|
||||
ignoredRecipeIds,
|
||||
recipeViewerHiding,
|
||||
lootUnification,
|
||||
ignoredLootTables
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ public final class UnificationConfig extends Config {
|
|||
json.add(MOD_PRIORITIES, JsonUtils.toArray(config.modPriorities));
|
||||
JsonObject priorityOverrides = new JsonObject();
|
||||
config.priorityOverrides.forEach(
|
||||
(tag, mod) -> priorityOverrides.addProperty(tag.location().toString(), mod)
|
||||
(tag, mod) -> priorityOverrides.addProperty(tag.location().toString(), mod)
|
||||
);
|
||||
json.add(PRIORITY_OVERRIDES, priorityOverrides);
|
||||
|
||||
|
@ -332,12 +332,12 @@ public final class UnificationConfig extends Config {
|
|||
|
||||
json.add(TAGS, JsonUtils.toArray(config.tags));
|
||||
json.add(
|
||||
IGNORED_TAGS,
|
||||
JsonUtils.toArray(config.ignoredTags
|
||||
.stream()
|
||||
.map(TagKey::location)
|
||||
.map(ResourceLocation::toString)
|
||||
.toList())
|
||||
IGNORED_TAGS,
|
||||
JsonUtils.toArray(config.ignoredTags
|
||||
.stream()
|
||||
.map(TagKey::location)
|
||||
.map(ResourceLocation::toString)
|
||||
.toList())
|
||||
);
|
||||
serializePatterns(json, IGNORED_ITEMS, config.ignoredItems);
|
||||
serializePatterns(json, IGNORED_RECIPE_TYPES, config.ignoredRecipeTypes);
|
||||
|
|
|
@ -50,11 +50,11 @@ public class AlmostUnifiedImpl implements AlmostUnified {
|
|||
public Collection<Item> getTagEntries(TagKey<Item> tag) {
|
||||
if (!isRuntimeLoaded()) return Set.of();
|
||||
return getRuntimeOrThrow()
|
||||
.getUnificationLookup()
|
||||
.getTagEntries(tag)
|
||||
.stream()
|
||||
.map(UnificationEntry::value)
|
||||
.collect(Collectors.toSet());
|
||||
.getUnificationLookup()
|
||||
.getTagEntries(tag)
|
||||
.stream()
|
||||
.map(UnificationEntry::value)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
|
|
@ -63,26 +63,26 @@ public final class AlmostUnifiedRuntimeImpl implements AlmostUnifiedRuntime {
|
|||
|
||||
TagReloadHandler.applyCustomTags(tagConfig.getCustomTags(), itemTags);
|
||||
TagSubstitutionsImpl tagSubstitutions = TagSubstitutionsImpl.create(
|
||||
itemTags::has,
|
||||
unificationTags::contains,
|
||||
tagConfig.getTagSubstitutions()
|
||||
itemTags::has,
|
||||
unificationTags::contains,
|
||||
tagConfig.getTagSubstitutions()
|
||||
);
|
||||
tagSubstitutions.apply(itemTags);
|
||||
|
||||
List<UnificationSettings> unificationSettings = createUnificationLookups(
|
||||
itemTags,
|
||||
blockTags,
|
||||
unificationConfigs,
|
||||
tagSubstitutions,
|
||||
tagConfig.getTagInheritance()
|
||||
itemTags,
|
||||
blockTags,
|
||||
unificationConfigs,
|
||||
tagSubstitutions,
|
||||
tagConfig.getTagInheritance()
|
||||
);
|
||||
ItemHider.applyHideTags(itemTags, unificationSettings, tagConfig.isEmiHidingStrict());
|
||||
|
||||
return new AlmostUnifiedRuntimeImpl(
|
||||
unificationSettings,
|
||||
recipeUnifierRegistry,
|
||||
tagSubstitutions,
|
||||
placeholderConfig
|
||||
unificationSettings,
|
||||
recipeUnifierRegistry,
|
||||
tagSubstitutions,
|
||||
placeholderConfig
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -114,10 +114,10 @@ public final class AlmostUnifiedRuntimeImpl implements AlmostUnifiedRuntime {
|
|||
|
||||
if (visitedTags.containsKey(tag)) {
|
||||
AlmostUnifiedCommon.LOGGER.warn(
|
||||
"Tag '{}' from unify config '{}' was already created in unify config '{}'",
|
||||
config.getName(),
|
||||
tag.location(),
|
||||
visitedTags.get(tag));
|
||||
"Tag '{}' from unify config '{}' was already created in unify config '{}'",
|
||||
config.getName(),
|
||||
tag.location(),
|
||||
visitedTags.get(tag));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ public final class AlmostUnifiedRuntimeImpl implements AlmostUnifiedRuntime {
|
|||
|
||||
if (!wrongTags.isEmpty()) {
|
||||
AlmostUnifiedCommon.LOGGER.warn("The following tags are invalid or not in use and will be ignored: {}",
|
||||
wrongTags.stream().map(TagKey::location).collect(Collectors.toList()));
|
||||
wrongTags.stream().map(TagKey::location).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -151,9 +151,9 @@ public final class AlmostUnifiedRuntimeImpl implements AlmostUnifiedRuntime {
|
|||
*/
|
||||
private static List<UnificationSettings> createUnificationLookups(VanillaTagWrapper<Item> itemTags, VanillaTagWrapper<Block> blockTags, Collection<UnificationConfig> unificationConfigs, TagSubstitutionsImpl tagSubstitutions, TagInheritance tagInheritance) {
|
||||
var unificationSettings = UnificationSettingsImpl.create(unificationConfigs,
|
||||
itemTags,
|
||||
blockTags,
|
||||
tagSubstitutions);
|
||||
itemTags,
|
||||
blockTags,
|
||||
tagSubstitutions);
|
||||
|
||||
var needsRebuild = tagInheritance.apply(itemTags, blockTags, unificationSettings);
|
||||
if (needsRebuild) {
|
||||
|
|
|
@ -61,8 +61,8 @@ public final class TagReloadHandler {
|
|||
for (ResourceLocation itemId : itemIds) {
|
||||
if (!BuiltInRegistries.ITEM.containsKey(itemId)) {
|
||||
AlmostUnifiedCommon.LOGGER.warn("[CustomTags] Custom tag '{}' contains invalid item '{}'",
|
||||
tag,
|
||||
itemId);
|
||||
tag,
|
||||
itemId);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -75,8 +75,8 @@ public final class TagReloadHandler {
|
|||
if (!currentHolders.isEmpty()) {
|
||||
if (currentHolders.contains(itemHolder)) {
|
||||
AlmostUnifiedCommon.LOGGER.warn("[CustomTags] Custom tag '{}' already contains item '{}'",
|
||||
tag,
|
||||
itemId);
|
||||
tag,
|
||||
itemId);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -88,11 +88,11 @@ public final class TagReloadHandler {
|
|||
|
||||
if (!changedItemTags.isEmpty()) {
|
||||
changedItemTags.asMap().forEach(
|
||||
(tag, items) -> AlmostUnifiedCommon.LOGGER.info(
|
||||
"[CustomTags] Modified tag '#{}', added {}",
|
||||
tag,
|
||||
items
|
||||
)
|
||||
(tag, items) -> AlmostUnifiedCommon.LOGGER.info(
|
||||
"[CustomTags] Modified tag '#{}', added {}",
|
||||
tag,
|
||||
items
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ public final class ModPrioritiesImpl implements ModPriorities {
|
|||
if (entry != null) return entry;
|
||||
|
||||
AlmostUnifiedCommon.LOGGER.warn(
|
||||
"Priority override mod '{}' for tag '{}' does not contain a valid item. Falling back to default priority.",
|
||||
priorityOverride,
|
||||
tag.location()
|
||||
"Priority override mod '{}' for tag '{}' does not contain a valid item. Falling back to default priority.",
|
||||
priorityOverride,
|
||||
tag.location()
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -72,17 +72,17 @@ public final class StoneVariantsImpl implements StoneVariants {
|
|||
for (var stoneVariantTag : stoneVariantTags) {
|
||||
for (var holder : tags.get(stoneVariantTag)) {
|
||||
ResourceLocation id = holder
|
||||
.unwrapKey()
|
||||
.orElseThrow(() -> new IllegalStateException("Tag is not bound for holder " + holder))
|
||||
.location();
|
||||
.unwrapKey()
|
||||
.orElseThrow(() -> new IllegalStateException("Tag is not bound for holder " + holder))
|
||||
.location();
|
||||
|
||||
var oldTag = idToStoneVariantTag.put(id, stoneVariantTag);
|
||||
if (oldTag != null) {
|
||||
AlmostUnifiedCommon.LOGGER.error(
|
||||
"{} is bound to multiple stone variant tags: {} and {}",
|
||||
id,
|
||||
oldTag,
|
||||
stoneVariantTag
|
||||
"{} is bound to multiple stone variant tags: {} and {}",
|
||||
id,
|
||||
oldTag,
|
||||
stoneVariantTag
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,10 +44,10 @@ public class TagInheritance {
|
|||
var targetBlockHolder = findTargetBlockHolder(blockTags, targetItem);
|
||||
|
||||
var targetItemTags = itemTags
|
||||
.getTags(targetItem)
|
||||
.stream()
|
||||
.map(rl -> TagKey.create(Registries.ITEM, rl))
|
||||
.collect(ImmutableSet.toImmutableSet());
|
||||
.getTags(targetItem)
|
||||
.stream()
|
||||
.map(rl -> TagKey.create(Registries.ITEM, rl))
|
||||
.collect(ImmutableSet.toImmutableSet());
|
||||
|
||||
for (var item : relation.items) {
|
||||
var appliedItemTags = applyItemTags(itemTags, targetItemHolder, targetItemTags, item);
|
||||
|
|
|
@ -52,10 +52,10 @@ public final class TagSubstitutionsImpl implements TagSubstitutions {
|
|||
|
||||
if (!unifyTagFilter.test(substituteTag)) {
|
||||
AlmostUnifiedCommon.LOGGER.warn(
|
||||
"[TagSubstitutions] Substitute tag '#{}' is not configured as a unify tag! Config entry '#{} -> {}' will be ignored.",
|
||||
substituteTag.location(),
|
||||
substituteTag.location(),
|
||||
rawReplacedTags.stream().map(t -> "#" + t).collect(Collectors.joining(", "))
|
||||
"[TagSubstitutions] Substitute tag '#{}' is not configured as a unify tag! Config entry '#{} -> {}' will be ignored.",
|
||||
substituteTag.location(),
|
||||
substituteTag.location(),
|
||||
rawReplacedTags.stream().map(t -> "#" + t).collect(Collectors.joining(", "))
|
||||
);
|
||||
return; // don't check other replaced tags if the substitute tag is invalid
|
||||
}
|
||||
|
@ -76,17 +76,17 @@ public final class TagSubstitutionsImpl implements TagSubstitutions {
|
|||
|
||||
if (!invalidReplacedTags.isEmpty()) {
|
||||
AlmostUnifiedCommon.LOGGER.warn(
|
||||
"[TagSubstitutions] Substitute tag '#{}' contains invalid replaced tags! Affected tags: {}",
|
||||
rawSubstituteTag,
|
||||
invalidReplacedTags.stream().map(t -> "#" + t.location()).collect(Collectors.joining(", "))
|
||||
"[TagSubstitutions] Substitute tag '#{}' contains invalid replaced tags! Affected tags: {}",
|
||||
rawSubstituteTag,
|
||||
invalidReplacedTags.stream().map(t -> "#" + t.location()).collect(Collectors.joining(", "))
|
||||
);
|
||||
}
|
||||
|
||||
if (!unifyReplacedTags.isEmpty()) {
|
||||
AlmostUnifiedCommon.LOGGER.warn(
|
||||
"[TagSubstitutions] Substitute tag '#{}' contains replaced tags that are configured as unify tags! Affected tags: {}",
|
||||
rawSubstituteTag,
|
||||
unifyReplacedTags.stream().map(t -> "#" + t.location()).collect(Collectors.joining(", "))
|
||||
"[TagSubstitutions] Substitute tag '#{}' contains replaced tags that are configured as unify tags! Affected tags: {}",
|
||||
rawSubstituteTag,
|
||||
unifyReplacedTags.stream().map(t -> "#" + t.location()).collect(Collectors.joining(", "))
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -108,16 +108,16 @@ public final class TagSubstitutionsImpl implements TagSubstitutions {
|
|||
for (var replacedTagHolder : replacedTagHolders) {
|
||||
itemTags.add(substituteTag.location(), replacedTagHolder);
|
||||
replacedTagHolder
|
||||
.unwrapKey()
|
||||
.ifPresent(key -> changedTags.put(substituteTag.location(), key.location()));
|
||||
.unwrapKey()
|
||||
.ifPresent(key -> changedTags.put(substituteTag.location(), key.location()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
changedTags.asMap().forEach((tag, entries) -> AlmostUnifiedCommon.LOGGER.info(
|
||||
"[TagSubstitutions] Added items of replaced tags to substitute tag '#{}'. Added items: {}",
|
||||
tag,
|
||||
entries
|
||||
"[TagSubstitutions] Added items of replaced tags to substitute tag '#{}'. Added items: {}",
|
||||
tag,
|
||||
entries
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ public class UnificationEntryImpl<T> implements UnificationEntry<T> {
|
|||
|
||||
public UnificationEntryImpl(Registry<T> registry, T entry) {
|
||||
this.key = registry
|
||||
.getResourceKey(entry)
|
||||
.orElseThrow(() -> new IllegalArgumentException("Entry " + entry + " does not belong to " + registry));
|
||||
.getResourceKey(entry)
|
||||
.orElseThrow(() -> new IllegalArgumentException("Entry " + entry + " does not belong to " + registry));
|
||||
this.registry = registry;
|
||||
this.value = entry;
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ public class UnificationEntryImpl<T> implements UnificationEntry<T> {
|
|||
public T value() {
|
||||
if (value == null) {
|
||||
value = registry
|
||||
.getOptional(key)
|
||||
.orElseThrow(() -> new IllegalStateException("entry " + key + " not found in " + registry));
|
||||
.getOptional(key)
|
||||
.orElseThrow(() -> new IllegalStateException("entry " + key + " not found in " + registry));
|
||||
}
|
||||
|
||||
return value;
|
||||
|
|
|
@ -74,11 +74,11 @@ public final class UnificationLookupImpl implements UnificationLookup {
|
|||
var tagToCheck = substituteTag != null ? substituteTag : tag;
|
||||
|
||||
var items = getTagEntries(tagToCheck)
|
||||
.stream()
|
||||
.filter(entry -> itemFilter.test(entry.id()))
|
||||
// sort by length so clean stone variants come first
|
||||
.sorted(Comparator.comparingInt(value -> value.id().toString().length()))
|
||||
.toList();
|
||||
.stream()
|
||||
.filter(entry -> itemFilter.test(entry.id()))
|
||||
// sort by length so clean stone variants come first
|
||||
.sorted(Comparator.comparingInt(value -> value.id().toString().length()))
|
||||
.toList();
|
||||
|
||||
return items.isEmpty() ? null : modPriorities.findTargetItem(tagToCheck, items);
|
||||
}
|
||||
|
@ -148,11 +148,11 @@ public final class UnificationLookupImpl implements UnificationLookup {
|
|||
});
|
||||
|
||||
return new UnificationLookupImpl(
|
||||
modPriorities,
|
||||
stoneVariants,
|
||||
tagSubstitutions,
|
||||
tagsToEntriesBuilder.build(),
|
||||
idsToEntriesBuilder.build()
|
||||
modPriorities,
|
||||
stoneVariants,
|
||||
tagSubstitutions,
|
||||
tagsToEntriesBuilder.build(),
|
||||
idsToEntriesBuilder.build()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,9 +44,9 @@ public final class UnificationSettingsImpl implements UnificationSettings {
|
|||
|
||||
public static List<UnificationSettings> create(Collection<UnificationConfig> configs, VanillaTagWrapper<Item> itemTags, VanillaTagWrapper<Block> blockTags, TagSubstitutionsImpl tagSubstitutions) {
|
||||
return configs
|
||||
.stream()
|
||||
.map(config -> create(config, itemTags, blockTags, tagSubstitutions))
|
||||
.toList();
|
||||
.stream()
|
||||
.map(config -> create(config, itemTags, blockTags, tagSubstitutions))
|
||||
.toList();
|
||||
}
|
||||
|
||||
public static UnificationSettings create(UnificationConfig config, VanillaTagWrapper<Item> itemTags, VanillaTagWrapper<Block> blockTags, TagSubstitutions tagSubstitutions) {
|
||||
|
@ -65,22 +65,22 @@ public final class UnificationSettingsImpl implements UnificationSettings {
|
|||
|
||||
ModPriorities modPriorities = config.getModPriorities();
|
||||
StoneVariants stoneVariants = StoneVariantsImpl.create(
|
||||
config.getStoneVariants(),
|
||||
itemTags,
|
||||
blockTags
|
||||
config.getStoneVariants(),
|
||||
itemTags,
|
||||
blockTags
|
||||
);
|
||||
|
||||
return new UnificationSettingsImpl(
|
||||
config.getName(),
|
||||
modPriorities,
|
||||
stoneVariants,
|
||||
config::shouldIncludeRecipeType,
|
||||
config::shouldIncludeRecipeId,
|
||||
config.shouldHideVariantItems(),
|
||||
config.shouldUnifyLoot(),
|
||||
config::shouldIncludeLootTable,
|
||||
lookupBuilder.build(modPriorities, stoneVariants, tagSubstitutions),
|
||||
config::clearCaches
|
||||
config.getName(),
|
||||
modPriorities,
|
||||
stoneVariants,
|
||||
config::shouldIncludeRecipeType,
|
||||
config::shouldIncludeRecipeId,
|
||||
config.shouldHideVariantItems(),
|
||||
config.shouldUnifyLoot(),
|
||||
config::shouldIncludeLootTable,
|
||||
lookupBuilder.build(modPriorities, stoneVariants, tagSubstitutions),
|
||||
config::clearCaches
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ public final class LootUnification {
|
|||
var handlers = runtime.getUnificationSettings();
|
||||
|
||||
boolean enableLootUnification = handlers
|
||||
.stream()
|
||||
.anyMatch(UnificationSettings::shouldUnifyLoot);
|
||||
.stream()
|
||||
.anyMatch(UnificationSettings::shouldUnifyLoot);
|
||||
if (!enableLootUnification) {
|
||||
return;
|
||||
}
|
||||
|
@ -31,8 +31,8 @@ public final class LootUnification {
|
|||
var lootTableRegistry = registries.lookupOrThrow(Registries.LOOT_TABLE);
|
||||
|
||||
lootTableRegistry
|
||||
.listElements()
|
||||
.forEach(holder -> unifyLoot(holder.value(), holder.key().location(), handlers));
|
||||
.listElements()
|
||||
.forEach(holder -> unifyLoot(holder.value(), holder.key().location(), handlers));
|
||||
} catch (Exception e) {
|
||||
AlmostUnifiedCommon.LOGGER.error("Failed to unify loot", e);
|
||||
}
|
||||
|
@ -52,9 +52,9 @@ public final class LootUnification {
|
|||
|
||||
if (!modifiedTable.isEmpty()) {
|
||||
AlmostUnifiedCommon.LOGGER.info("Loot table '{}' was unified by: {}",
|
||||
tableId,
|
||||
modifiedTable.stream().map(UnificationSettings::getName).collect(
|
||||
Collectors.joining(", ")));
|
||||
tableId,
|
||||
modifiedTable.stream().map(UnificationSettings::getName).collect(
|
||||
Collectors.joining(", ")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,9 +58,9 @@ public class RecipeTransformer {
|
|||
});
|
||||
|
||||
AlmostUnifiedCommon.LOGGER.info(
|
||||
"Recipe count afterwards: {} (done in {})",
|
||||
recipes.size(),
|
||||
transformationTimer.stop()
|
||||
"Recipe count afterwards: {} (done in {})",
|
||||
recipes.size(),
|
||||
transformationTimer.stop()
|
||||
);
|
||||
|
||||
for (UnificationSettings settings : unificationSettings) {
|
||||
|
@ -88,19 +88,19 @@ public class RecipeTransformer {
|
|||
var unified = unifyRecipes(recipeLinks, r -> allRecipes.put(r.getId(), r.getUnified()));
|
||||
var duplicates = handleDuplicates(duplicateConfig.shouldCompareAll() ? recipeLinks : unified, recipeLinks);
|
||||
duplicates
|
||||
.stream()
|
||||
.flatMap(d -> d.getRecipesWithoutMaster().stream())
|
||||
.forEach(r -> allRecipes.remove(r.getId()));
|
||||
.stream()
|
||||
.flatMap(d -> d.getRecipesWithoutMaster().stream())
|
||||
.forEach(r -> allRecipes.remove(r.getId()));
|
||||
if (tracker != null) unified.forEach(tracker::add);
|
||||
}
|
||||
|
||||
public Map<ResourceLocation, List<RecipeLink>> groupRecipesByType(Map<ResourceLocation, JsonElement> recipes) {
|
||||
return recipes
|
||||
.entrySet()
|
||||
.stream()
|
||||
.map(entry -> new RecipeLink(entry.getKey(), entry.getValue().getAsJsonObject()))
|
||||
.sorted(Comparator.comparing(entry -> entry.getId().toString()))
|
||||
.collect(Collectors.groupingByConcurrent(RecipeLink::getType));
|
||||
.entrySet()
|
||||
.stream()
|
||||
.map(entry -> new RecipeLink(entry.getKey(), entry.getValue().getAsJsonObject()))
|
||||
.sorted(Comparator.comparing(entry -> entry.getId().toString()))
|
||||
.collect(Collectors.groupingByConcurrent(RecipeLink::getType));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,7 +130,7 @@ public class RecipeTransformer {
|
|||
for (RecipeLink recipeLink : recipes) {
|
||||
if (!curRecipe.getType().equals(recipeLink.getType())) {
|
||||
throw new IllegalStateException(
|
||||
"Recipe types do not match for " + curRecipe.getId() + " and " + recipeLink.getId());
|
||||
"Recipe types do not match for " + curRecipe.getId() + " and " + recipeLink.getId());
|
||||
}
|
||||
|
||||
if (recipeLink == curRecipe || duplicateConfig.shouldIgnoreRecipe(recipeLink)) {
|
||||
|
|
|
@ -38,23 +38,23 @@ public final class CustomLogger {
|
|||
var strategy = DefaultRolloverStrategy.newBuilder().withCustomActions(new Action[]{ deleteAction }).build();
|
||||
|
||||
var layout = PatternLayout
|
||||
.newBuilder()
|
||||
.withConfiguration(config)
|
||||
.withCharset(StandardCharsets.UTF_8)
|
||||
.withPattern("[%d{HH:mm:ss.SSS}] [%level]: %minecraftFormatting{%msg{nolookup}}{strip}%n%xEx")
|
||||
.build();
|
||||
.newBuilder()
|
||||
.withConfiguration(config)
|
||||
.withCharset(StandardCharsets.UTF_8)
|
||||
.withPattern("[%d{HH:mm:ss.SSS}] [%level]: %minecraftFormatting{%msg{nolookup}}{strip}%n%xEx")
|
||||
.build();
|
||||
|
||||
var fileAppender = RollingRandomAccessFileAppender
|
||||
.newBuilder()
|
||||
.withAppend(true)
|
||||
.withFileName(LOG_PATH + "/" + FILE)
|
||||
.withFilePattern(LOG_PATH + "/" + BACKUP_FILE)
|
||||
.withStrategy(strategy)
|
||||
.withPolicy(new Policy())
|
||||
.setName(BuildConfig.MOD_NAME + " File")
|
||||
.setLayout(layout)
|
||||
.setConfiguration(config)
|
||||
.build();
|
||||
.newBuilder()
|
||||
.withAppend(true)
|
||||
.withFileName(LOG_PATH + "/" + FILE)
|
||||
.withFilePattern(LOG_PATH + "/" + BACKUP_FILE)
|
||||
.withStrategy(strategy)
|
||||
.withPolicy(new Policy())
|
||||
.setName(BuildConfig.MOD_NAME + " File")
|
||||
.setLayout(layout)
|
||||
.setConfiguration(config)
|
||||
.build();
|
||||
|
||||
fileAppender.start();
|
||||
|
||||
|
@ -62,11 +62,11 @@ public final class CustomLogger {
|
|||
loggerConfig.addAppender(fileAppender, null, null);
|
||||
|
||||
Optional.ofNullable(config.getAppenders().get("Console")) // latest.log for neoforge
|
||||
.ifPresent(a -> loggerConfig.addAppender(a, null, null));
|
||||
.ifPresent(a -> loggerConfig.addAppender(a, null, null));
|
||||
Optional.ofNullable(config.getAppenders().get("SysOut")) // latest.log for fabric
|
||||
.ifPresent(a -> loggerConfig.addAppender(a, null, null));
|
||||
.ifPresent(a -> loggerConfig.addAppender(a, null, null));
|
||||
Optional.ofNullable(config.getAppenders().get("ServerGuiConsole")) // game console
|
||||
.ifPresent(a -> loggerConfig.addAppender(a, null, null));
|
||||
.ifPresent(a -> loggerConfig.addAppender(a, null, null));
|
||||
|
||||
config.addLogger(BuildConfig.MOD_NAME, loggerConfig);
|
||||
return LogManager.getLogger(BuildConfig.MOD_NAME);
|
||||
|
|
|
@ -76,21 +76,21 @@ public final class DebugHandler {
|
|||
int maxLength = getMaxLength(unificationLookup.getTags(), t -> t.location().toString().length());
|
||||
|
||||
FileUtils.writeDebugLog(TAGS, sb -> sb
|
||||
.append(lastRun).append("\n")
|
||||
.append(unificationLookup
|
||||
.getTags()
|
||||
.stream()
|
||||
.map(t -> rf(t.location(), maxLength) + " => " +
|
||||
unificationLookup
|
||||
.getTagEntries(t)
|
||||
.stream()
|
||||
.map(entry -> entry.id().toString())
|
||||
.sorted()
|
||||
.collect(Collectors.joining(", ")) + "\n"
|
||||
)
|
||||
.sorted()
|
||||
.collect(Collectors.joining())
|
||||
));
|
||||
.append(lastRun).append("\n")
|
||||
.append(unificationLookup
|
||||
.getTags()
|
||||
.stream()
|
||||
.map(t -> rf(t.location(), maxLength) + " => " +
|
||||
unificationLookup
|
||||
.getTagEntries(t)
|
||||
.stream()
|
||||
.map(entry -> entry.id().toString())
|
||||
.sorted()
|
||||
.collect(Collectors.joining(", ")) + "\n"
|
||||
)
|
||||
.sorted()
|
||||
.collect(Collectors.joining())
|
||||
));
|
||||
}
|
||||
|
||||
private void dumpRecipes(String fileName, Map<ResourceLocation, JsonElement> recipes) {
|
||||
|
@ -99,13 +99,13 @@ public final class DebugHandler {
|
|||
int maxLength = getMaxLength(recipes.keySet(), id -> id.toString().length());
|
||||
|
||||
FileUtils.writeDebugLog(fileName, sb -> sb
|
||||
.append(lastRun).append("\n")
|
||||
.append(recipes
|
||||
.entrySet()
|
||||
.stream()
|
||||
.sorted(Map.Entry.comparingByKey())
|
||||
.map(e -> rf(e.getKey(), maxLength) + " => " + e.getValue().toString())
|
||||
.collect(Collectors.joining("\n")))
|
||||
.append(lastRun).append("\n")
|
||||
.append(recipes
|
||||
.entrySet()
|
||||
.stream()
|
||||
.sorted(Map.Entry.comparingByKey())
|
||||
.map(e -> rf(e.getKey(), maxLength) + " => " + e.getValue().toString())
|
||||
.collect(Collectors.joining("\n")))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -117,58 +117,58 @@ public final class DebugHandler {
|
|||
|
||||
FileUtils.writeDebugLog(OVERVIEW, sb -> {
|
||||
sb
|
||||
.append(lastRun).append("\n")
|
||||
.append("# Statistics:\n")
|
||||
.append("- Unified Recipes: ")
|
||||
.append(transformerResult.getUnifiedRecipeCount())
|
||||
.append("\n")
|
||||
.append("- Duplicate Recipes: ")
|
||||
.append(transformerResult.getDuplicatesCount())
|
||||
.append(" (Individual: ")
|
||||
.append(transformerResult.getDuplicateRecipesCount())
|
||||
.append(")\n")
|
||||
.append("- Recipes Before: ")
|
||||
.append(recipesBefore)
|
||||
.append("\n")
|
||||
.append("- Recipes After: ")
|
||||
.append(recipesAfter)
|
||||
.append("\n")
|
||||
.append("- Elapsed Time: ")
|
||||
.append(endTime - startTime)
|
||||
.append(" ms")
|
||||
.append("\n\n")
|
||||
.append("# Summary:\n")
|
||||
.append(rf("Recipe type", maxLength))
|
||||
.append(" | ")
|
||||
.append(lf("Unified", 10))
|
||||
.append(" | ")
|
||||
.append(lf("Duplicates", 10))
|
||||
.append(" | ")
|
||||
.append(lf("All", 5))
|
||||
.append("\n")
|
||||
.append(StringUtils.repeat("-", maxLength + 10 + 10 + 5 + 9))
|
||||
.append("\n");
|
||||
.append(lastRun).append("\n")
|
||||
.append("# Statistics:\n")
|
||||
.append("- Unified Recipes: ")
|
||||
.append(transformerResult.getUnifiedRecipeCount())
|
||||
.append("\n")
|
||||
.append("- Duplicate Recipes: ")
|
||||
.append(transformerResult.getDuplicatesCount())
|
||||
.append(" (Individual: ")
|
||||
.append(transformerResult.getDuplicateRecipesCount())
|
||||
.append(")\n")
|
||||
.append("- Recipes Before: ")
|
||||
.append(recipesBefore)
|
||||
.append("\n")
|
||||
.append("- Recipes After: ")
|
||||
.append(recipesAfter)
|
||||
.append("\n")
|
||||
.append("- Elapsed Time: ")
|
||||
.append(endTime - startTime)
|
||||
.append(" ms")
|
||||
.append("\n\n")
|
||||
.append("# Summary:\n")
|
||||
.append(rf("Recipe type", maxLength))
|
||||
.append(" | ")
|
||||
.append(lf("Unified", 10))
|
||||
.append(" | ")
|
||||
.append(lf("Duplicates", 10))
|
||||
.append(" | ")
|
||||
.append(lf("All", 5))
|
||||
.append("\n")
|
||||
.append(StringUtils.repeat("-", maxLength + 10 + 10 + 5 + 9))
|
||||
.append("\n");
|
||||
|
||||
getSortedUnifiedRecipeTypes().forEach(type -> {
|
||||
int unifiedSize = transformerResult.getUnifiedRecipes(type).size();
|
||||
int allSize = transformerResult.getRecipes(type).size();
|
||||
int duplicatesSize = transformerResult.getDuplicates(type).size();
|
||||
int individualDuplicatesSize = transformerResult
|
||||
.getDuplicates(type)
|
||||
.stream()
|
||||
.mapToInt(l -> l.getRecipes().size())
|
||||
.sum();
|
||||
.getDuplicates(type)
|
||||
.stream()
|
||||
.mapToInt(l -> l.getRecipes().size())
|
||||
.sum();
|
||||
|
||||
String dStr = String.format("%s (%s)", lf(duplicatesSize, 3), lf(individualDuplicatesSize, 3));
|
||||
sb
|
||||
.append(rf(type, maxLength))
|
||||
.append(" | ")
|
||||
.append(lf(unifiedSize, 10))
|
||||
.append(" | ")
|
||||
.append(lf(duplicatesSize == 0 ? " " : dStr, 10))
|
||||
.append(" | ")
|
||||
.append(lf(allSize, 5))
|
||||
.append("\n");
|
||||
.append(rf(type, maxLength))
|
||||
.append(" | ")
|
||||
.append(lf(unifiedSize, 10))
|
||||
.append(" | ")
|
||||
.append(lf(duplicatesSize == 0 ? " " : dStr, 10))
|
||||
.append(" | ")
|
||||
.append(lf(allSize, 5))
|
||||
.append("\n");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -183,15 +183,15 @@ public final class DebugHandler {
|
|||
|
||||
getSortedUnifiedRecipes(type).forEach(recipe -> {
|
||||
sb
|
||||
.append("\t- ")
|
||||
.append(recipe.getId())
|
||||
.append("\n")
|
||||
.append("\t\t Original: ")
|
||||
.append(recipe.getOriginal())
|
||||
.append("\n")
|
||||
.append("\t\t Transformed: ")
|
||||
.append(recipe.getUnified() == null ? "NOT UNIFIED" : recipe.getUnified().toString())
|
||||
.append("\n\n");
|
||||
.append("\t- ")
|
||||
.append(recipe.getId())
|
||||
.append("\n")
|
||||
.append("\t\t Original: ")
|
||||
.append(recipe.getOriginal())
|
||||
.append("\n")
|
||||
.append("\t\t Transformed: ")
|
||||
.append(recipe.getUnified() == null ? "NOT UNIFIED" : recipe.getUnified().toString())
|
||||
.append("\n\n");
|
||||
});
|
||||
|
||||
sb.append("}\n\n");
|
||||
|
@ -207,27 +207,27 @@ public final class DebugHandler {
|
|||
sb.append(lastRun).append("\n");
|
||||
getSortedUnifiedRecipeTypes().forEach(type -> {
|
||||
Collection<RecipeLink.DuplicateLink> duplicates = transformerResult
|
||||
.getDuplicates(type)
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(l -> l.getMaster().getId().toString()))
|
||||
.toList();
|
||||
.getDuplicates(type)
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(l -> l.getMaster().getId().toString()))
|
||||
.toList();
|
||||
if (duplicates.isEmpty()) return;
|
||||
|
||||
sb.append(duplicates
|
||||
.stream()
|
||||
.map(this::createDuplicatesDump)
|
||||
.collect(Collectors.joining("", type + " {\n", "}\n\n")));
|
||||
.stream()
|
||||
.map(this::createDuplicatesDump)
|
||||
.collect(Collectors.joining("", type + " {\n", "}\n\n")));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private String createDuplicatesDump(RecipeLink.DuplicateLink link) {
|
||||
return link
|
||||
.getRecipes()
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(r -> r.getId().toString()))
|
||||
.map(r -> "\t\t- " + r.getId() + "\n")
|
||||
.collect(Collectors.joining("", String.format("\t%s\n", link.getMaster().getId().toString()), "\n"));
|
||||
.getRecipes()
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(r -> r.getId().toString()))
|
||||
.map(r -> "\t\t- " + r.getId() + "\n")
|
||||
.collect(Collectors.joining("", String.format("\t%s\n", link.getMaster().getId().toString()), "\n"));
|
||||
}
|
||||
|
||||
private static <T> int getMaxLength(Collection<T> collection, ToIntFunction<T> function) {
|
||||
|
@ -245,16 +245,16 @@ public final class DebugHandler {
|
|||
private Stream<ResourceLocation> getSortedUnifiedRecipeTypes() {
|
||||
Preconditions.checkNotNull(transformerResult);
|
||||
return transformerResult
|
||||
.getUnifiedRecipeTypes()
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(ResourceLocation::toString));
|
||||
.getUnifiedRecipeTypes()
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(ResourceLocation::toString));
|
||||
}
|
||||
|
||||
private Stream<RecipeLink> getSortedUnifiedRecipes(ResourceLocation type) {
|
||||
Preconditions.checkNotNull(transformerResult);
|
||||
return transformerResult
|
||||
.getUnifiedRecipes(type)
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(r -> r.getId().toString()));
|
||||
.getUnifiedRecipes(type)
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(r -> r.getId().toString()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,11 +33,11 @@ public final class FileUtils {
|
|||
Files.createDirectories(path);
|
||||
Path filePath = path.resolve(fileName);
|
||||
Files.writeString(
|
||||
filePath,
|
||||
sb.toString(),
|
||||
StandardOpenOption.CREATE,
|
||||
StandardOpenOption.TRUNCATE_EXISTING,
|
||||
StandardOpenOption.WRITE
|
||||
filePath,
|
||||
sb.toString(),
|
||||
StandardOpenOption.CREATE,
|
||||
StandardOpenOption.TRUNCATE_EXISTING,
|
||||
StandardOpenOption.WRITE
|
||||
);
|
||||
} catch (IOException e) {
|
||||
AlmostUnifiedCommon.LOGGER.warn("Couldn't write to file '{}'.", fileName, e);
|
||||
|
|
|
@ -83,7 +83,7 @@ public class JsonQuery {
|
|||
|
||||
public Optional<Integer> asInt() {
|
||||
return asElement().filter(JsonElement::isJsonPrimitive).map(JsonElement::getAsJsonPrimitive)
|
||||
.filter(JsonPrimitive::isNumber).map(JsonElement::getAsInt);
|
||||
.filter(JsonPrimitive::isNumber).map(JsonElement::getAsInt);
|
||||
}
|
||||
|
||||
public JsonQuery shallowCopy() {
|
||||
|
|
|
@ -129,31 +129,31 @@ public final class JsonUtils {
|
|||
}
|
||||
|
||||
public static <K, V> Map<K, V> deserializeMap(
|
||||
JsonObject json,
|
||||
String key,
|
||||
Function<Map.Entry<String, JsonElement>, K> keyMapper,
|
||||
Function<Map.Entry<String, JsonElement>, V> valueMapper
|
||||
JsonObject json,
|
||||
String key,
|
||||
Function<Map.Entry<String, JsonElement>, K> keyMapper,
|
||||
Function<Map.Entry<String, JsonElement>, V> valueMapper
|
||||
) {
|
||||
return json.getAsJsonObject(key)
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(keyMapper, valueMapper, (a, b) -> b, HashMap::new));
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(keyMapper, valueMapper, (a, b) -> b, HashMap::new));
|
||||
}
|
||||
|
||||
public static <K, V> Map<K, Set<V>> deserializeMapSet(
|
||||
JsonObject json,
|
||||
String key,
|
||||
Function<Map.Entry<String, JsonElement>, K> keyMapper,
|
||||
Function<String, V> valueMapper
|
||||
JsonObject json,
|
||||
String key,
|
||||
Function<Map.Entry<String, JsonElement>, K> keyMapper,
|
||||
Function<String, V> valueMapper
|
||||
) {
|
||||
return deserializeMap(
|
||||
json,
|
||||
key,
|
||||
keyMapper,
|
||||
e -> toList(e.getValue().getAsJsonArray())
|
||||
.stream()
|
||||
.map(valueMapper)
|
||||
.collect(Collectors.toSet())
|
||||
json,
|
||||
key,
|
||||
keyMapper,
|
||||
e -> toList(e.getValue().getAsJsonArray())
|
||||
.stream()
|
||||
.map(valueMapper)
|
||||
.collect(Collectors.toSet())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,16 +10,16 @@ public class CommonTest {
|
|||
public static void init(boolean gametestEnabled) {
|
||||
if (gametestEnabled) {
|
||||
GameTestLoader.registerProviders(
|
||||
ExampleTest.class,
|
||||
UnificationHandlerTests.class,
|
||||
ReplacementsTests.class,
|
||||
UnifyTests.class,
|
||||
ShapedRecipeUnifierTests.class,
|
||||
SmithingRecipeUnifierTest.class,
|
||||
GregTechModernRecipeUnifierTests.class,
|
||||
TagSubstitutionTests.class,
|
||||
TagInheritanceTests.class,
|
||||
LootUnificationTests.class
|
||||
ExampleTest.class,
|
||||
UnificationHandlerTests.class,
|
||||
ReplacementsTests.class,
|
||||
UnifyTests.class,
|
||||
ShapedRecipeUnifierTests.class,
|
||||
SmithingRecipeUnifierTest.class,
|
||||
GregTechModernRecipeUnifierTests.class,
|
||||
TagSubstitutionTests.class,
|
||||
TagInheritanceTests.class,
|
||||
LootUnificationTests.class
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,11 +40,11 @@ public class TestItems {
|
|||
|
||||
private static Block ore() {
|
||||
BlockBehaviour.Properties props = BlockBehaviour.Properties
|
||||
.of()
|
||||
.mapColor(MapColor.STONE)
|
||||
.instrument(NoteBlockInstrument.BASEDRUM)
|
||||
.requiresCorrectToolForDrops()
|
||||
.strength(3.0F, 3.0F);
|
||||
.of()
|
||||
.mapColor(MapColor.STONE)
|
||||
.instrument(NoteBlockInstrument.BASEDRUM)
|
||||
.requiresCorrectToolForDrops()
|
||||
.strength(3.0F, 3.0F);
|
||||
return new DropExperienceBlock(ConstantInt.of(0), props);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,13 +32,13 @@ public class TestUtils {
|
|||
public static final Gson GSON = new GsonBuilder().create();
|
||||
|
||||
public static final ModPriorities TEST_MOD_PRIORITIES = new ModPrioritiesImpl(
|
||||
List.of("testmod", "mekanism", "thermal", "create"),
|
||||
new HashMap<>()
|
||||
List.of("testmod", "mekanism", "thermal", "create"),
|
||||
new HashMap<>()
|
||||
);
|
||||
|
||||
public static final ModPriorities EMPTY_MOD_PRIORITIES = new ModPrioritiesImpl(
|
||||
List.of(),
|
||||
new HashMap<>()
|
||||
List.of(),
|
||||
new HashMap<>()
|
||||
);
|
||||
|
||||
public static final StoneVariants EMPTY_STONE_VARIANTS = new StoneVariants() {
|
||||
|
@ -92,12 +92,12 @@ public class TestUtils {
|
|||
|
||||
public static UnificationLookup unificationLookup() {
|
||||
return new UnificationLookupImpl.Builder()
|
||||
.put(itemTag("testmod:test_tag"),
|
||||
ResourceLocation.parse("minecraft:test_item"),
|
||||
ResourceLocation.parse("mekanism:test_item"),
|
||||
ResourceLocation.parse("thermal:test_item"),
|
||||
ResourceLocation.parse("testmod:test_item"))
|
||||
.build(TEST_MOD_PRIORITIES, EMPTY_STONE_VARIANTS, EMPTY_TAG_SUBSTITUTIONS);
|
||||
.put(itemTag("testmod:test_tag"),
|
||||
ResourceLocation.parse("minecraft:test_item"),
|
||||
ResourceLocation.parse("mekanism:test_item"),
|
||||
ResourceLocation.parse("thermal:test_item"),
|
||||
ResourceLocation.parse("testmod:test_item"))
|
||||
.build(TEST_MOD_PRIORITIES, EMPTY_STONE_VARIANTS, EMPTY_TAG_SUBSTITUTIONS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -139,11 +139,11 @@ public class TestUtils {
|
|||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb
|
||||
.append("\nExpected:\t")
|
||||
.append(GSON.toJson(expected))
|
||||
.append("\nActual:\t\t")
|
||||
.append(GSON.toJson(actual))
|
||||
.append("\n");
|
||||
.append("\nExpected:\t")
|
||||
.append(GSON.toJson(expected))
|
||||
.append("\nActual:\t\t")
|
||||
.append(GSON.toJson(actual))
|
||||
.append("\n");
|
||||
if (!difference.entriesDiffering().isEmpty()) {
|
||||
sb.append("Differences:\n");
|
||||
difference.entriesDiffering().forEach((k, v) -> {
|
||||
|
|
|
@ -33,7 +33,7 @@ public class GameTestLoader {
|
|||
try {
|
||||
instance = providerClass.getConstructor().newInstance();
|
||||
} catch (InstantiationException | IllegalAccessException | InvocationTargetException |
|
||||
NoSuchMethodException e) {
|
||||
NoSuchMethodException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class GameTestLoader {
|
|||
SimpleGameTest simpleGametest = method.getAnnotation(SimpleGameTest.class);
|
||||
if (gametest != null && simpleGametest != null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Cannot have both @GameTest and @SimpleGameTest on the same method");
|
||||
"Cannot have both @GameTest and @SimpleGameTest on the same method");
|
||||
}
|
||||
|
||||
if (gametest != null) {
|
||||
|
@ -64,18 +64,18 @@ public class GameTestLoader {
|
|||
}
|
||||
|
||||
var test = new TestFunction(
|
||||
gametest.batch(),
|
||||
createTestName(method),
|
||||
template,
|
||||
StructureUtils.getRotationForRotationSteps(gametest.rotationSteps()),
|
||||
gametest.timeoutTicks(),
|
||||
gametest.setupTicks(),
|
||||
gametest.required(),
|
||||
gametest.manualOnly(),
|
||||
gametest.attempts(),
|
||||
gametest.requiredSuccesses(),
|
||||
gametest.skyAccess(),
|
||||
consumer
|
||||
gametest.batch(),
|
||||
createTestName(method),
|
||||
template,
|
||||
StructureUtils.getRotationForRotationSteps(gametest.rotationSteps()),
|
||||
gametest.timeoutTicks(),
|
||||
gametest.setupTicks(),
|
||||
gametest.required(),
|
||||
gametest.manualOnly(),
|
||||
gametest.attempts(),
|
||||
gametest.requiredSuccesses(),
|
||||
gametest.skyAccess(),
|
||||
consumer
|
||||
);
|
||||
|
||||
GameTestRegistryAccessor.TEST_FUNCTIONS().add(test);
|
||||
|
@ -89,17 +89,17 @@ public class GameTestLoader {
|
|||
}
|
||||
|
||||
var test = new TestFunction(gametest.batch(),
|
||||
createTestName(method),
|
||||
template,
|
||||
Rotation.NONE,
|
||||
100,
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
gametest.attempts(),
|
||||
1,
|
||||
false,
|
||||
consumer);
|
||||
createTestName(method),
|
||||
template,
|
||||
Rotation.NONE,
|
||||
100,
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
gametest.attempts(),
|
||||
1,
|
||||
false,
|
||||
consumer);
|
||||
|
||||
GameTestRegistryAccessor.TEST_FUNCTIONS().add(test);
|
||||
GameTestRegistryAccessor.TEST_CLASS_NAMES().add(method.getDeclaringClass().getSimpleName());
|
||||
|
@ -118,10 +118,10 @@ public class GameTestLoader {
|
|||
ENABLED_MODS = Collections.emptyList();
|
||||
} else {
|
||||
ENABLED_MODS = Arrays.stream(enabledNamespaces.split(","))
|
||||
.map(String::trim)
|
||||
.filter(s -> !s.isEmpty())
|
||||
.map(Pattern::compile)
|
||||
.toList();
|
||||
.map(String::trim)
|
||||
.filter(s -> !s.isEmpty())
|
||||
.map(Pattern::compile)
|
||||
.toList();
|
||||
// AlmostLib.LOGGER.info("Enabled gametests for mods: " + ENABLED_MODS);
|
||||
}
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ public class GameTestLoader {
|
|||
if (parameterTypes.length == 1) {
|
||||
if (!GameTestHelper.class.isAssignableFrom(parameterTypes[0])) {
|
||||
throw new RuntimeException(
|
||||
"unsupported parameter type, parameter must extend " + GameTestHelper.class.getName());
|
||||
"unsupported parameter type, parameter must extend " + GameTestHelper.class.getName());
|
||||
}
|
||||
|
||||
// noinspection CastToIncompatibleInterface
|
||||
|
|
|
@ -14,9 +14,9 @@ public class FakeResourceKeyRegistry {
|
|||
Constructor<?> c = ResourceKey.class.getDeclaredConstructor(ResourceLocation.class, ResourceLocation.class);
|
||||
c.setAccessible(true);
|
||||
return (ResourceKey<Registry<T>>) c.newInstance(ResourceLocation.withDefaultNamespace("test_registry"),
|
||||
ResourceLocation.parse(name));
|
||||
ResourceLocation.parse(name));
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException |
|
||||
IllegalAccessException e) {
|
||||
IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ public final class TestUtils {
|
|||
public static final String TEST_MOD_5 = "test_mod_5";
|
||||
|
||||
public static final List<String> TEST_MOD_PRIORITIES = List.of(
|
||||
TEST_MOD_1,
|
||||
TEST_MOD_2,
|
||||
TEST_MOD_3,
|
||||
TEST_MOD_4,
|
||||
TEST_MOD_5
|
||||
TEST_MOD_1,
|
||||
TEST_MOD_2,
|
||||
TEST_MOD_3,
|
||||
TEST_MOD_4,
|
||||
TEST_MOD_5
|
||||
);
|
||||
|
||||
public static final JsonCompare.CompareSettings DEFAULT_COMPARE_SETTINGS = getDefaultCompareSettings();
|
||||
|
@ -39,8 +39,8 @@ public final class TestUtils {
|
|||
|
||||
public static JsonCompare.CompareSettings getDefaultShapedCompareSettings() {
|
||||
return Defaults
|
||||
.getDefaultDuplicateOverrides(AlmostUnifiedPlatform.Platform.NEO_FORGE)
|
||||
.get(ResourceLocation.withDefaultNamespace("crafting_shaped"));
|
||||
.getDefaultDuplicateOverrides(AlmostUnifiedPlatform.Platform.NEO_FORGE)
|
||||
.get(ResourceLocation.withDefaultNamespace("crafting_shaped"));
|
||||
}
|
||||
|
||||
public static final ResourceKey<Registry<Item>> FAKE_ITEM_REGISTRY = FakeResourceKeyRegistry.create("item");
|
||||
|
@ -49,10 +49,10 @@ public final class TestUtils {
|
|||
public static final TagKey<Item> TIN_ORES_TAG = tag("c:ores/tin");
|
||||
public static final TagKey<Item> SILVER_ORES_TAG = tag("c:ores/silver");
|
||||
public static final List<TagKey<Item>> TEST_ALLOWED_TAGS = List.of(
|
||||
BRONZE_ORES_TAG,
|
||||
INVAR_ORES_TAG,
|
||||
TIN_ORES_TAG,
|
||||
SILVER_ORES_TAG
|
||||
BRONZE_ORES_TAG,
|
||||
INVAR_ORES_TAG,
|
||||
TIN_ORES_TAG,
|
||||
SILVER_ORES_TAG
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -115,147 +115,147 @@ public final class TestUtils {
|
|||
public static final class Recipes {
|
||||
|
||||
public static final String SMELTING = """
|
||||
{
|
||||
"type": "minecraft:smelting",
|
||||
"group": "coal",
|
||||
"ingredient": {
|
||||
"item": "minecraft:coal_ore"
|
||||
},
|
||||
"result": "minecraft:coal",
|
||||
"experience": 0.1,
|
||||
"cookingtime": 200
|
||||
}
|
||||
""";
|
||||
{
|
||||
"type": "minecraft:smelting",
|
||||
"group": "coal",
|
||||
"ingredient": {
|
||||
"item": "minecraft:coal_ore"
|
||||
},
|
||||
"result": "minecraft:coal",
|
||||
"experience": 0.1,
|
||||
"cookingtime": 200
|
||||
}
|
||||
""";
|
||||
public static final String SHAPED_NO_MATCH_1 = """
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"iii",
|
||||
"ici",
|
||||
"iii"
|
||||
],
|
||||
"key": {
|
||||
"i": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
},
|
||||
"k": {
|
||||
"item": "minecraft:carrot"
|
||||
}
|
||||
},
|
||||
"result": "minecraft:iron_ingot"
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"iii",
|
||||
"ici",
|
||||
"iii"
|
||||
],
|
||||
"key": {
|
||||
"i": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
},
|
||||
"k": {
|
||||
"item": "minecraft:carrot"
|
||||
}
|
||||
""";
|
||||
},
|
||||
"result": "minecraft:iron_ingot"
|
||||
}
|
||||
""";
|
||||
public static final String SHAPED_NO_MATCH_2 = """
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"iii",
|
||||
"ici",
|
||||
"iii"
|
||||
],
|
||||
"key": {
|
||||
"i": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
},
|
||||
"k": {
|
||||
"item": "minecraft:pumpkin"
|
||||
}
|
||||
},
|
||||
"result": "minecraft:iron_ingot"
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"iii",
|
||||
"ici",
|
||||
"iii"
|
||||
],
|
||||
"key": {
|
||||
"i": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
},
|
||||
"k": {
|
||||
"item": "minecraft:pumpkin"
|
||||
}
|
||||
""";
|
||||
},
|
||||
"result": "minecraft:iron_ingot"
|
||||
}
|
||||
""";
|
||||
public static final String SHAPED_SPECIAL_MATCH_1 = """
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"iii",
|
||||
"iii",
|
||||
"iii"
|
||||
],
|
||||
"key": {
|
||||
"i": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
}
|
||||
},
|
||||
"result": "minecraft:iron_ingot"
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"iii",
|
||||
"iii",
|
||||
"iii"
|
||||
],
|
||||
"key": {
|
||||
"i": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
}
|
||||
""";
|
||||
},
|
||||
"result": "minecraft:iron_ingot"
|
||||
}
|
||||
""";
|
||||
public static final String SHAPED_SPECIAL_MATCH_2 = """
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"iii",
|
||||
"iki",
|
||||
"iii"
|
||||
],
|
||||
"key": {
|
||||
"i": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
},
|
||||
"k": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
}
|
||||
},
|
||||
"result": "minecraft:iron_ingot"
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"iii",
|
||||
"iki",
|
||||
"iii"
|
||||
],
|
||||
"key": {
|
||||
"i": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
},
|
||||
"k": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
}
|
||||
""";
|
||||
},
|
||||
"result": "minecraft:iron_ingot"
|
||||
}
|
||||
""";
|
||||
public static final String SHAPED_SANITIZE_1 = """
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"iii",
|
||||
"iii",
|
||||
"iii"
|
||||
],
|
||||
"key": {
|
||||
"i": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
}
|
||||
},
|
||||
"result": "minecraft:iron_ingot"
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"iii",
|
||||
"iii",
|
||||
"iii"
|
||||
],
|
||||
"key": {
|
||||
"i": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
}
|
||||
""";
|
||||
},
|
||||
"result": "minecraft:iron_ingot"
|
||||
}
|
||||
""";
|
||||
public static final String SHAPED_SANITIZE_2 = """
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"iii",
|
||||
"iii",
|
||||
"iii"
|
||||
],
|
||||
"key": {
|
||||
"i": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "minecraft:iron_ingot",
|
||||
"count": 1
|
||||
}
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"iii",
|
||||
"iii",
|
||||
"iii"
|
||||
],
|
||||
"key": {
|
||||
"i": {
|
||||
"tag": "c:raw_materials/iron"
|
||||
}
|
||||
""";
|
||||
},
|
||||
"result": {
|
||||
"item": "minecraft:iron_ingot",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
""";
|
||||
public static final String CRUSHING_NESTED_SANITIZE_1 = """
|
||||
{
|
||||
"type": "create:crushing",
|
||||
"ingredients": [{ "tag": "c:raw_materials/lead" }],
|
||||
"processingTime": 400,
|
||||
"results": [
|
||||
{ "item": "emendatusenigmatica:crushed_lead_ore" },
|
||||
{ "chance": 0.75, "item": "create:experience_nugget" }
|
||||
]
|
||||
}
|
||||
""";
|
||||
{
|
||||
"type": "create:crushing",
|
||||
"ingredients": [{ "tag": "c:raw_materials/lead" }],
|
||||
"processingTime": 400,
|
||||
"results": [
|
||||
{ "item": "emendatusenigmatica:crushed_lead_ore" },
|
||||
{ "chance": 0.75, "item": "create:experience_nugget" }
|
||||
]
|
||||
}
|
||||
""";
|
||||
public static final String CRUSHING_NESTED_SANITIZE_2 = """
|
||||
{
|
||||
"type": "create:crushing",
|
||||
"ingredients": [{ "tag": "c:raw_materials/lead" }],
|
||||
"processingTime": 400,
|
||||
"results": [
|
||||
{ "count": 1, "item": "emendatusenigmatica:crushed_lead_ore" },
|
||||
{ "chance": 0.75, "count": 1, "item": "create:experience_nugget" }
|
||||
]
|
||||
}
|
||||
""";
|
||||
{
|
||||
"type": "create:crushing",
|
||||
"ingredients": [{ "tag": "c:raw_materials/lead" }],
|
||||
"processingTime": 400,
|
||||
"results": [
|
||||
{ "count": 1, "item": "emendatusenigmatica:crushed_lead_ore" },
|
||||
{ "chance": 0.75, "count": 1, "item": "create:experience_nugget" }
|
||||
]
|
||||
}
|
||||
""";
|
||||
|
||||
private Recipes() {}
|
||||
}
|
||||
|
|
|
@ -4,13 +4,13 @@ package testmod.old.recipe;
|
|||
// TODO I BROKE THEM! NEED TO FIX
|
||||
public class RecipeContextImplTest {
|
||||
public static String mekaTest = """
|
||||
{
|
||||
"type": "mekanism:combining",
|
||||
"mainInput": { "amount": 8, "ingredient": { "tag": "c:raw_materials/tin" } },
|
||||
"extraInput": { "ingredient": { "tag": "c:cobblestone/normal" } },
|
||||
"output": { "item": "mekanism:tin_ore" }
|
||||
}
|
||||
""";
|
||||
{
|
||||
"type": "mekanism:combining",
|
||||
"mainInput": { "amount": 8, "ingredient": { "tag": "c:raw_materials/tin" } },
|
||||
"extraInput": { "ingredient": { "tag": "c:cobblestone/normal" } },
|
||||
"output": { "item": "mekanism:tin_ore" }
|
||||
}
|
||||
""";
|
||||
|
||||
// @Test
|
||||
// public void depthReplace_MekaTest() {
|
||||
|
|
|
@ -13,215 +13,215 @@ public class GregTechModernRecipeUnifierTests {
|
|||
@SimpleGameTest
|
||||
public void test() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "gtceu:extruder",
|
||||
"duration": 646,
|
||||
"inputs": {
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
},
|
||||
"chance": 0.0,
|
||||
"tierChanceBoost": 0.0
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"item": "minecraft:ender_pearl"
|
||||
}
|
||||
},
|
||||
"chance": 0.0,
|
||||
"tierChanceBoost": 0.0
|
||||
{
|
||||
"type": "gtceu:extruder",
|
||||
"duration": 646,
|
||||
"inputs": {
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
]
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
},
|
||||
"outputs": {
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 2,
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 2,
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
]
|
||||
},
|
||||
"chance": 0.0,
|
||||
"tierChanceBoost": 0.0
|
||||
},
|
||||
"tickInputs": {
|
||||
"eu": [
|
||||
{
|
||||
"content": 180,
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"item": "minecraft:ender_pearl"
|
||||
}
|
||||
],
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
]
|
||||
},
|
||||
"tickOutputs": {
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
]
|
||||
},
|
||||
"chance": 0.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "gtceu:extruder",
|
||||
"duration": 646,
|
||||
"inputs": {
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"chance": 0.0,
|
||||
"tierChanceBoost": 0.0
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"item": "minecraft:ender_pearl"
|
||||
}
|
||||
},
|
||||
"chance": 0.0,
|
||||
"tierChanceBoost": 0.0
|
||||
]
|
||||
},
|
||||
"outputs": {
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 2,
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
]
|
||||
},
|
||||
"outputs": {
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 2,
|
||||
"ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 2,
|
||||
"ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
]
|
||||
},
|
||||
"tickInputs": {
|
||||
"eu": [
|
||||
{
|
||||
"content": 180,
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
],
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 2,
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tickOutputs": {
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
]
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
}
|
||||
""");
|
||||
]
|
||||
},
|
||||
"tickInputs": {
|
||||
"eu": [
|
||||
{
|
||||
"content": 180,
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
],
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
]
|
||||
},
|
||||
"tickOutputs": {
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "gtceu:extruder",
|
||||
"duration": 646,
|
||||
"inputs": {
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"chance": 0.0,
|
||||
"tierChanceBoost": 0.0
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"item": "minecraft:ender_pearl"
|
||||
}
|
||||
},
|
||||
"chance": 0.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
]
|
||||
},
|
||||
"outputs": {
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 2,
|
||||
"ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
},
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 2,
|
||||
"ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
]
|
||||
},
|
||||
"tickInputs": {
|
||||
"eu": [
|
||||
{
|
||||
"content": 180,
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
],
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
]
|
||||
},
|
||||
"tickOutputs": {
|
||||
"item": [
|
||||
{
|
||||
"content": {
|
||||
"type": "gtceu:sized",
|
||||
"count": 1,
|
||||
"ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
},
|
||||
"chance": 1.0,
|
||||
"tierChanceBoost": 0.0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@ public class LootUnificationTests {
|
|||
ItemStack pickaxe = new ItemStack(Items.DIAMOND_PICKAXE);
|
||||
|
||||
ArrayList<BlockPos> positions = BlockPos
|
||||
.betweenClosedStream(new BlockPos(0, 2, 0), new BlockPos(2, 10, 2))
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
.betweenClosedStream(new BlockPos(0, 2, 0), new BlockPos(2, 10, 2))
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
|
||||
testDrop(helper, player, pickaxe, positions.removeFirst(), "testmod:osmium_ore", "testmod:osmium_ingot");
|
||||
testDrop(helper, player, pickaxe, positions.removeFirst(), "meka_fake:osmium_ore", "testmod:osmium_ingot");
|
||||
|
@ -55,11 +55,11 @@ public class LootUnificationTests {
|
|||
Block oreBlock = getBlock(oreId);
|
||||
helper.setBlock(orePos, oreBlock.defaultBlockState());
|
||||
List<ItemStack> drops = Block.getDrops(helper.getBlockState(orePos),
|
||||
helper.getLevel(),
|
||||
orePos,
|
||||
null,
|
||||
player,
|
||||
tool);
|
||||
helper.getLevel(),
|
||||
orePos,
|
||||
null,
|
||||
player,
|
||||
tool);
|
||||
assertEquals(1, drops.size());
|
||||
var result = drops.getFirst().getItem();
|
||||
var resultId = BuiltInRegistries.ITEM.getKey(result);
|
||||
|
|
|
@ -11,18 +11,18 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
public class ReplacementsTests {
|
||||
|
||||
private static final JsonObject INFLATE_PLACEHOLDERS = JsonUtils.readFromString("""
|
||||
{
|
||||
"type": [
|
||||
"gems",
|
||||
"rods",
|
||||
"raw_materials"
|
||||
],
|
||||
"material": [
|
||||
"iron",
|
||||
"gold"
|
||||
]
|
||||
}
|
||||
""", JsonObject.class);
|
||||
{
|
||||
"type": [
|
||||
"gems",
|
||||
"rods",
|
||||
"raw_materials"
|
||||
],
|
||||
"material": [
|
||||
"iron",
|
||||
"gold"
|
||||
]
|
||||
}
|
||||
""", JsonObject.class);
|
||||
|
||||
@SimpleGameTest
|
||||
public void testInflate() {
|
||||
|
|
|
@ -10,49 +10,49 @@ public class ShapedRecipeUnifierTests {
|
|||
@SimpleGameTest
|
||||
public void test() {
|
||||
assertUnify(ShapedRecipeUnifier.INSTANCE, """
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "equipment",
|
||||
"key": {
|
||||
"#": {
|
||||
"item": "minecraft:stick"
|
||||
},
|
||||
"X": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
},
|
||||
"pattern": [
|
||||
"XXX",
|
||||
" # ",
|
||||
" # "
|
||||
],
|
||||
"result": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"show_notification": true
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "equipment",
|
||||
"key": {
|
||||
"#": {
|
||||
"item": "minecraft:stick"
|
||||
},
|
||||
"X": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "equipment",
|
||||
"key": {
|
||||
"#": {
|
||||
"item": "minecraft:stick"
|
||||
},
|
||||
"X": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"pattern": [
|
||||
"XXX",
|
||||
" # ",
|
||||
" # "
|
||||
],
|
||||
"result": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"show_notification": true
|
||||
},
|
||||
"pattern": [
|
||||
"XXX",
|
||||
" # ",
|
||||
" # "
|
||||
],
|
||||
"result": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"show_notification": true
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "equipment",
|
||||
"key": {
|
||||
"#": {
|
||||
"item": "minecraft:stick"
|
||||
},
|
||||
"X": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
""");
|
||||
},
|
||||
"pattern": [
|
||||
"XXX",
|
||||
" # ",
|
||||
" # "
|
||||
],
|
||||
"result": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"show_notification": true
|
||||
}
|
||||
""");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,68 +13,68 @@ public class SmithingRecipeUnifierTest {
|
|||
@SimpleGameTest
|
||||
public void testTrim() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "minecraft:smithing_trim",
|
||||
"addition": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"base": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"template": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "minecraft:smithing_trim",
|
||||
"addition": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"base": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"template": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
}
|
||||
""");
|
||||
{
|
||||
"type": "minecraft:smithing_trim",
|
||||
"addition": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"base": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"template": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "minecraft:smithing_trim",
|
||||
"addition": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"base": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"template": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testTransform() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "minecraft:smithing_transform",
|
||||
"addition": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"base": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"result": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"template": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "minecraft:smithing_transform",
|
||||
"addition": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"base": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"result": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"template": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
}
|
||||
""");
|
||||
{
|
||||
"type": "minecraft:smithing_transform",
|
||||
"addition": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"base": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"result": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"template": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "minecraft:smithing_transform",
|
||||
"addition": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"base": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"result": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"template": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,91 +21,91 @@ public class UnificationHandlerTests {
|
|||
|
||||
private UnificationLookup createHandler(ModPriorities modPriorities) {
|
||||
return new UnificationLookupImpl.Builder()
|
||||
.put(TestUtils.itemTag("testmod:ingots/osmium"),
|
||||
ResourceLocation.parse("minecraft:osmium_ingot"),
|
||||
ResourceLocation.parse("mekanism:osmium_ingot"),
|
||||
ResourceLocation.parse("thermal:osmium_ingot"))
|
||||
.put(TestUtils.itemTag("testmod:ingots/cobalt"),
|
||||
ResourceLocation.parse("minecraft:cobalt_ingot"),
|
||||
ResourceLocation.parse("thermal:cobalt_ingot"))
|
||||
.put(TestUtils.itemTag("testmod:ingots/electrum"),
|
||||
ResourceLocation.parse("mekanism:electrum_ingot"),
|
||||
ResourceLocation.parse("create:electrum_ingot"),
|
||||
ResourceLocation.parse("thermal:electrum_ingot"))
|
||||
.build(modPriorities, TestUtils.EMPTY_STONE_VARIANTS, TestUtils.EMPTY_TAG_SUBSTITUTIONS);
|
||||
.put(TestUtils.itemTag("testmod:ingots/osmium"),
|
||||
ResourceLocation.parse("minecraft:osmium_ingot"),
|
||||
ResourceLocation.parse("mekanism:osmium_ingot"),
|
||||
ResourceLocation.parse("thermal:osmium_ingot"))
|
||||
.put(TestUtils.itemTag("testmod:ingots/cobalt"),
|
||||
ResourceLocation.parse("minecraft:cobalt_ingot"),
|
||||
ResourceLocation.parse("thermal:cobalt_ingot"))
|
||||
.put(TestUtils.itemTag("testmod:ingots/electrum"),
|
||||
ResourceLocation.parse("mekanism:electrum_ingot"),
|
||||
ResourceLocation.parse("create:electrum_ingot"),
|
||||
ResourceLocation.parse("thermal:electrum_ingot"))
|
||||
.build(modPriorities, TestUtils.EMPTY_STONE_VARIANTS, TestUtils.EMPTY_TAG_SUBSTITUTIONS);
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testTagTargetItem() {
|
||||
ArrayList<String> modList = new ArrayList<>(List.of("ae2", "mekanism", "thermal", "create"));
|
||||
ModPrioritiesImpl modPriorities = new ModPrioritiesImpl(
|
||||
modList,
|
||||
new HashMap<>()
|
||||
modList,
|
||||
new HashMap<>()
|
||||
);
|
||||
|
||||
var rm = createHandler(modPriorities);
|
||||
|
||||
|
||||
assertEquals(ResourceLocation.parse("mekanism:osmium_ingot"),
|
||||
rm.getTagTargetItem(TestUtils.itemTag("testmod:ingots/osmium")).id(),
|
||||
"Osmium ingot from mekanism should be target");
|
||||
rm.getTagTargetItem(TestUtils.itemTag("testmod:ingots/osmium")).id(),
|
||||
"Osmium ingot from mekanism should be target");
|
||||
|
||||
assertNull(rm.getTagTargetItem(TestUtils.itemTag("testmod:not_exist/osmium")),
|
||||
"Tag not found should return null");
|
||||
"Tag not found should return null");
|
||||
|
||||
assertEquals(ResourceLocation.parse("thermal:cobalt_ingot"),
|
||||
rm.getTagTargetItem(TestUtils.itemTag("testmod:ingots/cobalt")).id(),
|
||||
"Cobalt ingot from mekanism should be target");
|
||||
rm.getTagTargetItem(TestUtils.itemTag("testmod:ingots/cobalt")).id(),
|
||||
"Cobalt ingot from mekanism should be target");
|
||||
|
||||
assertNull(rm.getTagTargetItem(TestUtils.itemTag("testmod:not_exist/cobalt")),
|
||||
"Tag not found should return null");
|
||||
"Tag not found should return null");
|
||||
|
||||
// Now we remove mekanism from modList.
|
||||
// After that `getTagTargetItem` should return the thermal ingot, as AE2 still does not have one.
|
||||
modList.remove("mekanism");
|
||||
assertEquals(ResourceLocation.parse("thermal:osmium_ingot"),
|
||||
rm.getTagTargetItem(TestUtils.itemTag("testmod:ingots/osmium")).id(),
|
||||
"Osmium ingot from thermal should now be target");
|
||||
rm.getTagTargetItem(TestUtils.itemTag("testmod:ingots/osmium")).id(),
|
||||
"Osmium ingot from thermal should now be target");
|
||||
assertEquals(ResourceLocation.parse("thermal:cobalt_ingot"),
|
||||
rm.getTagTargetItem(TestUtils.itemTag("testmod:ingots/cobalt")).id(),
|
||||
"Cobalt ingot from thermal should be target");
|
||||
rm.getTagTargetItem(TestUtils.itemTag("testmod:ingots/cobalt")).id(),
|
||||
"Cobalt ingot from thermal should be target");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testTagTargetItemWithOverride() {
|
||||
ModPrioritiesImpl modPriorities = new ModPrioritiesImpl(
|
||||
List.of("ae2", "mekanism", "thermal", "create"),
|
||||
Util.make(new HashMap<>(),
|
||||
m -> m.put(TestUtils.itemTag("testmod:ingots/electrum"), "create"))
|
||||
List.of("ae2", "mekanism", "thermal", "create"),
|
||||
Util.make(new HashMap<>(),
|
||||
m -> m.put(TestUtils.itemTag("testmod:ingots/electrum"), "create"))
|
||||
);
|
||||
|
||||
var rm = createHandler(modPriorities);
|
||||
|
||||
assertEquals(ResourceLocation.parse("create:electrum_ingot"),
|
||||
rm.getTagTargetItem(TestUtils.itemTag("testmod:ingots/electrum")).id(),
|
||||
"Electrum ingot from create should be target as it is overridden by priorities");
|
||||
rm.getTagTargetItem(TestUtils.itemTag("testmod:ingots/electrum")).id(),
|
||||
"Electrum ingot from create should be target as it is overridden by priorities");
|
||||
|
||||
// but for osmium it's the default behavior
|
||||
assertEquals(ResourceLocation.parse("mekanism:osmium_ingot"),
|
||||
rm.getTagTargetItem(TestUtils.itemTag("testmod:ingots/osmium")).id(),
|
||||
"Osmium ingot from mekanism should be target");
|
||||
rm.getTagTargetItem(TestUtils.itemTag("testmod:ingots/osmium")).id(),
|
||||
"Osmium ingot from mekanism should be target");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testRelevantItemTag() {
|
||||
ModPrioritiesImpl modPriorities = new ModPrioritiesImpl(
|
||||
List.of("ae2", "mekanism", "thermal", "create"),
|
||||
new HashMap<>()
|
||||
List.of("ae2", "mekanism", "thermal", "create"),
|
||||
new HashMap<>()
|
||||
);
|
||||
|
||||
var rm = createHandler(modPriorities);
|
||||
|
||||
assertEquals(TestUtils.itemTag("testmod:ingots/osmium"),
|
||||
rm.getRelevantItemTag(ResourceLocation.parse("mekanism:osmium_ingot")));
|
||||
rm.getRelevantItemTag(ResourceLocation.parse("mekanism:osmium_ingot")));
|
||||
assertEquals(TestUtils.itemTag("testmod:ingots/cobalt"),
|
||||
rm.getRelevantItemTag(ResourceLocation.parse("thermal:cobalt_ingot")));
|
||||
rm.getRelevantItemTag(ResourceLocation.parse("thermal:cobalt_ingot")));
|
||||
assertEquals(TestUtils.itemTag("testmod:ingots/electrum"),
|
||||
rm.getRelevantItemTag(ResourceLocation.parse("create:electrum_ingot")));
|
||||
rm.getRelevantItemTag(ResourceLocation.parse("create:electrum_ingot")));
|
||||
|
||||
assertNull(rm.getRelevantItemTag(ResourceLocation.parse("not_existing_mod:osmium_ingot")));
|
||||
}
|
||||
|
@ -113,48 +113,48 @@ public class UnificationHandlerTests {
|
|||
@SimpleGameTest
|
||||
public void testReplacementForItem() {
|
||||
ModPrioritiesImpl modPriorities = new ModPrioritiesImpl(
|
||||
List.of("ae2", "mekanism", "thermal", "create"),
|
||||
new HashMap<>()
|
||||
List.of("ae2", "mekanism", "thermal", "create"),
|
||||
new HashMap<>()
|
||||
);
|
||||
|
||||
var rm = createHandler(modPriorities);
|
||||
|
||||
assertEquals(ResourceLocation.parse("mekanism:osmium_ingot"),
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("mekanism:osmium_ingot")).id());
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("mekanism:osmium_ingot")).id());
|
||||
assertEquals(ResourceLocation.parse("mekanism:osmium_ingot"),
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("minecraft:osmium_ingot")).id());
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("minecraft:osmium_ingot")).id());
|
||||
assertEquals(ResourceLocation.parse("mekanism:osmium_ingot"),
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("thermal:osmium_ingot")).id());
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("thermal:osmium_ingot")).id());
|
||||
|
||||
assertEquals(ResourceLocation.parse("thermal:cobalt_ingot"),
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("thermal:cobalt_ingot")).id());
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("thermal:cobalt_ingot")).id());
|
||||
assertEquals(ResourceLocation.parse("thermal:cobalt_ingot"),
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("minecraft:cobalt_ingot")).id());
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("minecraft:cobalt_ingot")).id());
|
||||
|
||||
assertEquals(ResourceLocation.parse("mekanism:electrum_ingot"),
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("create:electrum_ingot")).id());
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("create:electrum_ingot")).id());
|
||||
assertEquals(ResourceLocation.parse("mekanism:electrum_ingot"),
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("mekanism:electrum_ingot")).id());
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("mekanism:electrum_ingot")).id());
|
||||
assertEquals(ResourceLocation.parse("mekanism:electrum_ingot"),
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("thermal:electrum_ingot")).id());
|
||||
rm.getVariantItemTarget(ResourceLocation.parse("thermal:electrum_ingot")).id());
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testItemInUnifiedIngredient() {
|
||||
var rm = new UnificationLookupImpl.Builder()
|
||||
.put(TestUtils.itemTag("c:tools"), Items.IRON_SWORD, Items.IRON_PICKAXE, Items.IRON_SHOVEL)
|
||||
.build(TestUtils.EMPTY_MOD_PRIORITIES,
|
||||
TestUtils.EMPTY_STONE_VARIANTS,
|
||||
TestUtils.EMPTY_TAG_SUBSTITUTIONS
|
||||
);
|
||||
.put(TestUtils.itemTag("c:tools"), Items.IRON_SWORD, Items.IRON_PICKAXE, Items.IRON_SHOVEL)
|
||||
.build(TestUtils.EMPTY_MOD_PRIORITIES,
|
||||
TestUtils.EMPTY_STONE_VARIANTS,
|
||||
TestUtils.EMPTY_TAG_SUBSTITUTIONS
|
||||
);
|
||||
|
||||
Ingredient ingredient = Ingredient.of(Items.IRON_SWORD);
|
||||
|
||||
// Shovel is part of `minecraft:tools` and part of our created tag map
|
||||
assertTrue(rm.isUnifiedIngredientItem(ingredient, Items.IRON_SHOVEL.getDefaultInstance()),
|
||||
"SHOVEL is in our created tag map");
|
||||
"SHOVEL is in our created tag map");
|
||||
|
||||
assertFalse(rm.isUnifiedIngredientItem(ingredient, Items.CARROT.getDefaultInstance()),
|
||||
"CARROT is not part of `minecraft:tools`");
|
||||
"CARROT is not part of `minecraft:tools`");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,14 +22,14 @@ public class UnifyTests {
|
|||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
||||
public static final ModPriorities MOD_PRIORITIES = new ModPrioritiesImpl(List.of("minecraft",
|
||||
"mekanism",
|
||||
"thermal",
|
||||
"create"), new HashMap<>());
|
||||
"mekanism",
|
||||
"thermal",
|
||||
"create"), new HashMap<>());
|
||||
|
||||
public static UnificationLookup unificationLookup() {
|
||||
return new UnificationLookupImpl.Builder()
|
||||
.put(itemTag("testmod:ingots/iron"), Items.IRON_INGOT)
|
||||
.build(MOD_PRIORITIES, EMPTY_STONE_VARIANTS, EMPTY_TAG_SUBSTITUTIONS);
|
||||
.put(itemTag("testmod:ingots/iron"), Items.IRON_INGOT)
|
||||
.build(MOD_PRIORITIES, EMPTY_STONE_VARIANTS, EMPTY_TAG_SUBSTITUTIONS);
|
||||
}
|
||||
|
||||
private static JsonObject json(String str) {
|
||||
|
@ -40,28 +40,28 @@ public class UnifyTests {
|
|||
public void test() {
|
||||
var rm = unificationLookup();
|
||||
var recipe = json("""
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "equipment",
|
||||
"key": {
|
||||
"#": {
|
||||
"item": "minecraft:stick"
|
||||
},
|
||||
"X": {
|
||||
"item": "minecraft:iron_ingot"
|
||||
}
|
||||
},
|
||||
"pattern": [
|
||||
"X",
|
||||
"#",
|
||||
"#"
|
||||
],
|
||||
"result": {
|
||||
"item": "minecraft:iron_shovel"
|
||||
},
|
||||
"show_notification": true
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "equipment",
|
||||
"key": {
|
||||
"#": {
|
||||
"item": "minecraft:stick"
|
||||
},
|
||||
"X": {
|
||||
"item": "minecraft:iron_ingot"
|
||||
}
|
||||
""");
|
||||
},
|
||||
"pattern": [
|
||||
"X",
|
||||
"#",
|
||||
"#"
|
||||
],
|
||||
"result": {
|
||||
"item": "minecraft:iron_shovel"
|
||||
},
|
||||
"show_notification": true
|
||||
}
|
||||
""");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ public class AlmostUnifiedFabric implements ModInitializer {
|
|||
public void onInitialize() {
|
||||
if (!AlmostUnifiedCommon.STARTUP_CONFIG.isServerOnly()) {
|
||||
Registry.register(
|
||||
BuiltInRegistries.RECIPE_SERIALIZER,
|
||||
ClientRecipeTracker.ID,
|
||||
ClientRecipeTracker.SERIALIZER
|
||||
BuiltInRegistries.RECIPE_SERIALIZER,
|
||||
ClientRecipeTracker.ID,
|
||||
ClientRecipeTracker.SERIALIZER
|
||||
);
|
||||
Registry.register(BuiltInRegistries.RECIPE_TYPE, ClientRecipeTracker.ID, ClientRecipeTracker.TYPE);
|
||||
}
|
||||
|
@ -31,16 +31,16 @@ public class AlmostUnifiedFabric implements ModInitializer {
|
|||
private static void initializePluginManager() {
|
||||
List<AlmostUnifiedPlugin> plugins = new ArrayList<>();
|
||||
var entrypointContainers = FabricLoader.getInstance()
|
||||
.getEntrypointContainers(ModConstants.ALMOST_UNIFIED, AlmostUnifiedPlugin.class);
|
||||
.getEntrypointContainers(ModConstants.ALMOST_UNIFIED, AlmostUnifiedPlugin.class);
|
||||
|
||||
for (var entrypointContainer : entrypointContainers) {
|
||||
try {
|
||||
plugins.add(entrypointContainer.getEntrypoint());
|
||||
} catch (Exception e) {
|
||||
AlmostUnifiedCommon.LOGGER.error(
|
||||
"Failed to load plugin for mod {}.",
|
||||
entrypointContainer.getProvider().getMetadata().getName(),
|
||||
e
|
||||
"Failed to load plugin for mod {}.",
|
||||
entrypointContainer.getProvider().getMetadata().getName(),
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,10 +33,10 @@ public class AlmostUnifiedPlatformFabric implements AlmostUnifiedPlatform {
|
|||
@Override
|
||||
public Path getDebugLogPath() {
|
||||
return FabricLoader
|
||||
.getInstance()
|
||||
.getGameDir()
|
||||
.resolve("logs")
|
||||
.resolve(ModConstants.ALMOST_UNIFIED)
|
||||
.resolve("debug");
|
||||
.getInstance()
|
||||
.getGameDir()
|
||||
.resolve("logs")
|
||||
.resolve(ModConstants.ALMOST_UNIFIED)
|
||||
.resolve("debug");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,20 +11,20 @@ public class AmethystImbuementRecipeUnifier implements RecipeUnifier {
|
|||
GenericRecipeUnifier.INSTANCE.unify(helper, recipe);
|
||||
|
||||
helper.unifyInputs(
|
||||
recipe,
|
||||
"imbueA",
|
||||
"imbueB",
|
||||
"imbueC",
|
||||
"imbueD",
|
||||
"craftA",
|
||||
"craftB",
|
||||
"craftC",
|
||||
"craftD",
|
||||
"craftE",
|
||||
"craftF",
|
||||
"craftG",
|
||||
"craftH",
|
||||
"craftI"
|
||||
recipe,
|
||||
"imbueA",
|
||||
"imbueB",
|
||||
"imbueC",
|
||||
"imbueD",
|
||||
"craftA",
|
||||
"craftB",
|
||||
"craftC",
|
||||
"craftD",
|
||||
"craftE",
|
||||
"craftF",
|
||||
"craftG",
|
||||
"craftH",
|
||||
"craftI"
|
||||
);
|
||||
|
||||
helper.unifyOutputs(recipe, "resultA");
|
||||
|
|
|
@ -12,99 +12,99 @@ public class AmethystImbuementRecipeUnifierTests {
|
|||
@SimpleGameTest
|
||||
public void testImbuing() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "amethyst_imbuement:imbuing",
|
||||
"imbueA": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"imbueB": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"imbueC": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"imbueD": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftA": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftB": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftC": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftD": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftE": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftF": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftG": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftH": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftI": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"title": "Witches Orb",
|
||||
"cost": 19,
|
||||
"resultA": "minecraft:test_item",
|
||||
"countA": 1
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "amethyst_imbuement:imbuing",
|
||||
"imbueA": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"imbueB": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"imbueC": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"imbueD": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftA": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftB": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftC": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftD": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftE": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftF": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftG": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftH": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftI": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"title": "Witches Orb",
|
||||
"cost": 19,
|
||||
"resultA": "testmod:test_item",
|
||||
"countA": 1
|
||||
}
|
||||
""");
|
||||
{
|
||||
"type": "amethyst_imbuement:imbuing",
|
||||
"imbueA": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"imbueB": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"imbueC": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"imbueD": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftA": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftB": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftC": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftD": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftE": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftF": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftG": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftH": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"craftI": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"title": "Witches Orb",
|
||||
"cost": 19,
|
||||
"resultA": "minecraft:test_item",
|
||||
"countA": 1
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "amethyst_imbuement:imbuing",
|
||||
"imbueA": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"imbueB": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"imbueC": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"imbueD": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftA": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftB": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftC": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftD": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftE": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftF": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftG": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftH": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"craftI": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"title": "Witches Orb",
|
||||
"cost": 19,
|
||||
"resultA": "testmod:test_item",
|
||||
"countA": 1
|
||||
}
|
||||
""");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,9 +38,9 @@ public class AlmostUnifiedNeoForge {
|
|||
private void onRegisterEvent(RegisterEvent event) {
|
||||
if (event.getRegistryKey() == NeoForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS) {
|
||||
Registry.register(
|
||||
NeoForgeRegistries.BIOME_MODIFIER_SERIALIZERS,
|
||||
Utils.getRL("worldgen_unification"),
|
||||
WorldGenBiomeModifier.CODEC
|
||||
NeoForgeRegistries.BIOME_MODIFIER_SERIALIZERS,
|
||||
Utils.getRL("worldgen_unification"),
|
||||
WorldGenBiomeModifier.CODEC
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -48,9 +48,9 @@ public class AlmostUnifiedNeoForge {
|
|||
|
||||
if (event.getRegistryKey() == Registries.RECIPE_SERIALIZER) {
|
||||
Registry.register(
|
||||
BuiltInRegistries.RECIPE_SERIALIZER,
|
||||
ClientRecipeTracker.ID,
|
||||
ClientRecipeTracker.SERIALIZER
|
||||
BuiltInRegistries.RECIPE_SERIALIZER,
|
||||
ClientRecipeTracker.ID,
|
||||
ClientRecipeTracker.SERIALIZER
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -112,9 +112,9 @@ public class AlmostUnifiedNeoForge {
|
|||
}
|
||||
|
||||
AlmostUnifiedCommon.LOGGER.error(
|
||||
"Plugin {} does not implement {}.",
|
||||
className,
|
||||
AlmostUnifiedPlugin.class.getName()
|
||||
"Plugin {} does not implement {}.",
|
||||
className,
|
||||
AlmostUnifiedPlugin.class.getName()
|
||||
);
|
||||
} catch (ClassNotFoundException e) {
|
||||
AlmostUnifiedCommon.LOGGER.error("Failed to load plugin {}.", className, e);
|
||||
|
|
|
@ -24,22 +24,22 @@ public class ImmersiveEngineeringRecipeUnifier implements RecipeUnifier {
|
|||
GenericRecipeUnifier.INSTANCE.unify(helper, recipe);
|
||||
|
||||
List.of(
|
||||
// alloy recipes, refinery
|
||||
INPUT_0,
|
||||
INPUT_1,
|
||||
// arc furnace, squeezer, cloche, coke oven, fermenter, fertilizer, metal_press
|
||||
RecipeConstants.INPUT,
|
||||
// arc furnace
|
||||
ADDITIVES,
|
||||
// refinery
|
||||
RecipeConstants.CATALYST
|
||||
// alloy recipes, refinery
|
||||
INPUT_0,
|
||||
INPUT_1,
|
||||
// arc furnace, squeezer, cloche, coke oven, fermenter, fertilizer, metal_press
|
||||
RecipeConstants.INPUT,
|
||||
// arc furnace
|
||||
ADDITIVES,
|
||||
// refinery
|
||||
RecipeConstants.CATALYST
|
||||
).forEach(key -> unifyInputs(helper, recipe, key));
|
||||
|
||||
List.of(
|
||||
RecipeConstants.RESULT,
|
||||
RecipeConstants.RESULTS,
|
||||
// arc furnace
|
||||
SLAG
|
||||
RecipeConstants.RESULT,
|
||||
RecipeConstants.RESULTS,
|
||||
// arc furnace
|
||||
SLAG
|
||||
).forEach(key -> helper.unifyOutputs(recipe, key, true, RecipeConstants.ITEM, BASE_INGREDIENT));
|
||||
|
||||
unifySecondaries(helper, recipe);
|
||||
|
|
|
@ -19,14 +19,14 @@ public final class AlmostUnifiedCommands {
|
|||
|
||||
public static void registerCommands(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||
var radiusArgument = Commands.argument(RADIUS, IntegerArgumentType.integer(0, 16 * 8))
|
||||
.executes(AlmostUnifiedCommands::onStripCommand);
|
||||
.executes(AlmostUnifiedCommands::onStripCommand);
|
||||
var stripSubCommand = Commands.literal("strip")
|
||||
.requires(source -> source.hasPermission(2))
|
||||
.then(radiusArgument)
|
||||
.executes(AlmostUnifiedCommands::onStripCommand);
|
||||
.requires(source -> source.hasPermission(2))
|
||||
.then(radiusArgument)
|
||||
.executes(AlmostUnifiedCommands::onStripCommand);
|
||||
var mainCommand = Commands.literal(ModConstants.ALMOST_UNIFIED)
|
||||
.then(stripSubCommand)
|
||||
.executes(AlmostUnifiedCommands::onHelpCommand);
|
||||
.then(stripSubCommand)
|
||||
.executes(AlmostUnifiedCommands::onHelpCommand);
|
||||
|
||||
dispatcher.register(mainCommand);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public final class AlmostUnifiedCommands {
|
|||
WorldStripper.stripWorld(player, level, radius);
|
||||
} catch (Exception e) {
|
||||
context.getSource().sendFailure(
|
||||
Component.literal("Please provide a valid radius!").withStyle(ChatFormatting.DARK_RED)
|
||||
Component.literal("Please provide a valid radius!").withStyle(ChatFormatting.DARK_RED)
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ public class NeoForgePlugin implements AlmostUnifiedPlugin {
|
|||
@Override
|
||||
public void registerRecipeUnifiers(RecipeUnifierRegistry registry) {
|
||||
List.of(
|
||||
ModConstants.ARS_CREO,
|
||||
ModConstants.ARS_ELEMENTAL,
|
||||
ModConstants.ARS_NOUVEAU,
|
||||
ModConstants.ARS_SCALAES
|
||||
ModConstants.ARS_CREO,
|
||||
ModConstants.ARS_ELEMENTAL,
|
||||
ModConstants.ARS_NOUVEAU,
|
||||
ModConstants.ARS_SCALAES
|
||||
).forEach(modId -> registry.registerForModId(modId, new ArsNouveauRecipeUnifier()));
|
||||
registry.registerForModId(ModConstants.CYCLIC, new CyclicRecipeUnifier());
|
||||
registry.registerForModId(ModConstants.ENDER_IO, new EnderIORecipeUnifier());
|
||||
|
@ -37,8 +37,8 @@ public class NeoForgePlugin implements AlmostUnifiedPlugin {
|
|||
registry.registerForModId(ModConstants.PRODUCTIVE_TREES, new ProductiveTreesRecipeUnifier());
|
||||
registry.registerForModId(ModConstants.THEURGY, new TheurgyRecipeUnifier());
|
||||
registry.registerForRecipeType(
|
||||
ResourceLocation.fromNamespaceAndPath(ModConstants.THEURGY, "divination_rod"),
|
||||
ShapedRecipeUnifier.INSTANCE
|
||||
ResourceLocation.fromNamespaceAndPath(ModConstants.THEURGY, "divination_rod"),
|
||||
ShapedRecipeUnifier.INSTANCE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,13 +62,13 @@ public class WorldGenBiomeModifier implements BiomeModifier {
|
|||
|
||||
if (!removedFeatures.isEmpty()) {
|
||||
AlmostUnifiedCommon.LOGGER.info("[WorldGen] Removed features from Biome {}:",
|
||||
biome.unwrapKey().map(ResourceKey::location).orElse(UNKNOWN_BIOME_ID));
|
||||
biome.unwrapKey().map(ResourceKey::location).orElse(UNKNOWN_BIOME_ID));
|
||||
removedFeatures.forEach((decoration, features) -> {
|
||||
String ids = features
|
||||
.stream()
|
||||
.flatMap(f -> f.unwrapKey().map(ResourceKey::location).stream())
|
||||
.map(ResourceLocation::toString)
|
||||
.collect(Collectors.joining(", "));
|
||||
.stream()
|
||||
.flatMap(f -> f.unwrapKey().map(ResourceKey::location).stream())
|
||||
.map(ResourceLocation::toString)
|
||||
.collect(Collectors.joining(", "));
|
||||
|
||||
AlmostUnifiedCommon.LOGGER.info("[WorldGen]\t{}: {}", decoration.getName(), ids);
|
||||
});
|
||||
|
|
|
@ -40,12 +40,12 @@ public class WorldGenUnifier {
|
|||
}
|
||||
case REMOVE -> {
|
||||
AlmostUnifiedCommon.LOGGER.info("[WorldGen] Mark ConfiguredFeature '{}' for removal:",
|
||||
holder.unwrapKey().map(ResourceKey::location).orElse(UNKNOWN_FEATURE_ID));
|
||||
holder.unwrapKey().map(ResourceKey::location).orElse(UNKNOWN_FEATURE_ID));
|
||||
featuresToRemove.add(holder);
|
||||
}
|
||||
case CHANGE -> {
|
||||
AlmostUnifiedCommon.LOGGER.info("[WorldGen] Changed ConfiguredFeature '{}':",
|
||||
holder.unwrapKey().map(ResourceKey::location).orElse(UNKNOWN_FEATURE_ID));
|
||||
holder.unwrapKey().map(ResourceKey::location).orElse(UNKNOWN_FEATURE_ID));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -91,9 +91,9 @@ public class WorldGenUnifier {
|
|||
Block replacementBlock = BuiltInRegistries.BLOCK.getOptional(replacement.id()).orElse(null);
|
||||
if (replacementBlock == null) {
|
||||
AlmostUnifiedCommon.LOGGER.error(
|
||||
"Trying to find replacement for block {} (Replacement: {}), but it does not exist.",
|
||||
blockId,
|
||||
replacement.id());
|
||||
"Trying to find replacement for block {} (Replacement: {}), but it does not exist.",
|
||||
blockId,
|
||||
replacement.id());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,9 +39,9 @@ public final class WorldStripper {
|
|||
|
||||
@SuppressWarnings("SimplifyStreamApiCallChains")
|
||||
var blockIterator = BlockPos.betweenClosedStream(min, max)
|
||||
.map(pos -> blockInWorld(level, pos))
|
||||
.collect(Collectors.toList())
|
||||
.iterator();
|
||||
.map(pos -> blockInWorld(level, pos))
|
||||
.collect(Collectors.toList())
|
||||
.iterator();
|
||||
|
||||
WORKER = new Worker(level, blockIterator);
|
||||
}
|
||||
|
@ -85,9 +85,9 @@ public final class WorldStripper {
|
|||
block.getEntity() != null ||
|
||||
state.getBlock() instanceof DropExperienceBlock ||
|
||||
BuiltInRegistries.BLOCK
|
||||
.wrapAsHolder(state.getBlock())
|
||||
.tags()
|
||||
.anyMatch(t -> t.location().toString().startsWith("c:ores")));
|
||||
.wrapAsHolder(state.getBlock())
|
||||
.tags()
|
||||
.anyMatch(t -> t.location().toString().startsWith("c:ores")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ public class NeoForgeTest {
|
|||
public NeoForgeTest(IEventBus bus) {
|
||||
CommonTest.init(GameTestHooks.isGametestEnabled());
|
||||
GameTestLoader.registerProviders(ArsNouveauRecipeTests.class,
|
||||
MekanismRecipeUnifierTests.class,
|
||||
ModernIndustrializationRecipeUnifierTests.class,
|
||||
ImmersiveEngineeringRecipeUnifierTests.class,
|
||||
EnderIORecipeUnifierTests.class,
|
||||
IntegratedDynamicsRecipeUnifierTests.class);
|
||||
MekanismRecipeUnifierTests.class,
|
||||
ModernIndustrializationRecipeUnifierTests.class,
|
||||
ImmersiveEngineeringRecipeUnifierTests.class,
|
||||
EnderIORecipeUnifierTests.class,
|
||||
IntegratedDynamicsRecipeUnifierTests.class);
|
||||
|
||||
bus.addListener(this::onRegistry);
|
||||
}
|
||||
|
|
|
@ -12,148 +12,148 @@ public class ArsNouveauRecipeTests {
|
|||
@SimpleGameTest
|
||||
public void testPedestalItems() {
|
||||
TestUtils.assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "ars_nouveau:enchanting_apparatus",
|
||||
"keepNbtOfReagent": false,
|
||||
"output": {
|
||||
"item": "ars_nouveau:jar_of_light"
|
||||
},
|
||||
"pedestalItems": [
|
||||
{
|
||||
"type": "ars_nouveau:enchanting_apparatus",
|
||||
"keepNbtOfReagent": false,
|
||||
"output": {
|
||||
"item": "ars_nouveau:jar_of_light"
|
||||
},
|
||||
"pedestalItems": [
|
||||
{
|
||||
"item": "minecraft:glowstone"
|
||||
},
|
||||
{
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
{
|
||||
"tag": "c:glass"
|
||||
}
|
||||
],
|
||||
"reagent": [
|
||||
{
|
||||
"item": "minecraft:glass_bottle"
|
||||
}
|
||||
],
|
||||
"sourceCost": 0
|
||||
}
|
||||
""", """
|
||||
"item": "minecraft:glowstone"
|
||||
},
|
||||
{
|
||||
"type": "ars_nouveau:enchanting_apparatus",
|
||||
"keepNbtOfReagent": false,
|
||||
"output": {
|
||||
"item": "ars_nouveau:jar_of_light"
|
||||
},
|
||||
"pedestalItems": [
|
||||
{
|
||||
"item": "minecraft:glowstone"
|
||||
},
|
||||
{
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
{
|
||||
"tag": "c:glass"
|
||||
}
|
||||
],
|
||||
"reagent": [
|
||||
{
|
||||
"item": "minecraft:glass_bottle"
|
||||
}
|
||||
],
|
||||
"sourceCost": 0
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
{
|
||||
"tag": "c:glass"
|
||||
}
|
||||
""");
|
||||
],
|
||||
"reagent": [
|
||||
{
|
||||
"item": "minecraft:glass_bottle"
|
||||
}
|
||||
],
|
||||
"sourceCost": 0
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "ars_nouveau:enchanting_apparatus",
|
||||
"keepNbtOfReagent": false,
|
||||
"output": {
|
||||
"item": "ars_nouveau:jar_of_light"
|
||||
},
|
||||
"pedestalItems": [
|
||||
{
|
||||
"item": "minecraft:glowstone"
|
||||
},
|
||||
{
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
{
|
||||
"tag": "c:glass"
|
||||
}
|
||||
],
|
||||
"reagent": [
|
||||
{
|
||||
"item": "minecraft:glass_bottle"
|
||||
}
|
||||
],
|
||||
"sourceCost": 0
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testPedestalItemsNested() {
|
||||
TestUtils.assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "ars_nouveau:reactive_enchantment",
|
||||
"pedestalItems": [
|
||||
{
|
||||
"type": "ars_nouveau:reactive_enchantment",
|
||||
"pedestalItems": [
|
||||
{
|
||||
"item": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
},
|
||||
{
|
||||
"item": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
},
|
||||
{
|
||||
"item": {
|
||||
"tag": "c:storage_blocks/source"
|
||||
}
|
||||
}
|
||||
],
|
||||
"sourceCost": 3000
|
||||
}
|
||||
""", """
|
||||
"item": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ars_nouveau:reactive_enchantment",
|
||||
"pedestalItems": [
|
||||
{
|
||||
"item": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
{
|
||||
"item": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
{
|
||||
"item": {
|
||||
"tag": "c:storage_blocks/source"
|
||||
}
|
||||
}
|
||||
],
|
||||
"sourceCost": 3000
|
||||
"item": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
},
|
||||
{
|
||||
"item": {
|
||||
"tag": "c:storage_blocks/source"
|
||||
}
|
||||
}
|
||||
""");
|
||||
],
|
||||
"sourceCost": 3000
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "ars_nouveau:reactive_enchantment",
|
||||
"pedestalItems": [
|
||||
{
|
||||
"item": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
{
|
||||
"item": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
{
|
||||
"item": {
|
||||
"tag": "c:storage_blocks/source"
|
||||
}
|
||||
}
|
||||
],
|
||||
"sourceCost": 3000
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
|
||||
@SimpleGameTest
|
||||
public void testInputItemsNested() {
|
||||
TestUtils.assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "ars_nouveau:glyph",
|
||||
"count": 1,
|
||||
"exp": 27,
|
||||
"inputItems": [
|
||||
{
|
||||
"type": "ars_nouveau:glyph",
|
||||
"count": 1,
|
||||
"exp": 27,
|
||||
"inputItems": [
|
||||
{
|
||||
"item": {
|
||||
"item": "ars_nouveau:abjuration_essence"
|
||||
}
|
||||
},
|
||||
{
|
||||
"item": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
}
|
||||
],
|
||||
"output": "ars_nouveau:glyph_bounce"
|
||||
}
|
||||
""", """
|
||||
"item": {
|
||||
"item": "ars_nouveau:abjuration_essence"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ars_nouveau:glyph",
|
||||
"count": 1,
|
||||
"exp": 27,
|
||||
"inputItems": [
|
||||
{
|
||||
"item": {
|
||||
"item": "ars_nouveau:abjuration_essence"
|
||||
}
|
||||
},
|
||||
{
|
||||
"item": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
}
|
||||
],
|
||||
"output": "ars_nouveau:glyph_bounce"
|
||||
"item": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
}
|
||||
""");
|
||||
],
|
||||
"output": "ars_nouveau:glyph_bounce"
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "ars_nouveau:glyph",
|
||||
"count": 1,
|
||||
"exp": 27,
|
||||
"inputItems": [
|
||||
{
|
||||
"item": {
|
||||
"item": "ars_nouveau:abjuration_essence"
|
||||
}
|
||||
},
|
||||
{
|
||||
"item": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
}
|
||||
],
|
||||
"output": "ars_nouveau:glyph_bounce"
|
||||
}
|
||||
""");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,37 +14,37 @@ public class EnderIORecipeUnifierTests {
|
|||
@SimpleGameTest
|
||||
public void test() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "enderio:grinding_ball",
|
||||
"chance": 1.65,
|
||||
"durability": 40000,
|
||||
"grinding": 1.2,
|
||||
"item": "minecraft:test_item",
|
||||
"power": 0.8
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "enderio:grinding_ball",
|
||||
"chance": 1.65,
|
||||
"durability": 40000,
|
||||
"grinding": 1.2,
|
||||
"item": "testmod:test_item",
|
||||
"power": 0.8
|
||||
}
|
||||
""");
|
||||
{
|
||||
"type": "enderio:grinding_ball",
|
||||
"chance": 1.65,
|
||||
"durability": 40000,
|
||||
"grinding": 1.2,
|
||||
"item": "minecraft:test_item",
|
||||
"power": 0.8
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "enderio:grinding_ball",
|
||||
"chance": 1.65,
|
||||
"durability": 40000,
|
||||
"grinding": 1.2,
|
||||
"item": "testmod:test_item",
|
||||
"power": 0.8
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testNot() {
|
||||
assertNoUnify(UNIFIER, """
|
||||
{
|
||||
"type": "enderio:grinding_ball",
|
||||
"chance": 1.65,
|
||||
"durability": 40000,
|
||||
"grinding": 1.2,
|
||||
"item": "enderio:copper_alloy_grinding_ball",
|
||||
"power": 0.8
|
||||
}
|
||||
""");
|
||||
{
|
||||
"type": "enderio:grinding_ball",
|
||||
"chance": 1.65,
|
||||
"durability": 40000,
|
||||
"grinding": 1.2,
|
||||
"item": "enderio:copper_alloy_grinding_ball",
|
||||
"power": 0.8
|
||||
}
|
||||
""");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,355 +12,355 @@ public class ImmersiveEngineeringRecipeUnifierTests {
|
|||
@SimpleGameTest
|
||||
public void testAlloy() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "immersiveengineering:alloy",
|
||||
"input0": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"input1": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"result": {
|
||||
"base_ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"count": 2
|
||||
},
|
||||
"time": 200
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:alloy",
|
||||
"input0": {
|
||||
{
|
||||
"type": "immersiveengineering:alloy",
|
||||
"input0": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"input1": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"result": {
|
||||
"base_ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"input1": {
|
||||
"tag": "testmod:test_tag"
|
||||
"count": 2
|
||||
},
|
||||
"time": 200
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:alloy",
|
||||
"input0": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"input1": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"result": {
|
||||
"base_ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"result": {
|
||||
"base_ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"count": 2
|
||||
},
|
||||
"time": 200
|
||||
}
|
||||
""");
|
||||
"count": 2
|
||||
},
|
||||
"time": 200
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testRafinery() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "immersiveengineering:refinery",
|
||||
"catalyst": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"energy": 80,
|
||||
"input0": {
|
||||
"amount": 8,
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"input1": {
|
||||
"amount": 8,
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"result": {
|
||||
"amount": 16,
|
||||
"fluid": "immersiveengineering:biodiesel"
|
||||
}
|
||||
{
|
||||
"type": "immersiveengineering:refinery",
|
||||
"catalyst": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"energy": 80,
|
||||
"input0": {
|
||||
"amount": 8,
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"input1": {
|
||||
"amount": 8,
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"result": {
|
||||
"amount": 16,
|
||||
"fluid": "immersiveengineering:biodiesel"
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:refinery",
|
||||
"catalyst": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"energy": 80,
|
||||
"input0": {
|
||||
"amount": 8,
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"input1": {
|
||||
"amount": 8,
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"result": {
|
||||
"amount": 16,
|
||||
"fluid": "immersiveengineering:biodiesel"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:refinery",
|
||||
"catalyst": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"energy": 80,
|
||||
"input0": {
|
||||
"amount": 8,
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"input1": {
|
||||
"amount": 8,
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"result": {
|
||||
"amount": 16,
|
||||
"fluid": "immersiveengineering:biodiesel"
|
||||
}
|
||||
""");
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testArcFurnace() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "immersiveengineering:arc_furnace",
|
||||
"additives": [
|
||||
{
|
||||
{
|
||||
"type": "immersiveengineering:arc_furnace",
|
||||
"additives": [
|
||||
{
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
],
|
||||
"energy": 51200,
|
||||
"input": {
|
||||
"base_ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"count": 2
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"base_ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"count": 3
|
||||
}
|
||||
],
|
||||
"time": 100
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:arc_furnace",
|
||||
"additives": [
|
||||
{
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
],
|
||||
"energy": 51200,
|
||||
"input": {
|
||||
"base_ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"count": 2
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"base_ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
],
|
||||
"energy": 51200,
|
||||
"input": {
|
||||
"base_ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"count": 2
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"base_ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"count": 3
|
||||
}
|
||||
],
|
||||
"time": 100
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:arc_furnace",
|
||||
"additives": [
|
||||
{
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
],
|
||||
"energy": 51200,
|
||||
"input": {
|
||||
"base_ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"count": 2
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"base_ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"count": 3
|
||||
}
|
||||
],
|
||||
"time": 100
|
||||
}
|
||||
""");
|
||||
"count": 3
|
||||
}
|
||||
],
|
||||
"time": 100
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testArcFurnaceSecondaries() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "immersiveengineering:arc_furnace",
|
||||
"additives": [],
|
||||
"energy": 230400,
|
||||
"input": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"base_ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"count": 13
|
||||
{
|
||||
"type": "immersiveengineering:arc_furnace",
|
||||
"additives": [],
|
||||
"energy": 230400,
|
||||
"input": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"base_ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"count": 13
|
||||
}
|
||||
],
|
||||
"secondaries": [
|
||||
{
|
||||
"chance": 0.5,
|
||||
"output": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
],
|
||||
"secondaries": [
|
||||
{
|
||||
"chance": 0.5,
|
||||
"output": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
}
|
||||
],
|
||||
"time": 900
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:arc_furnace",
|
||||
"additives": [],
|
||||
"energy": 230400,
|
||||
"input": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"base_ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"count": 13
|
||||
}
|
||||
],
|
||||
"secondaries": [
|
||||
{
|
||||
"chance": 0.5,
|
||||
"output": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
],
|
||||
"time": 900
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:arc_furnace",
|
||||
"additives": [],
|
||||
"energy": 230400,
|
||||
"input": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"results": [
|
||||
{
|
||||
"base_ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"count": 13
|
||||
}
|
||||
],
|
||||
"secondaries": [
|
||||
{
|
||||
"chance": 0.5,
|
||||
"output": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
}
|
||||
],
|
||||
"time": 900
|
||||
}
|
||||
""");
|
||||
}
|
||||
],
|
||||
"time": 900
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testSawmill() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "immersiveengineering:sawmill",
|
||||
"energy": 800,
|
||||
"input": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"result": {
|
||||
"count": 2,
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"secondaries": [
|
||||
{
|
||||
"output": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"stripping": false
|
||||
}
|
||||
]
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:sawmill",
|
||||
"energy": 800,
|
||||
"input": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"result": {
|
||||
"count": 2,
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"secondaries": [
|
||||
{
|
||||
"output": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"stripping": false
|
||||
}
|
||||
]
|
||||
}
|
||||
""");
|
||||
{
|
||||
"type": "immersiveengineering:sawmill",
|
||||
"energy": 800,
|
||||
"input": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"result": {
|
||||
"count": 2,
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"secondaries": [
|
||||
{
|
||||
"output": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"stripping": false
|
||||
}
|
||||
]
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:sawmill",
|
||||
"energy": 800,
|
||||
"input": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"result": {
|
||||
"count": 2,
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"secondaries": [
|
||||
{
|
||||
"output": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"stripping": false
|
||||
}
|
||||
]
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testSqueezer() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "immersiveengineering:squeezer",
|
||||
"energy": 6400,
|
||||
"fluid": {
|
||||
"amount": 60,
|
||||
"fluid": "immersiveengineering:plantoil"
|
||||
},
|
||||
"input": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
{
|
||||
"type": "immersiveengineering:squeezer",
|
||||
"energy": 6400,
|
||||
"fluid": {
|
||||
"amount": 60,
|
||||
"fluid": "immersiveengineering:plantoil"
|
||||
},
|
||||
"input": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:squeezer",
|
||||
"energy": 6400,
|
||||
"fluid": {
|
||||
"amount": 60,
|
||||
"fluid": "immersiveengineering:plantoil"
|
||||
},
|
||||
"input": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:squeezer",
|
||||
"energy": 6400,
|
||||
"fluid": {
|
||||
"amount": 60,
|
||||
"fluid": "immersiveengineering:plantoil"
|
||||
},
|
||||
"input": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
""");
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testFertilizer() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "immersiveengineering:fertilizer",
|
||||
"growthModifier": 1.25,
|
||||
"input": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
{
|
||||
"type": "immersiveengineering:fertilizer",
|
||||
"growthModifier": 1.25,
|
||||
"input": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:fertilizer",
|
||||
"growthModifier": 1.25,
|
||||
"input": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:fertilizer",
|
||||
"growthModifier": 1.25,
|
||||
"input": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
""");
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testMetalPress() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "immersiveengineering:metal_press",
|
||||
"energy": 3200,
|
||||
"input": {
|
||||
"base_ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"count": 5
|
||||
},
|
||||
"mold": "immersiveengineering:mold_rod",
|
||||
"result": {
|
||||
{
|
||||
"type": "immersiveengineering:metal_press",
|
||||
"energy": 3200,
|
||||
"input": {
|
||||
"base_ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:metal_press",
|
||||
"energy": 3200,
|
||||
"input": {
|
||||
"base_ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"count": 5
|
||||
},
|
||||
"mold": "immersiveengineering:mold_rod",
|
||||
"result": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
"count": 5
|
||||
},
|
||||
"mold": "immersiveengineering:mold_rod",
|
||||
"result": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
""");
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:metal_press",
|
||||
"energy": 3200,
|
||||
"input": {
|
||||
"base_ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"count": 5
|
||||
},
|
||||
"mold": "immersiveengineering:mold_rod",
|
||||
"result": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testCokeOven() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "immersiveengineering:coke_oven",
|
||||
"creosote": 250,
|
||||
"input": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"result": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"time": 900
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:coke_oven",
|
||||
"creosote": 250,
|
||||
"input": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"result": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"time": 900
|
||||
}
|
||||
""");
|
||||
{
|
||||
"type": "immersiveengineering:coke_oven",
|
||||
"creosote": 250,
|
||||
"input": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"result": {
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"time": 900
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "immersiveengineering:coke_oven",
|
||||
"creosote": 250,
|
||||
"input": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"result": {
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"time": 900
|
||||
}
|
||||
""");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,96 +13,96 @@ public class IntegratedDynamicsRecipeUnifierTests {
|
|||
@SimpleGameTest
|
||||
public void testBasin() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "integrateddynamics:drying_basin",
|
||||
"item": "minecraft:test_item",
|
||||
"fluid": {
|
||||
"fluid": "minecraft:water",
|
||||
"amount": 250
|
||||
},
|
||||
"duration": 100,
|
||||
"result": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "integrateddynamics:drying_basin",
|
||||
"item": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"fluid": {
|
||||
"fluid": "minecraft:water",
|
||||
"amount": 250
|
||||
},
|
||||
"duration": 100,
|
||||
"result": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
}
|
||||
""");
|
||||
{
|
||||
"type": "integrateddynamics:drying_basin",
|
||||
"item": "minecraft:test_item",
|
||||
"fluid": {
|
||||
"fluid": "minecraft:water",
|
||||
"amount": 250
|
||||
},
|
||||
"duration": 100,
|
||||
"result": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "integrateddynamics:drying_basin",
|
||||
"item": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"fluid": {
|
||||
"fluid": "minecraft:water",
|
||||
"amount": 250
|
||||
},
|
||||
"duration": 100,
|
||||
"result": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testMechanicalSqueezerItemInItems() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "integrateddynamics:mechanical_squeezer",
|
||||
"item": "testmod:test_item",
|
||||
"result": {
|
||||
"fluid": {
|
||||
"fluid": "integrateddynamics:menril_resin",
|
||||
"amount": 1000
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"item": {
|
||||
"tag": "testmod:test_tag",
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"item": "minecraft:test_item",
|
||||
"chance": 0.5
|
||||
},
|
||||
{
|
||||
"item": "testmod:test_item",
|
||||
"chance": 0.5
|
||||
}
|
||||
]
|
||||
{
|
||||
"type": "integrateddynamics:mechanical_squeezer",
|
||||
"item": "testmod:test_item",
|
||||
"result": {
|
||||
"fluid": {
|
||||
"fluid": "integrateddynamics:menril_resin",
|
||||
"amount": 1000
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"item": {
|
||||
"tag": "testmod:test_tag",
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"duration": 15
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "integrateddynamics:mechanical_squeezer",
|
||||
"item": {
|
||||
"tag": "testmod:test_tag"
|
||||
{
|
||||
"item": "minecraft:test_item",
|
||||
"chance": 0.5
|
||||
},
|
||||
"result": {
|
||||
"fluid": {
|
||||
"fluid": "integrateddynamics:menril_resin",
|
||||
"amount": 1000
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"item": {
|
||||
"item": "testmod:test_item",
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"item": "testmod:test_item",
|
||||
"chance": 0.5
|
||||
},
|
||||
{
|
||||
"item": "testmod:test_item",
|
||||
"chance": 0.5
|
||||
}
|
||||
]
|
||||
{
|
||||
"item": "testmod:test_item",
|
||||
"chance": 0.5
|
||||
}
|
||||
]
|
||||
},
|
||||
"duration": 15
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "integrateddynamics:mechanical_squeezer",
|
||||
"item": {
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"result": {
|
||||
"fluid": {
|
||||
"fluid": "integrateddynamics:menril_resin",
|
||||
"amount": 1000
|
||||
},
|
||||
"items": [
|
||||
{
|
||||
"item": {
|
||||
"item": "testmod:test_item",
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"duration": 15
|
||||
}
|
||||
""");
|
||||
{
|
||||
"item": "testmod:test_item",
|
||||
"chance": 0.5
|
||||
},
|
||||
{
|
||||
"item": "testmod:test_item",
|
||||
"chance": 0.5
|
||||
}
|
||||
]
|
||||
},
|
||||
"duration": 15
|
||||
}
|
||||
""");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,297 +14,297 @@ public class MekanismRecipeUnifierTests {
|
|||
@SimpleGameTest
|
||||
public void testMainInputAndExtraInput() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "mekanism:combining",
|
||||
"extraInput": {
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
},
|
||||
"mainInput": {
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"item": "minecraft:gravel"
|
||||
}
|
||||
{
|
||||
"type": "mekanism:combining",
|
||||
"extraInput": {
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "mekanism:combining",
|
||||
"extraInput": {
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"mainInput": {
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"item": "minecraft:gravel"
|
||||
}
|
||||
},
|
||||
"mainInput": {
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
""");
|
||||
},
|
||||
"output": {
|
||||
"item": "minecraft:gravel"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "mekanism:combining",
|
||||
"extraInput": {
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"mainInput": {
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"item": "minecraft:gravel"
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testMainInputAndExtraInput_Noop() {
|
||||
assertNoUnify(UNIFIER, """
|
||||
{
|
||||
"type": "mekanism:combining",
|
||||
"extraInput": {
|
||||
"ingredient": {
|
||||
"item": "minecraft:nether_star"
|
||||
}
|
||||
},
|
||||
"mainInput": {
|
||||
"ingredient": {
|
||||
"item": "minecraft:stick"
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"item": "minecraft:gravel"
|
||||
}
|
||||
{
|
||||
"type": "mekanism:combining",
|
||||
"extraInput": {
|
||||
"ingredient": {
|
||||
"item": "minecraft:nether_star"
|
||||
}
|
||||
""");
|
||||
},
|
||||
"mainInput": {
|
||||
"ingredient": {
|
||||
"item": "minecraft:stick"
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"item": "minecraft:gravel"
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testItemInput_PaintingType() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "mekanism:painting",
|
||||
"chemicalInput": {
|
||||
"amount": 256,
|
||||
"pigment": "mekanism:gray"
|
||||
{
|
||||
"type": "mekanism:painting",
|
||||
"chemicalInput": {
|
||||
"amount": 256,
|
||||
"pigment": "mekanism:gray"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": [
|
||||
{
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": [
|
||||
{
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
{
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:stick"
|
||||
}
|
||||
]
|
||||
{
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"output": {
|
||||
"item": "ilikewood:biomesoplenty_gray_cherry_bed"
|
||||
{
|
||||
"item": "minecraft:stick"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "mekanism:painting",
|
||||
"chemicalInput": {
|
||||
"amount": 256,
|
||||
"pigment": "mekanism:gray"
|
||||
]
|
||||
},
|
||||
"output": {
|
||||
"item": "ilikewood:biomesoplenty_gray_cherry_bed"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "mekanism:painting",
|
||||
"chemicalInput": {
|
||||
"amount": 256,
|
||||
"pigment": "mekanism:gray"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": [
|
||||
{
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": [
|
||||
{
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
{
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:stick"
|
||||
}
|
||||
]
|
||||
{
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
"output": {
|
||||
"item": "ilikewood:biomesoplenty_gray_cherry_bed"
|
||||
{
|
||||
"item": "minecraft:stick"
|
||||
}
|
||||
}
|
||||
""");
|
||||
]
|
||||
},
|
||||
"output": {
|
||||
"item": "ilikewood:biomesoplenty_gray_cherry_bed"
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testItemInput_PaintingType_Noop() {
|
||||
assertNoUnify(UNIFIER, """
|
||||
{
|
||||
"type": "mekanism:painting",
|
||||
"chemicalInput": {
|
||||
"amount": 256,
|
||||
"pigment": "mekanism:gray"
|
||||
{
|
||||
"type": "mekanism:painting",
|
||||
"chemicalInput": {
|
||||
"amount": 256,
|
||||
"pigment": "mekanism:gray"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": [
|
||||
{
|
||||
"item": "minecraft:apple"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": [
|
||||
{
|
||||
"item": "minecraft:apple"
|
||||
},
|
||||
{
|
||||
"item": "testmod:invalid_item"
|
||||
},
|
||||
{
|
||||
"item": "minecraft:stick"
|
||||
}
|
||||
]
|
||||
{
|
||||
"item": "testmod:invalid_item"
|
||||
},
|
||||
"output": {
|
||||
"item": "ilikewood:biomesoplenty_gray_cherry_bed"
|
||||
{
|
||||
"item": "minecraft:stick"
|
||||
}
|
||||
}
|
||||
""");
|
||||
]
|
||||
},
|
||||
"output": {
|
||||
"item": "ilikewood:biomesoplenty_gray_cherry_bed"
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testItemInput_MetallurgicInfusingType() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "mekanism:metallurgic_infusing",
|
||||
"chemicalInput": {
|
||||
"amount": 10,
|
||||
"tag": "mekanism:bio"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"item": "byg:mossy_stone_slab"
|
||||
}
|
||||
{
|
||||
"type": "mekanism:metallurgic_infusing",
|
||||
"chemicalInput": {
|
||||
"amount": 10,
|
||||
"tag": "mekanism:bio"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "mekanism:metallurgic_infusing",
|
||||
"chemicalInput": {
|
||||
"amount": 10,
|
||||
"tag": "mekanism:bio"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"item": "byg:mossy_stone_slab"
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"item": "byg:mossy_stone_slab"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "mekanism:metallurgic_infusing",
|
||||
"chemicalInput": {
|
||||
"amount": 10,
|
||||
"tag": "mekanism:bio"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
""");
|
||||
},
|
||||
"output": {
|
||||
"item": "byg:mossy_stone_slab"
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testItemInput_MetallurgicInfusingType_Noop() {
|
||||
assertNoUnify(UNIFIER, """
|
||||
{
|
||||
"type": "mekanism:metallurgic_infusing",
|
||||
"chemicalInput": {
|
||||
"amount": 10,
|
||||
"tag": "mekanism:bio"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"output": {
|
||||
"item": "byg:mossy_stone_slab"
|
||||
}
|
||||
{
|
||||
"type": "mekanism:metallurgic_infusing",
|
||||
"chemicalInput": {
|
||||
"amount": 10,
|
||||
"tag": "mekanism:bio"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
""");
|
||||
},
|
||||
"output": {
|
||||
"item": "byg:mossy_stone_slab"
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testMainOutputSecondaryOutput() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "mekanism:sawing",
|
||||
"input": {
|
||||
"ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
},
|
||||
"mainOutput": {
|
||||
"count": 3,
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"secondaryChance": 1.0,
|
||||
"secondaryOutput": {
|
||||
"count": 3,
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
{
|
||||
"type": "mekanism:sawing",
|
||||
"input": {
|
||||
"ingredient": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "mekanism:sawing",
|
||||
"input": {
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"mainOutput": {
|
||||
"count": 3,
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"secondaryChance": 1.0,
|
||||
"secondaryOutput": {
|
||||
"count": 3,
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
},
|
||||
"mainOutput": {
|
||||
"count": 3,
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
"secondaryChance": 1.0,
|
||||
"secondaryOutput": {
|
||||
"count": 3,
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "mekanism:sawing",
|
||||
"input": {
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
""");
|
||||
},
|
||||
"mainOutput": {
|
||||
"count": 3,
|
||||
"item": "testmod:test_item"
|
||||
},
|
||||
"secondaryChance": 1.0,
|
||||
"secondaryOutput": {
|
||||
"count": 3,
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testItemInputItemOutput() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "mekanism:reaction",
|
||||
"duration": 100,
|
||||
"fluidInput": {
|
||||
"amount": 1000,
|
||||
"tag": "minecraft:water"
|
||||
},
|
||||
"gasInput": {
|
||||
"amount": 1000,
|
||||
"gas": "mekanism:plutonium"
|
||||
},
|
||||
"gasOutput": {
|
||||
"amount": 1000,
|
||||
"gas": "mekanism:spent_nuclear_waste"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
},
|
||||
"itemOutput": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
{
|
||||
"type": "mekanism:reaction",
|
||||
"duration": 100,
|
||||
"fluidInput": {
|
||||
"amount": 1000,
|
||||
"tag": "minecraft:water"
|
||||
},
|
||||
"gasInput": {
|
||||
"amount": 1000,
|
||||
"gas": "mekanism:plutonium"
|
||||
},
|
||||
"gasOutput": {
|
||||
"amount": 1000,
|
||||
"gas": "mekanism:spent_nuclear_waste"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "mekanism:reaction",
|
||||
"duration": 100,
|
||||
"fluidInput": {
|
||||
"amount": 1000,
|
||||
"tag": "minecraft:water"
|
||||
},
|
||||
"gasInput": {
|
||||
"amount": 1000,
|
||||
"gas": "mekanism:plutonium"
|
||||
},
|
||||
"gasOutput": {
|
||||
"amount": 1000,
|
||||
"gas": "mekanism:spent_nuclear_waste"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
},
|
||||
"itemOutput": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
},
|
||||
"itemOutput": {
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "mekanism:reaction",
|
||||
"duration": 100,
|
||||
"fluidInput": {
|
||||
"amount": 1000,
|
||||
"tag": "minecraft:water"
|
||||
},
|
||||
"gasInput": {
|
||||
"amount": 1000,
|
||||
"gas": "mekanism:plutonium"
|
||||
},
|
||||
"gasOutput": {
|
||||
"amount": 1000,
|
||||
"gas": "mekanism:spent_nuclear_waste"
|
||||
},
|
||||
"itemInput": {
|
||||
"ingredient": {
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
""");
|
||||
},
|
||||
"itemOutput": {
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,119 +14,119 @@ public class ModernIndustrializationRecipeUnifierTests {
|
|||
@SimpleGameTest
|
||||
public void test() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "modern_industrialization:assembler",
|
||||
"eu": 8,
|
||||
"duration": 200,
|
||||
"item_inputs": {
|
||||
"item": "minecraft:test_item",
|
||||
"amount": 8
|
||||
},
|
||||
"fluid_inputs": {
|
||||
"fluid": "minecraft:lava",
|
||||
"amount": 1000
|
||||
},
|
||||
"item_outputs": [
|
||||
{
|
||||
"type": "modern_industrialization:assembler",
|
||||
"eu": 8,
|
||||
"duration": 200,
|
||||
"item_inputs": {
|
||||
"item": "minecraft:test_item",
|
||||
"amount": 8
|
||||
},
|
||||
"fluid_inputs": {
|
||||
"fluid": "minecraft:lava",
|
||||
"amount": 1000
|
||||
},
|
||||
"item_outputs": [
|
||||
{
|
||||
"item": "minecraft:test_item",
|
||||
"amount": 1
|
||||
}
|
||||
]
|
||||
"item": "minecraft:test_item",
|
||||
"amount": 1
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "modern_industrialization:assembler",
|
||||
"eu": 8,
|
||||
"duration": 200,
|
||||
"item_inputs": {
|
||||
"tag": "testmod:test_tag",
|
||||
"amount": 8
|
||||
},
|
||||
"fluid_inputs": {
|
||||
"fluid": "minecraft:lava",
|
||||
"amount": 1000
|
||||
},
|
||||
"item_outputs": [
|
||||
{
|
||||
"item": "testmod:test_item",
|
||||
"amount": 1
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "modern_industrialization:assembler",
|
||||
"eu": 8,
|
||||
"duration": 200,
|
||||
"item_inputs": {
|
||||
"tag": "testmod:test_tag",
|
||||
"amount": 8
|
||||
},
|
||||
"fluid_inputs": {
|
||||
"fluid": "minecraft:lava",
|
||||
"amount": 1000
|
||||
},
|
||||
"item_outputs": [
|
||||
{
|
||||
"item": "testmod:test_item",
|
||||
"amount": 1
|
||||
}
|
||||
""");
|
||||
]
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testArrays() {
|
||||
assertUnify(UNIFIER, """
|
||||
{
|
||||
"type": "modern_industrialization:mixer",
|
||||
"duration": 100,
|
||||
"eu": 2,
|
||||
"item_inputs": [
|
||||
{
|
||||
"type": "modern_industrialization:mixer",
|
||||
"duration": 100,
|
||||
"eu": 2,
|
||||
"item_inputs": [
|
||||
{
|
||||
"amount": 1,
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
{
|
||||
"amount": 1,
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
],
|
||||
"item_outputs": [
|
||||
{
|
||||
"amount": 2,
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
]
|
||||
}
|
||||
""", """
|
||||
"amount": 1,
|
||||
"item": "minecraft:test_item"
|
||||
},
|
||||
{
|
||||
"type": "modern_industrialization:mixer",
|
||||
"duration": 100,
|
||||
"eu": 2,
|
||||
"item_inputs": [
|
||||
{
|
||||
"amount": 1,
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
{
|
||||
"amount": 1,
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
],
|
||||
"item_outputs": [
|
||||
{
|
||||
"amount": 2,
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
]
|
||||
"amount": 1,
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
""");
|
||||
],
|
||||
"item_outputs": [
|
||||
{
|
||||
"amount": 2,
|
||||
"item": "minecraft:test_item"
|
||||
}
|
||||
]
|
||||
}
|
||||
""", """
|
||||
{
|
||||
"type": "modern_industrialization:mixer",
|
||||
"duration": 100,
|
||||
"eu": 2,
|
||||
"item_inputs": [
|
||||
{
|
||||
"amount": 1,
|
||||
"tag": "testmod:test_tag"
|
||||
},
|
||||
{
|
||||
"amount": 1,
|
||||
"tag": "testmod:test_tag"
|
||||
}
|
||||
],
|
||||
"item_outputs": [
|
||||
{
|
||||
"amount": 2,
|
||||
"item": "testmod:test_item"
|
||||
}
|
||||
]
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@SimpleGameTest
|
||||
public void testNot() {
|
||||
assertNoUnify(UNIFIER, """
|
||||
{
|
||||
"type": "modern_industrialization:assembler",
|
||||
"eu": 8,
|
||||
"duration": 200,
|
||||
"item_inputs": {
|
||||
"tag": "c:plates/steel",
|
||||
"amount": 8
|
||||
},
|
||||
"fluid_inputs": {
|
||||
"fluid": "minecraft:lava",
|
||||
"amount": 1000
|
||||
},
|
||||
"item_outputs": [
|
||||
{
|
||||
"type": "modern_industrialization:assembler",
|
||||
"eu": 8,
|
||||
"duration": 200,
|
||||
"item_inputs": {
|
||||
"tag": "c:plates/steel",
|
||||
"amount": 8
|
||||
},
|
||||
"fluid_inputs": {
|
||||
"fluid": "minecraft:lava",
|
||||
"amount": 1000
|
||||
},
|
||||
"item_outputs": [
|
||||
{
|
||||
"item": "modern_industrialization:trash_can",
|
||||
"amount": 1
|
||||
}
|
||||
]
|
||||
"item": "modern_industrialization:trash_can",
|
||||
"amount": 1
|
||||
}
|
||||
""");
|
||||
]
|
||||
}
|
||||
""");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue