Skip to content

Commit

Permalink
Merge pull request #29 from refinedmods/release/0.6.0
Browse files Browse the repository at this point in the history
Release v0.6.0
  • Loading branch information
raoulvdberge authored Oct 12, 2024
2 parents 1329957 + 1b5e839 commit 2e44ad3
Show file tree
Hide file tree
Showing 33 changed files with 419 additions and 110 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.17.1
uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.19.1
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.17.1
uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.19.1
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.17.1
uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.19.1
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.17.1
uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.19.1
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.17.1
uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.19.1
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.17.1
uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.19.1
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.17.1
uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.19.1
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.17.1
uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.19.1
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.6.0] - 2024-10-12

### Added

- 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

- Support for Refined Storage v2.0.0-milestone.4.8.

## [0.5.0] - 2024-08-11

### Fixed
Expand Down Expand Up @@ -66,7 +78,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Recipe transfer integration for the Crafting Grid.
- Grid / JEI search box synchronization options.

[Unreleased]: https://github.com/refinedmods/refinedstorage-jei-integration/compare/v0.5.0...HEAD
[Unreleased]: https://github.com/refinedmods/refinedstorage-jei-integration/compare/v0.6.0...HEAD

[0.6.0]: https://github.com/refinedmods/refinedstorage-jei-integration/compare/v0.5.0...v0.6.0

