-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from refinedmods/release/0.5.0
Release v0.5.0
- Loading branch information
Showing
18 changed files
with
182 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
68 changes: 68 additions & 0 deletions
68
...src/main/java/com/refinedmods/refinedstorage/jei/common/FilterGhostIngredientHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} | ||
|
109 changes: 0 additions & 109 deletions
109
...ommon/src/main/java/com/refinedmods/refinedstorage/jei/common/GhostIngredientHandler.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.