From 05c38b2920a17ca7f1db2fd4282a7d7786de1892 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Sat, 12 Oct 2024 19:30:57 +0200 Subject: [PATCH] feat: disk interface alias "Disk Manipulator" --- CHANGELOG.md | 1 + .../jei/common/RefinedStorageModPlugin.java | 18 +++++++++++++++++- .../lang/en_us.json | 3 ++- .../src/main/resources/fabric.mod.json | 2 +- .../main/templates/META-INF/neoforge.mods.toml | 2 +- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 952ff6f..f211068 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - The recipe transfer support in the Pattern Grid and Crafting Grid now indicates whether all or some resources are autocraftable. - You can now start autocrafting for missing autocraftable items from the Crafting Grid via the recipe transfer. +- Alias support for the Disk Interface (formerly known as "Disk Manipulator"). ### Fixed diff --git a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/RefinedStorageModPlugin.java b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/RefinedStorageModPlugin.java index 878ef36..16c719a 100644 --- a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/RefinedStorageModPlugin.java +++ b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/RefinedStorageModPlugin.java @@ -1,21 +1,28 @@ package com.refinedmods.refinedstorage.jei.common; +import com.refinedmods.refinedstorage.common.content.Items; import com.refinedmods.refinedstorage.common.grid.screen.AbstractGridScreen; import com.refinedmods.refinedstorage.common.support.AbstractBaseScreen; +import java.util.function.Supplier; import javax.annotation.Nullable; import mezz.jei.api.IModPlugin; import mezz.jei.api.JeiPlugin; import mezz.jei.api.constants.RecipeTypes; +import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.registration.IGuiHandlerRegistration; +import mezz.jei.api.registration.IIngredientAliasRegistration; import mezz.jei.api.registration.IRecipeTransferRegistration; import mezz.jei.api.runtime.IJeiRuntime; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; + +import static com.refinedmods.refinedstorage.jei.common.Common.MOD_ID; @JeiPlugin public class RefinedStorageModPlugin implements IModPlugin { - private static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(Common.MOD_ID, "plugin"); + private static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(MOD_ID, "plugin"); @Nullable private static IJeiRuntime runtime; @@ -24,6 +31,15 @@ public ResourceLocation getPluginUid() { return ID; } + @Override + public void registerIngredientAliases(final IIngredientAliasRegistration registration) { + registration.addAliases(VanillaTypes.ITEM_STACK, Items.INSTANCE.getDiskInterfaces() + .stream() + .map(Supplier::get) + .map(Item::getDefaultInstance) + .toList(), "alias.%s.refinedstorage1_disk_manipulator".formatted(MOD_ID)); + } + @Override public void registerRecipeTransferHandlers(final IRecipeTransferRegistration registration) { registration.addRecipeTransferHandler(new CraftingGridRecipeTransferHandler(), RecipeTypes.CRAFTING); diff --git a/refinedstorage-jei-integration-common/src/main/resources/assets/refinedstorage_jei_integration/lang/en_us.json b/refinedstorage-jei-integration-common/src/main/resources/assets/refinedstorage_jei_integration/lang/en_us.json index 70e4aca..a11a29b 100644 --- a/refinedstorage-jei-integration-common/src/main/resources/assets/refinedstorage_jei_integration/lang/en_us.json +++ b/refinedstorage-jei-integration-common/src/main/resources/assets/refinedstorage_jei_integration/lang/en_us.json @@ -7,5 +7,6 @@ "gui.refinedstorage_jei_integration.transfer.missing_but_some_autocraftable": "Missing items, some are autocraftable", "gui.refinedstorage_jei_integration.transfer.ctrl_click_to_autocraft": "CTRL + click to autocraft", "gui.refinedstorage_jei_integration.transfer.all_autocraftable": "All are autocraftable", - "gui.refinedstorage_jei_integration.transfer.some_autocraftable": "Some are autocraftable" + "gui.refinedstorage_jei_integration.transfer.some_autocraftable": "Some are autocraftable", + "alias.refinedstorage_jei_integration.refinedstorage1_disk_manipulator": "Disk Manipulator" } \ No newline at end of file diff --git a/refinedstorage-jei-integration-fabric/src/main/resources/fabric.mod.json b/refinedstorage-jei-integration-fabric/src/main/resources/fabric.mod.json index 9030fef..12fd7d4 100644 --- a/refinedstorage-jei-integration-fabric/src/main/resources/fabric.mod.json +++ b/refinedstorage-jei-integration-fabric/src/main/resources/fabric.mod.json @@ -36,7 +36,7 @@ "fabricloader": ">=0.14.6", "fabric-api": "*", "minecraft": "~1.21", - "refinedstorage": ">=2.0.0-milestone.4.7", + "refinedstorage": ">=2.0.0-milestone.4.8", "jei": ">=19.20.0", "java": ">=17" } diff --git a/refinedstorage-jei-integration-neoforge/src/main/templates/META-INF/neoforge.mods.toml b/refinedstorage-jei-integration-neoforge/src/main/templates/META-INF/neoforge.mods.toml index f795e30..f43c21f 100644 --- a/refinedstorage-jei-integration-neoforge/src/main/templates/META-INF/neoforge.mods.toml +++ b/refinedstorage-jei-integration-neoforge/src/main/templates/META-INF/neoforge.mods.toml @@ -14,7 +14,7 @@ JEI integration for Refined Storage. [[dependencies.refinedstorage_jei_integration]] modId = "refinedstorage" type = "required" -versionRange = "2.0.0-milestone.4.7" +versionRange = "2.0.0-milestone.4.8" side = "BOTH" [[dependencies.refinedstorage_jei_integration]] modId = "jei"