[0.5.0]: https://github.com/refinedmods/refinedstorage-jei-integration/compare/v0.4.0...v0.5.0

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Adds support for:
- [Crowdin](https://crowdin.com/project/refined-storage-jei-integration)
- [Discord](https://discordapp.com/invite/VYzsydb)
- [Twitter](https://twitter.com/refinedmods)
- [Mastodon](https://anvil.social/@refinedmods)

## Building

Expand Down
12 changes: 8 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
refinedarchitectVersion=0.17.1
refinedstorageVersion=2.0.0-milestone.4.7
jeiVersion=19.8.2.99
minecraftVersion=1.21
refinedarchitectVersion=0.19.1
refinedstorageVersion=2.0.0-milestone.4.8
jeiVersion=19.20.0.241
minecraftVersion=1.21.1
# Gradle
org.gradle.jvmargs=-Xmx1G
org.gradle.configureondemand=true
org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage.api.grid.view.GridView;
import com.refinedmods.refinedstorage.api.resource.ResourceAmount;
import com.refinedmods.refinedstorage.common.autocrafting.PatternGridContainerMenu;

import java.util.List;
import javax.annotation.Nullable;

import mezz.jei.api.gui.ingredient.IRecipeSlotView;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.recipe.RecipeIngredientRole;
import mezz.jei.api.recipe.transfer.IRecipeTransferError;
import mezz.jei.api.recipe.transfer.IRecipeTransferHandler;

abstract class AbstractPatternGridRecipeTransferHandler<R>
implements IRecipeTransferHandler<PatternGridContainerMenu, R> {

@Nullable
public static IRecipeTransferError autocraftableHint(final GridView view, final IRecipeSlotsView recipeSlots) {
final List<IRecipeSlotView> inputs = recipeSlots.getSlotViews(RecipeIngredientRole.INPUT);
final boolean allAreAutocraftable = inputs.stream()
.filter(slotView -> !slotView.isEmpty())
.allMatch(slotView -> SlotUtil.getResources(slotView)
.stream()
.map(ResourceAmount::resource)
.anyMatch(view::isAutocraftable));
final List<IRecipeSlotView> autocraftableSlots = inputs.stream()
.filter(slotView -> SlotUtil.getResources(slotView)
.stream()
.map(ResourceAmount::resource)
.anyMatch(view::isAutocraftable))
.toList();
return autocraftableSlots.isEmpty()
? null
: new PatternGridRecipeTransferError(autocraftableSlots, allAreAutocraftable);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage.common.grid.AutocraftableResourceHint;

import mezz.jei.api.recipe.transfer.IRecipeTransferError;
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
import net.minecraft.network.chat.Component;

abstract class AbstractRecipeTransferError implements IRecipeTransferError {
protected static final ClientTooltipComponent MOVE_ITEMS = ClientTooltipComponent.create(
Component.translatable("jei.tooltip.transfer").getVisualOrderText()
);
protected static final int AUTOCRAFTABLE_COLOR = AutocraftableResourceHint.AUTOCRAFTABLE.getColor();

protected static ClientTooltipComponent createAutocraftableHint(final Component component) {
return ClientTooltipComponent.create(component.copy().withColor(AUTOCRAFTABLE_COLOR).getVisualOrderText());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.refinedmods.refinedstorage.jei.common;

import mezz.jei.api.ingredients.IIngredientType;
import mezz.jei.api.ingredients.ITypedIngredient;
import mezz.jei.api.runtime.IClickableIngredient;
import net.minecraft.client.renderer.Rect2i;
Expand All @@ -14,10 +15,21 @@ class ClickableIngredient<T> implements IClickableIngredient<T> {
}

@Override
@SuppressWarnings({"removal"})
public ITypedIngredient<T> getTypedIngredient() {
return ingredient;
}

@Override
public IIngredientType<T> getIngredientType() {
return ingredient.getType();
}

@Override
public T getIngredient() {
return ingredient.getIngredient();
}

@Override
public Rect2i getArea() {
return area;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage.common.Platform;
import com.refinedmods.refinedstorage.common.support.tooltip.HelpClientTooltipComponent;

import java.awt.Color;
import java.util.Collections;
import java.util.List;

import com.mojang.blaze3d.vertex.PoseStack;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
import net.minecraft.network.chat.Component;

import static com.refinedmods.refinedstorage.jei.common.Common.MOD_ID;

class CraftingGridRecipeTransferError extends AbstractRecipeTransferError {
private static final Color MISSING_COLOR = new Color(1.0f, 0.0f, 0.0f, 0.4f);
private static final ClientTooltipComponent MISSING_ITEMS = ClientTooltipComponent.create(
Component.translatable("jei.tooltip.error.recipe.transfer.missing")
.withStyle(ChatFormatting.RED)
.getVisualOrderText());
private static final List<ClientTooltipComponent> MISSING_TOOLTIP = List.of(MOVE_ITEMS, MISSING_ITEMS);
private static final Component CTRL_CLICK_TO_AUTOCRAFT = Component.translatable(
"gui.%s.transfer.ctrl_click_to_autocraft".formatted(MOD_ID)
);

private final List<TransferInput> transferInputs;
private final TransferType type;

CraftingGridRecipeTransferError(final List<TransferInput> transferInputs, final TransferType type) {
this.transferInputs = transferInputs;
this.type = type;
}

@Override
public Type getType() {
return Type.COSMETIC;
}

@Override
public int getButtonHighlightColor() {
return switch (type) {
case MISSING -> MISSING_COLOR.getRGB();
case MISSING_BUT_ALL_AUTOCRAFTABLE, MISSING_BUT_SOME_AUTOCRAFTABLE -> AUTOCRAFTABLE_COLOR;
default -> 0;
};
}

@Override
public void showError(final GuiGraphics graphics,
final int mouseX,
final int mouseY,
final IRecipeSlotsView recipeSlotsView,
final int recipeX,
final int recipeY) {
final PoseStack poseStack = graphics.pose();
poseStack.pushPose();
poseStack.translate(recipeX, recipeY, 0);
transferInputs.forEach(input -> drawInputHighlight(graphics, input));
poseStack.popPose();
Platform.INSTANCE.renderTooltip(graphics, calculateTooltip(), mouseX, mouseY);
}

private List<ClientTooltipComponent> calculateTooltip() {
return switch (type) {
case MISSING -> MISSING_TOOLTIP;
case MISSING_BUT_ALL_AUTOCRAFTABLE -> List.of(
MOVE_ITEMS,
createAutocraftableHint(
Component.translatable("gui.%s.transfer.missing_but_all_autocraftable".formatted(MOD_ID))
),
HelpClientTooltipComponent.createAlwaysDisplayed(CTRL_CLICK_TO_AUTOCRAFT)
);
case MISSING_BUT_SOME_AUTOCRAFTABLE -> List.of(
MOVE_ITEMS,
createAutocraftableHint(
Component.translatable("gui.%s.transfer.missing_but_some_autocraftable".formatted(MOD_ID))
),
HelpClientTooltipComponent.createAlwaysDisplayed(CTRL_CLICK_TO_AUTOCRAFT)
);
default -> Collections.emptyList();
};
}

private static void drawInputHighlight(final GuiGraphics graphics, final TransferInput input) {
switch (input.type()) {
case MISSING -> input.view().drawHighlight(graphics, MISSING_COLOR.getRGB());
case AUTOCRAFTABLE -> input.view().drawHighlight(graphics, AUTOCRAFTABLE_COLOR);
}
}
}
Loading

0 comments on commit 2e44ad3

Please sign in to comment.