Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.5.0 #25

Merged
merged 6 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.16.9
uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.17.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.16.9
uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.17.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.16.9
uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.17.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.16.9
uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.17.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.16.9
uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.17.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.16.9
uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.17.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.16.9
uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.17.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.16.9
uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.17.1
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.5.0] - 2024-08-11

### Fixed

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

## [0.4.0] - 2024-08-08

### Added
Expand Down Expand Up @@ -60,7 +66,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.4.0...HEAD
[Unreleased]: https://github.com/refinedmods/refinedstorage-jei-integration/compare/v0.5.0...HEAD

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

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

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
refinedarchitectVersion=0.16.9
refinedstorageVersion=2.0.0-milestone.4.6
jeiVersion=19.4.0.28
refinedarchitectVersion=0.17.1
refinedstorageVersion=2.0.0-milestone.4.7
jeiVersion=19.8.2.99
minecraftVersion=1.21
# Gradle
org.gradle.jvmargs=-Xmx1G
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage.common.support.AbstractBaseScreen;
import com.refinedmods.refinedstorage.common.support.containermenu.FilterSlot;
import com.refinedmods.refinedstorage.common.support.packet.c2s.C2SPackets;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import mezz.jei.api.gui.handlers.IGhostIngredientHandler;
import mezz.jei.api.ingredients.ITypedIngredient;
import net.minecraft.client.renderer.Rect2i;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack;

@SuppressWarnings("rawtypes")
class FilterGhostIngredientHandler implements IGhostIngredientHandler<AbstractBaseScreen> {
@Override
public <I> List<Target<I>> getTargetsTyped(final AbstractBaseScreen screen,
final ITypedIngredient<I> ingredient,
final boolean doStart) {
final I i = ingredient.getIngredient();
if (i instanceof ItemStack stack) {
final List<Target<I>> targets = new ArrayList<>();
for (final Slot slot : screen.getMenu().slots) {
if (slot instanceof FilterSlot filterSlot && filterSlot.isActive() && filterSlot.mayPlace(stack)) {
final Rect2i bounds = getBounds(screen, filterSlot);
targets.add(new TargetImpl<>(bounds, filterSlot.index));
}
}
return targets;
}
return Collections.emptyList();
}

private static Rect2i getBounds(final AbstractBaseScreen screen, final Slot slot) {
return new Rect2i(screen.getLeftPos() + slot.x, screen.getTopPos() + slot.y, 17, 17);
}

@Override
public void onComplete() {
// no op
}

private static class TargetImpl<I> implements Target<I> {
private final Rect2i area;
private final int slotIndex;

TargetImpl(final Rect2i area, final int slotIndex) {
this.area = area;
this.slotIndex = slotIndex;
}

@Override
public Rect2i getArea() {
return area;
}

@Override
public void accept(final I ingredient) {
if (ingredient instanceof ItemStack stack) {
C2SPackets.sendFilterSlotChange(stack, slotIndex);
}
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package com.refinedmods.refinedstorage.jei.common;

import com.refinedmods.refinedstorage.common.grid.AbstractGridSynchronizer;
import com.refinedmods.refinedstorage.common.api.grid.GridSynchronizer;
import com.refinedmods.refinedstorage.common.grid.NoopGridSynchronizer;

import javax.annotation.Nullable;

import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.resources.ResourceLocation;

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

class JeiGridSynchronizer extends AbstractGridSynchronizer {
class JeiGridSynchronizer implements GridSynchronizer {
private static final MutableComponent TITLE = Component.translatable("gui.%s.grid.synchronizer".formatted(MOD_ID));
private static final MutableComponent TITLE_TWO_WAY = Component.translatable(
"gui.%s.grid.synchronizer.two_way".formatted(MOD_ID)
Expand Down Expand Up @@ -47,7 +49,7 @@ public String getTextToSynchronizeToGrid() {
}

@Override
public int getXTexture() {
return twoWay ? 32 : 48;
public ResourceLocation getSprite() {
return twoWay ? NoopGridSynchronizer.ON_TWO_WAY : NoopGridSynchronizer.ON;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@

import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.recipe.RecipeIngredientRole;
import mezz.jei.api.recipe.RecipeType;
import mezz.jei.api.recipe.transfer.IRecipeTransferError;
import mezz.jei.api.recipe.transfer.IRecipeTransferHandler;
import mezz.jei.api.recipe.transfer.IUniversalRecipeTransferHandler;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.crafting.RecipeHolder;

class PatternGridProcessingRecipeTransferHandler implements
IRecipeTransferHandler<PatternGridContainerMenu, RecipeHolder<?>> {
class PatternGridProcessingRecipeTransferHandler implements IUniversalRecipeTransferHandler<PatternGridContainerMenu> {
@Override
public Class<? extends PatternGridContainerMenu> getContainerClass() {
return PatternGridContainerMenu.class;
Expand All @@ -29,24 +26,20 @@ public Optional<MenuType<PatternGridContainerMenu>> getMenuType() {
return Optional.of(Menus.INSTANCE.getPatternGrid());
}

@Override
@SuppressWarnings({"DataFlowIssue"})
public RecipeType<RecipeHolder<?>> getRecipeType() {
return null; // universal transfer handler makes this null safe
}

@Override
@Nullable
public IRecipeTransferError transferRecipe(final PatternGridContainerMenu containerMenu,
final RecipeHolder<?> recipe,
final IRecipeSlotsView recipeSlots,
final Player player,
final boolean maxTransfer,
final boolean doTransfer) {
public IRecipeTransferError transferRecipe(
final PatternGridContainerMenu container,
final Object recipe,
final IRecipeSlotsView recipeSlots,
final Player player,
final boolean maxTransfer,
final boolean doTransfer
) {
if (doTransfer) {
final List<List<ResourceAmount>> inputs = SlotUtil.getResources(recipeSlots, RecipeIngredientRole.INPUT);
final List<List<ResourceAmount>> outputs = SlotUtil.getResources(recipeSlots, RecipeIngredientRole.OUTPUT);
containerMenu.transferProcessingRecipe(inputs, outputs);
container.transferProcessingRecipe(inputs, outputs);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public void registerGuiHandlers(final IGuiHandlerRegistration registration) {
AbstractBaseScreen.class,
new ExclusionZonesGuiContainerHandler()
);
registration.addGhostIngredientHandler(AbstractBaseScreen.class, new GhostIngredientHandler());
registration.addGhostIngredientHandler(AbstractBaseScreen.class, new ResourceGhostIngredientHandler());
registration.addGhostIngredientHandler(AbstractBaseScreen.class, new FilterGhostIngredientHandler());
}

@Nullable
Expand Down
Loading
Loading