Skip to content

Commit

Permalink
use ItemUtils#consumeItem
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooy1 committed Sep 7, 2021
1 parent 07f02da commit 02431a1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.mooy1</groupId>
<artifactId>InfinityLib</artifactId>
<version>1.3.4</version>
<version>1.3.5</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.ItemStackSnapshot;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.ItemUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;

@Getter
Expand Down Expand Up @@ -38,7 +39,7 @@ boolean check(Player p) {
void consume(ItemStack[] input) {
for (int i = 0; i < inputs.length; i++) {
if (inputs[i] != null) {
input[i].setAmount(input[i].getAmount() - inputs[i].getAmount());
ItemUtils.consumeItem(input[i], inputs[i].getAmount(), true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.bukkit.inventory.ItemStack;

import io.github.mooy1.infinitylib.common.StackUtils;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.ItemUtils;

final class MachineBlockRecipe {

Expand Down Expand Up @@ -48,11 +49,11 @@ void consume(Map<String, MachineInput> map) {
for (ItemStack item : map.get(strings[i]).items) {
int amt = item.getAmount();
if (amt >= consume) {
item.setAmount(amt - consume);
ItemUtils.consumeItem(item, consume, true);
break;
}
else {
item.setAmount(0);
ItemUtils.consumeItem(item, amt, true);
consume -= amt;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import io.github.thebusybiscuit.slimefun4.implementation.setup.SlimefunItemSetup;

public final class TestStackUtils {
class TestStackUtils {

@BeforeAll
public static void load() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import io.github.mooy1.infinitylib.core.MockAddon;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;

public final class TestMachineRecipeType {
class TestMachineRecipeType {

private static MockAddon addon;
private static MachineRecipeType type;
Expand Down

0 comments on commit 02431a1

Please sign in to comment.