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 2126ea1 commit 4afe322
Show file tree
Hide file tree
Showing 19 changed files with 69 additions and 23 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 - EMI 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.5.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
emiVersion=1.1.11+1.21
# Gradle
org.gradle.jvmargs=-Xmx1G
Expand Down
2 changes: 2 additions & 0 deletions refinedstorage-emi-integration-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ base {
}

val refinedstorageVersion: String by project
val refinedstorageQuartzArsenalVersion: String by project
val emiVersion: String by project

dependencies {
api("com.refinedmods.refinedstorage:refinedstorage-common:${refinedstorageVersion}")
compileOnlyApi("dev.emi:emi-xplat-mojmap:${emiVersion}")
compileOnlyApi("com.refinedmods.refinedstorage:refinedstorage-quartz-arsenal-common:${refinedstorageQuartzArsenalVersion}")
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import com.refinedmods.refinedstorage.api.resource.list.MutableResourceList;
import com.refinedmods.refinedstorage.api.resource.list.MutableResourceListImpl;
import com.refinedmods.refinedstorage.api.resource.list.ResourceList;
import com.refinedmods.refinedstorage.common.api.RefinedStorageApi;
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 com.refinedmods.refinedstorage.common.support.tooltip.HelpClientTooltipComponent;

Expand Down Expand Up @@ -35,13 +35,13 @@
import static com.refinedmods.refinedstorage.emi.common.Common.MOD_ID;
import static java.util.Comparator.comparingLong;

class CraftingGridEmiRecipeHandler extends AbstractEmiRecipeHandler<CraftingGridContainerMenu> {
class CraftingGridEmiRecipeHandler<T extends AbstractCraftingGridContainerMenu> extends AbstractEmiRecipeHandler<T> {
private static final Component CTRL_CLICK_TO_AUTOCRAFT = Component.translatable(
"gui.%s.transfer.ctrl_click_to_autocraft".formatted(MOD_ID)
);

@Override
public EmiPlayerInventory getInventory(final AbstractContainerScreen<CraftingGridContainerMenu> screen) {
public EmiPlayerInventory getInventory(final AbstractContainerScreen<T> screen) {
final ResourceList available = screen.getMenu().getAvailableListForRecipeTransfer();
return new EmiPlayerInventory(available.copyState().stream()
.filter(resourceAmount -> resourceAmount.resource() instanceof ItemResource)
Expand All @@ -58,7 +58,7 @@ public boolean supportsRecipe(final EmiRecipe recipe) {
}

@Override
public boolean canCraft(final EmiRecipe recipe, final EmiCraftContext<CraftingGridContainerMenu> context) {
public boolean canCraft(final EmiRecipe recipe, final EmiCraftContext<T> context) {
return true;
}

Expand Down Expand Up @@ -92,7 +92,7 @@ private static List<ItemResource> getItems(final EmiIngredient ingredient) {
}

@Override
public boolean craft(final EmiRecipe recipe, final EmiCraftContext<CraftingGridContainerMenu> context) {
public boolean craft(final EmiRecipe recipe, final EmiCraftContext<T> context) {
final MutableResourceList available = context.getScreenHandler().getAvailableListForRecipeTransfer();
final List<TransferInput> transferInputs = recipe.getInputs()
.stream()
Expand All @@ -102,7 +102,7 @@ public boolean craft(final EmiRecipe recipe, final EmiCraftContext<CraftingGridC
final TransferType transferType = getTransferType(transferInputs);
if (transferType.canOpenAutocraftingPreview() && Screen.hasControlDown()) {
final List<ResourceAmount> craftingRequests = createCraftingRequests(transferInputs);
RefinedStorageApi.INSTANCE.openAutocraftingPreview(craftingRequests, context.getScreen());
RefinedStorageClientApi.INSTANCE.openAutocraftingPreview(craftingRequests, context.getScreen());
return false;
}
final List<List<ItemResource>> inputs = recipe.getInputs()
Expand All @@ -115,7 +115,7 @@ public boolean craft(final EmiRecipe recipe, final EmiCraftContext<CraftingGridC

@Override
public void render(final EmiRecipe recipe,
final EmiCraftContext<CraftingGridContainerMenu> craftContext,
final EmiCraftContext<T> craftContext,
final List<Widget> widgets,
final GuiGraphics draw) {
final EmiDrawContext context = EmiDrawContext.wrap(draw);
Expand All @@ -141,7 +141,7 @@ public void render(final EmiRecipe recipe,

@Override
public List<ClientTooltipComponent> getTooltip(final EmiRecipe recipe,
final EmiCraftContext<CraftingGridContainerMenu> context) {
final EmiCraftContext<T> context) {
final MutableResourceList available = context.getScreenHandler().getAvailableListForRecipeTransfer();
final List<TransferInput> transferInputs = recipe.getInputs()
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.refinedmods.refinedstorage.api.resource.ResourceAmount;
import com.refinedmods.refinedstorage.api.resource.ResourceKey;
import com.refinedmods.refinedstorage.common.api.RefinedStorageApi;
import com.refinedmods.refinedstorage.common.autocrafting.PatternGridContainerMenu;
import com.refinedmods.refinedstorage.common.autocrafting.patterngrid.PatternGridContainerMenu;
import com.refinedmods.refinedstorage.common.support.resource.ItemResource;

import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.refinedmods.refinedstorage.emi.common;

import com.refinedmods.refinedstorage.quartzarsenal.common.Menus;

import dev.emi.emi.api.EmiRegistry;

public final class QuartzArsenalIntegration {
private QuartzArsenalIntegration() {
}

public static boolean isLoaded() {
try {
Class.forName(
"com.refinedmods.refinedstorage.quartzarsenal.common"
+ ".Menus"
);
return true;
} catch (final ClassNotFoundException e) {
return false;
}
}

public static void load(final EmiRegistry registration) {
registration.addRecipeHandler(
Menus.INSTANCE.getWirelessCraftingGrid(),
new CraftingGridEmiRecipeHandler<>()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ public void register(final EmiRegistry registry) {
registry.addGenericStackProvider(new ResourceEmiStackProvider());
registry.addGenericDragDropHandler(new ResourceEmiDragDropHandler());
registry.addGenericDragDropHandler(new FilterEmiDragDropHandler());
registry.addRecipeHandler(Menus.INSTANCE.getCraftingGrid(), new CraftingGridEmiRecipeHandler());
registry.addRecipeHandler(Menus.INSTANCE.getCraftingGrid(), new CraftingGridEmiRecipeHandler<>());
if (QuartzArsenalIntegration.isLoaded()) {
QuartzArsenalIntegration.load(registry);
}
registry.addRecipeHandler(Menus.INSTANCE.getPatternGrid(), new PatternGridEmiRecipeHandler());
}
}
3 changes: 3 additions & 0 deletions refinedstorage-emi-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 emiVersion: String by project

val commonJava by configurations.existing
Expand All @@ -49,4 +50,6 @@ dependencies {
modApi("com.refinedmods.refinedstorage:refinedstorage-fabric:${refinedstorageVersion}")
modRuntimeOnly("dev.emi:emi-fabric:${emiVersion}")
modCompileOnlyApi("dev.emi:emi-fabric:${emiVersion}")
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 @@ -33,7 +33,7 @@
"fabricloader": ">=0.14.6",
"fabric-api": "*",
"minecraft": "~1.21",
"refinedstorage": ">=2.0.0-milestone.4.8",
"refinedstorage": ">=2.0.0-milestone.4.11",
"emi": ">=1.1.10",
"java": ">=17"
}
Expand Down
3 changes: 3 additions & 0 deletions refinedstorage-emi-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 emiVersion: String by project

val commonJava by configurations.existing
Expand All @@ -41,4 +42,6 @@ dependencies {
api("com.refinedmods.refinedstorage:refinedstorage-neoforge:${refinedstorageVersion}")
runtimeOnly("dev.emi:emi-neoforge:${emiVersion}")
compileOnlyApi("dev.emi:emi-neoforge:${emiVersion}")
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 @@ EMI integration for Refined Storage.
[[dependencies.refinedstorage_emi_integration]]
modId = "refinedstorage"
type = "required"
versionRange = "2.0.0-milestone.4.8"
versionRange = "2.0.0-milestone.4.11"
side = "BOTH"
[[dependencies.refinedstorage_emi_integration]]
modId = "emi"
Expand Down

0 comments on commit 4afe322

Please sign in to comment.