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