From 5474db36998cc38f6c8d265cc4c8a546f56bc6ee Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Sun, 8 Dec 2024 19:08:12 +0100 Subject: [PATCH] chore: upgrade refined storage and add compat with quartz arsenal --- .github/workflows/build.yml | 2 +- .github/workflows/draft-release.yml | 2 +- .../issue-for-unsupported-version.yml | 2 +- .github/workflows/publish-release.yml | 2 +- .github/workflows/resolved-issue-locking.yml | 2 +- .github/workflows/validate-branch-name.yml | 2 +- .github/workflows/validate-changelog.yml | 2 +- .../workflows/validate-commit-messages.yml | 2 +- CHANGELOG.md | 5 ++++ gradle.properties | 5 ++-- .../build.gradle.kts | 2 ++ ...tractPatternGridRecipeTransferHandler.java | 2 +- .../CraftingGridRecipeTransferHandler.java | 29 +++++++++++-------- ...ternGridCraftingRecipeTransferHandler.java | 2 +- ...rnGridProcessingRecipeTransferHandler.java | 2 +- ...ridSmithingTableRecipeTransferHandler.java | 2 +- ...nGridStonecutterRecipeTransferHandler.java | 2 +- .../jei/common/QuartzArsenalIntegration.java | 29 +++++++++++++++++++ .../jei/common/RefinedStorageModPlugin.java | 8 ++++- .../build.gradle.kts | 3 ++ .../src/main/resources/fabric.mod.json | 2 +- .../build.gradle.kts | 3 ++ .../templates/META-INF/neoforge.mods.toml | 2 +- 23 files changed, 84 insertions(+), 30 deletions(-) create mode 100644 refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/QuartzArsenalIntegration.java diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 856e83b..aed439b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: types: [ opened, synchronize, reopened ] jobs: build: - uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.19.1 + uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.20.0 with: mutation-testing: false secrets: inherit diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index c6d98d5..d939997 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -17,7 +17,7 @@ on: type: string jobs: draft: - uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.19.1 + uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.20.0 with: release-type: ${{ inputs.release-type }} version-number-override: ${{ inputs.version-number-override }} diff --git a/.github/workflows/issue-for-unsupported-version.yml b/.github/workflows/issue-for-unsupported-version.yml index 002c2ac..299dcb1 100644 --- a/.github/workflows/issue-for-unsupported-version.yml +++ b/.github/workflows/issue-for-unsupported-version.yml @@ -4,4 +4,4 @@ on: types: [ labeled, unlabeled, reopened ] jobs: unsupported-labeler: - uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.19.1 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.20.0 \ No newline at end of file diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 1150b87..c790d1c 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -7,7 +7,7 @@ on: - closed jobs: publish-release: - uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.19.1 + uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.20.0 secrets: inherit with: project-name: 'Refined Storage - JEI Integration' diff --git a/.github/workflows/resolved-issue-locking.yml b/.github/workflows/resolved-issue-locking.yml index f8dbbdf..8426e8b 100644 --- a/.github/workflows/resolved-issue-locking.yml +++ b/.github/workflows/resolved-issue-locking.yml @@ -4,4 +4,4 @@ on: - cron: '0 0 * * *' jobs: lock: - uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.19.1 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.20.0 \ No newline at end of file diff --git a/.github/workflows/validate-branch-name.yml b/.github/workflows/validate-branch-name.yml index c1733fb..bd5a157 100644 --- a/.github/workflows/validate-branch-name.yml +++ b/.github/workflows/validate-branch-name.yml @@ -2,4 +2,4 @@ name: Validate branch name on: [ pull_request ] jobs: validate-branch-name: - uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.19.1 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.20.0 \ No newline at end of file diff --git a/.github/workflows/validate-changelog.yml b/.github/workflows/validate-changelog.yml index f5fb9ae..d18cbc9 100644 --- a/.github/workflows/validate-changelog.yml +++ b/.github/workflows/validate-changelog.yml @@ -4,4 +4,4 @@ on: types: [ opened, synchronize, reopened, ready_for_review, labeled, unlabeled ] jobs: validate-changelog: - uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.19.1 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.20.0 \ No newline at end of file diff --git a/.github/workflows/validate-commit-messages.yml b/.github/workflows/validate-commit-messages.yml index 620b9e8..3005b5a 100644 --- a/.github/workflows/validate-commit-messages.yml +++ b/.github/workflows/validate-commit-messages.yml @@ -2,4 +2,4 @@ name: Validate commit messages on: [ pull_request ] jobs: validate-commit-messages: - uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.19.1 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.20.0 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 85bf045..d781ddb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed + +- Support for Refined Storage v2.0.0-milestone.4.11. +- Recipe transfer not working in the Wireless Crafting Grid. + ## [0.6.0] - 2024-10-12 ### Added diff --git a/gradle.properties b/gradle.properties index 8e11190..03d0a57 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,6 @@ -refinedarchitectVersion=0.19.1 -refinedstorageVersion=2.0.0-milestone.4.8 +refinedarchitectVersion=0.20.0 +refinedstorageVersion=2.0.0-milestone.4.11 +refinedstorageQuartzArsenalVersion=0.1.1 jeiVersion=19.20.0.241 minecraftVersion=1.21.1 # Gradle diff --git a/refinedstorage-jei-integration-common/build.gradle.kts b/refinedstorage-jei-integration-common/build.gradle.kts index 3827a91..aad2c4f 100644 --- a/refinedstorage-jei-integration-common/build.gradle.kts +++ b/refinedstorage-jei-integration-common/build.gradle.kts @@ -28,6 +28,7 @@ base { } val refinedstorageVersion: String by project +val refinedstorageQuartzArsenalVersion: String by project val jeiVersion: String by project val minecraftVersion: String by project @@ -35,4 +36,5 @@ dependencies { api("com.refinedmods.refinedstorage:refinedstorage-common:${refinedstorageVersion}") api("mezz.jei:jei-${minecraftVersion}-common-api:${jeiVersion}") api("mezz.jei:jei-${minecraftVersion}-common:${jeiVersion}") + compileOnlyApi("com.refinedmods.refinedstorage:refinedstorage-quartz-arsenal-common:${refinedstorageQuartzArsenalVersion}") } diff --git a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/AbstractPatternGridRecipeTransferHandler.java b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/AbstractPatternGridRecipeTransferHandler.java index f382064..8231dbd 100644 --- a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/AbstractPatternGridRecipeTransferHandler.java +++ b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/AbstractPatternGridRecipeTransferHandler.java @@ -2,7 +2,7 @@ import com.refinedmods.refinedstorage.api.grid.view.GridView; import com.refinedmods.refinedstorage.api.resource.ResourceAmount; -import com.refinedmods.refinedstorage.common.autocrafting.PatternGridContainerMenu; +import com.refinedmods.refinedstorage.common.autocrafting.patterngrid.PatternGridContainerMenu; import java.util.List; import javax.annotation.Nullable; diff --git a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/CraftingGridRecipeTransferHandler.java b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/CraftingGridRecipeTransferHandler.java index 715a1e4..e1c44e9 100644 --- a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/CraftingGridRecipeTransferHandler.java +++ b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/CraftingGridRecipeTransferHandler.java @@ -4,9 +4,8 @@ import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.api.resource.list.MutableResourceList; import com.refinedmods.refinedstorage.api.resource.list.MutableResourceListImpl; -import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; -import com.refinedmods.refinedstorage.common.content.Menus; -import com.refinedmods.refinedstorage.common.grid.CraftingGridContainerMenu; +import com.refinedmods.refinedstorage.common.api.RefinedStorageClientApi; +import com.refinedmods.refinedstorage.common.grid.AbstractCraftingGridContainerMenu; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; import java.util.List; @@ -32,16 +31,22 @@ import static java.util.Comparator.comparingLong; -class CraftingGridRecipeTransferHandler implements - IRecipeTransferHandler> { +class CraftingGridRecipeTransferHandler implements + IRecipeTransferHandler> { + private final Class clazz; + + CraftingGridRecipeTransferHandler(final Class clazz) { + this.clazz = clazz; + } + @Override - public Class getContainerClass() { - return CraftingGridContainerMenu.class; + public Class getContainerClass() { + return clazz; } @Override - public Optional> getMenuType() { - return Optional.of(Menus.INSTANCE.getCraftingGrid()); + public Optional> getMenuType() { + return Optional.empty(); } @Override @@ -51,7 +56,7 @@ public RecipeType> getRecipeType() { @Override @Nullable - public IRecipeTransferError transferRecipe(final CraftingGridContainerMenu containerMenu, + public IRecipeTransferError transferRecipe(final T containerMenu, final RecipeHolder recipe, final IRecipeSlotsView recipeSlots, final Player player, @@ -78,7 +83,7 @@ private void openAutocraftingPreview(final List transferInputs) { ? recipesGui.getParentScreen().orElse(null) : null; final List craftingRequests = createCraftingRequests(transferInputs); - RefinedStorageApi.INSTANCE.openAutocraftingPreview(craftingRequests, parentScreen); + RefinedStorageClientApi.INSTANCE.openAutocraftingPreview(craftingRequests, parentScreen); } private TransferType getTransferType(final List transferInputs) { @@ -96,7 +101,7 @@ private TransferType getTransferType(final List transferInputs) { return TransferType.MISSING; } - private void doTransfer(final IRecipeSlotsView recipeSlots, final CraftingGridContainerMenu containerMenu) { + private void doTransfer(final IRecipeSlotsView recipeSlots, final AbstractCraftingGridContainerMenu containerMenu) { final List> inputs = SlotUtil.getItems(recipeSlots, RecipeIngredientRole.INPUT); containerMenu.transferRecipe(inputs); } diff --git a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridCraftingRecipeTransferHandler.java b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridCraftingRecipeTransferHandler.java index b77ee66..78c048c 100644 --- a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridCraftingRecipeTransferHandler.java +++ b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridCraftingRecipeTransferHandler.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage.jei.common; -import com.refinedmods.refinedstorage.common.autocrafting.PatternGridContainerMenu; +import com.refinedmods.refinedstorage.common.autocrafting.patterngrid.PatternGridContainerMenu; import com.refinedmods.refinedstorage.common.content.Menus; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; diff --git a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridProcessingRecipeTransferHandler.java b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridProcessingRecipeTransferHandler.java index 35de7ec..316ef67 100644 --- a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridProcessingRecipeTransferHandler.java +++ b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridProcessingRecipeTransferHandler.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage.jei.common; import com.refinedmods.refinedstorage.api.resource.ResourceAmount; -import com.refinedmods.refinedstorage.common.autocrafting.PatternGridContainerMenu; +import com.refinedmods.refinedstorage.common.autocrafting.patterngrid.PatternGridContainerMenu; import com.refinedmods.refinedstorage.common.content.Menus; import java.util.List; diff --git a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridSmithingTableRecipeTransferHandler.java b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridSmithingTableRecipeTransferHandler.java index f7703fc..53272e8 100644 --- a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridSmithingTableRecipeTransferHandler.java +++ b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridSmithingTableRecipeTransferHandler.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage.jei.common; -import com.refinedmods.refinedstorage.common.autocrafting.PatternGridContainerMenu; +import com.refinedmods.refinedstorage.common.autocrafting.patterngrid.PatternGridContainerMenu; import com.refinedmods.refinedstorage.common.content.Menus; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; diff --git a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridStonecutterRecipeTransferHandler.java b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridStonecutterRecipeTransferHandler.java index b915f32..331265a 100644 --- a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridStonecutterRecipeTransferHandler.java +++ b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/PatternGridStonecutterRecipeTransferHandler.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage.jei.common; -import com.refinedmods.refinedstorage.common.autocrafting.PatternGridContainerMenu; +import com.refinedmods.refinedstorage.common.autocrafting.patterngrid.PatternGridContainerMenu; import com.refinedmods.refinedstorage.common.content.Menus; import java.util.Optional; diff --git a/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/QuartzArsenalIntegration.java b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/QuartzArsenalIntegration.java new file mode 100644 index 0000000..1f10e1d --- /dev/null +++ b/refinedstorage-jei-integration-common/src/main/java/com/refinedmods/refinedstorage/jei/common/QuartzArsenalIntegration.java @@ -0,0 +1,29 @@ +package com.refinedmods.refinedstorage.jei.common; + +import com.refinedmods.refinedstorage.quartzarsenal.common.wirelesscraftinggrid.WirelessCraftingGridContainerMenu; + +import mezz.jei.api.constants.RecipeTypes; +import mezz.jei.api.registration.IRecipeTransferRegistration; + +public final class QuartzArsenalIntegration { + private QuartzArsenalIntegration() { + } + + public static boolean isLoaded() { + try { + Class.forName( + "com.refinedmods.refinedstorage.quartzarsenal.common.wirelesscraftinggrid" + + ".WirelessCraftingGridContainerMenu" + ); + return true; + } catch (final ClassNotFoundException e) { + return false; + } + } + + public static void load(final IRecipeTransferRegistration registration) { + registration.addRecipeTransferHandler(new CraftingGridRecipeTransferHandler<>( + WirelessCraftingGridContainerMenu.class + ), RecipeTypes.CRAFTING); + } +} 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 16c719a..9400dcb 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,6 +1,7 @@ package com.refinedmods.refinedstorage.jei.common; import com.refinedmods.refinedstorage.common.content.Items; +import com.refinedmods.refinedstorage.common.grid.CraftingGridContainerMenu; import com.refinedmods.refinedstorage.common.grid.screen.AbstractGridScreen; import com.refinedmods.refinedstorage.common.support.AbstractBaseScreen; @@ -42,7 +43,12 @@ public void registerIngredientAliases(final IIngredientAliasRegistration registr @Override public void registerRecipeTransferHandlers(final IRecipeTransferRegistration registration) { - registration.addRecipeTransferHandler(new CraftingGridRecipeTransferHandler(), RecipeTypes.CRAFTING); + registration.addRecipeTransferHandler(new CraftingGridRecipeTransferHandler<>( + CraftingGridContainerMenu.class + ), RecipeTypes.CRAFTING); + if (QuartzArsenalIntegration.isLoaded()) { + QuartzArsenalIntegration.load(registration); + } registration.addRecipeTransferHandler(new PatternGridCraftingRecipeTransferHandler(), RecipeTypes.CRAFTING); registration.addRecipeTransferHandler( new PatternGridStonecutterRecipeTransferHandler(), diff --git a/refinedstorage-jei-integration-fabric/build.gradle.kts b/refinedstorage-jei-integration-fabric/build.gradle.kts index 4ad56c4..ef359da 100644 --- a/refinedstorage-jei-integration-fabric/build.gradle.kts +++ b/refinedstorage-jei-integration-fabric/build.gradle.kts @@ -37,6 +37,7 @@ base { } val refinedstorageVersion: String by project +val refinedstorageQuartzArsenalVersion: String by project val jeiVersion: String by project val minecraftVersion: String by project @@ -52,4 +53,6 @@ dependencies { modCompileOnlyApi("mezz.jei:jei-${minecraftVersion}-common-api:${jeiVersion}") modCompileOnlyApi("mezz.jei:jei-${minecraftVersion}-common:${jeiVersion}") modCompileOnlyApi("mezz.jei:jei-${minecraftVersion}-fabric-api:${jeiVersion}") + modCompileOnlyApi("com.refinedmods.refinedstorage:refinedstorage-quartz-arsenal-fabric:${refinedstorageQuartzArsenalVersion}") + // modRuntimeOnly("com.refinedmods.refinedstorage:refinedstorage-quartz-arsenal-fabric:${refinedstorageQuartzArsenalVersion}") } 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 12fd7d4..ee1a307 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.8", + "refinedstorage": ">=2.0.0-milestone.4.11", "jei": ">=19.20.0", "java": ">=17" } diff --git a/refinedstorage-jei-integration-neoforge/build.gradle.kts b/refinedstorage-jei-integration-neoforge/build.gradle.kts index b768c89..e072862 100644 --- a/refinedstorage-jei-integration-neoforge/build.gradle.kts +++ b/refinedstorage-jei-integration-neoforge/build.gradle.kts @@ -29,6 +29,7 @@ base { } val refinedstorageVersion: String by project +val refinedstorageQuartzArsenalVersion: String by project val jeiVersion: String by project val minecraftVersion: String by project @@ -44,4 +45,6 @@ dependencies { compileOnlyApi("mezz.jei:jei-${minecraftVersion}-common-api:${jeiVersion}") testCompileOnly("mezz.jei:jei-${minecraftVersion}-common:${jeiVersion}") compileOnlyApi("mezz.jei:jei-${minecraftVersion}-neoforge-api:${jeiVersion}") + compileOnlyApi("com.refinedmods.refinedstorage:refinedstorage-quartz-arsenal-neoforge:${refinedstorageQuartzArsenalVersion}") + // runtimeOnly("com.refinedmods.refinedstorage:refinedstorage-quartz-arsenal-neoforge:${refinedstorageQuartzArsenalVersion}") } 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 f43c21f..01e178c 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.8" +versionRange = "2.0.0-milestone.4.11" side = "BOTH" [[dependencies.refinedstorage_jei_integration]] modId = "jei"