Skip to content

Commit 8ff9108

Browse files
committed
use ItemStackSnapshot
1 parent 92f2014 commit 8ff9108

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<groupId>io.github.mooy1</groupId>
88
<artifactId>InfinityLib</artifactId>
9-
<version>1.3.0</version>
9+
<version>1.3.1</version>
1010

1111
<properties>
1212
<maven.compiler.source>1.8</maven.compiler.source>

src/main/java/io/github/mooy1/infinitylib/machines/CraftingBlock.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
2020
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
2121
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;
22+
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.ItemStackSnapshot;
2223
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.ItemUtils;
2324
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
2425
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
@@ -102,8 +103,9 @@ public final CraftingBlock addRecipesFrom(MachineRecipeType recipeType) {
102103

103104
@Nullable
104105
protected final CraftingBlockRecipe getOutput(ItemStack[] input) {
106+
ItemStackSnapshot[] snapshots = ItemStackSnapshot.wrapArray(input);
105107
for (CraftingBlockRecipe recipe : recipes) {
106-
if (recipe.check(input)) {
108+
if (recipe.check(snapshots)) {
107109
return recipe;
108110
}
109111
}

src/main/java/io/github/mooy1/infinitylib/machines/CraftingBlockRecipe.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.bukkit.inventory.ItemStack;
77

88
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
9+
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.ItemStackSnapshot;
910
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
1011

1112
@Getter
@@ -17,11 +18,11 @@ public final class CraftingBlockRecipe {
1718

1819
CraftingBlockRecipe(ItemStack output, ItemStack[] inputs) {
1920
this.output = output;
20-
this.inputs = inputs;
21+
this.inputs = ItemStackSnapshot.wrapArray(inputs);
2122
this.item = SlimefunItem.getByItem(output);
2223
}
2324

24-
boolean check(ItemStack[] input) {
25+
boolean check(ItemStackSnapshot[] input) {
2526
for (int i = 0; i < inputs.length; i++) {
2627
if (!SlimefunUtils.isItemSimilar(input[i], inputs[i], true, true)) {
2728
return false;

src/main/java/io/github/mooy1/infinitylib/machines/MachineBlock.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ protected void setup(BlockMenuPreset preset) {
6868
}
6969

7070
@Override
71-
protected final int[] getInputSlots() {
71+
protected int[] getInputSlots() {
7272
return layout.inputSlots();
7373
}
7474

7575
@Override
76-
protected final int[] getOutputSlots() {
76+
protected int[] getOutputSlots() {
7777
return layout.outputSlots();
7878
}
7979

0 commit comments

Comments
 (0)