Skip to content

Commit

Permalink
chore: upgrade refined storage and add compat with quartz arsenal
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulvdberge committed Dec 8, 2024
1 parent 97e0f00 commit 5474db3
Show file tree
Hide file tree
Showing 23 changed files with 84 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-for-unsupported-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.20.0
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/resolved-issue-locking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ on:
- cron: '0 0 * * *'
jobs:
lock:
uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.19.1
uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.20.0
2 changes: 1 addition & 1 deletion .github/workflows/validate-branch-name.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.20.0
2 changes: 1 addition & 1 deletion .github/workflows/validate-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.20.0
2 changes: 1 addition & 1 deletion .github/workflows/validate-commit-messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.20.0
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions refinedstorage-jei-integration-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ base {
}

val refinedstorageVersion: String by project
val refinedstorageQuartzArsenalVersion: String by project
val jeiVersion: String by project
val minecraftVersion: String by project

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}")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -32,16 +31,22 @@

import static java.util.Comparator.comparingLong;

class CraftingGridRecipeTransferHandler implements
IRecipeTransferHandler<CraftingGridContainerMenu, RecipeHolder<CraftingRecipe>> {
class CraftingGridRecipeTransferHandler<T extends AbstractCraftingGridContainerMenu> implements
IRecipeTransferHandler<T, RecipeHolder<CraftingRecipe>> {
private final Class<T> clazz;

CraftingGridRecipeTransferHandler(final Class<T> clazz) {
this.clazz = clazz;
}

@Override
public Class<? extends CraftingGridContainerMenu> getContainerClass() {
return CraftingGridContainerMenu.class;
public Class<T> getContainerClass() {
return clazz;
}

@Override
public Optional<MenuType<CraftingGridContainerMenu>> getMenuType() {
return Optional.of(Menus.INSTANCE.getCraftingGrid());
public Optional<MenuType<T>> getMenuType() {
return Optional.empty();
}

@Override
Expand All @@ -51,7 +56,7 @@ public RecipeType<RecipeHolder<CraftingRecipe>> getRecipeType() {

@Override
@Nullable
public IRecipeTransferError transferRecipe(final CraftingGridContainerMenu containerMenu,
public IRecipeTransferError transferRecipe(final T containerMenu,
final RecipeHolder<CraftingRecipe> recipe,
final IRecipeSlotsView recipeSlots,
final Player player,
Expand All @@ -78,7 +83,7 @@ private void openAutocraftingPreview(final List<TransferInput> transferInputs) {
? recipesGui.getParentScreen().orElse(null)
: null;
final List<ResourceAmount> craftingRequests = createCraftingRequests(transferInputs);
RefinedStorageApi.INSTANCE.openAutocraftingPreview(craftingRequests, parentScreen);
RefinedStorageClientApi.INSTANCE.openAutocraftingPreview(craftingRequests, parentScreen);
}

private TransferType getTransferType(final List<TransferInput> transferInputs) {
Expand All @@ -96,7 +101,7 @@ private TransferType getTransferType(final List<TransferInput> transferInputs) {
return TransferType.MISSING;
}

private void doTransfer(final IRecipeSlotsView recipeSlots, final CraftingGridContainerMenu containerMenu) {
private void doTransfer(final IRecipeSlotsView recipeSlots, final AbstractCraftingGridContainerMenu containerMenu) {
final List<List<ItemResource>> inputs = SlotUtil.getItems(recipeSlots, RecipeIngredientRole.INPUT);
containerMenu.transferRecipe(inputs);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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(),
Expand Down
3 changes: 3 additions & 0 deletions refinedstorage-jei-integration-fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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}")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
3 changes: 3 additions & 0 deletions refinedstorage-jei-integration-neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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}")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 5474db3

Please sign in to comment.