diff --git a/CHANGELOG.md b/CHANGELOG.md index c0b2a7bda..6f4bdd79c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ * Fixed #2086 * Fixed #1894 * Fixed #2097 +* Fixed Wither Assembler requiring more items than it actually consumes ## Release Candidate 14 (12 Jul 2020) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AbstractEntityAssembler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AbstractEntityAssembler.java index a3ec2c677..0fa392ced 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AbstractEntityAssembler.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AbstractEntityAssembler.java @@ -180,7 +180,7 @@ public abstract class AbstractEntityAssembler extends SimpleSl @Override public void tick(Block b, SlimefunItem sf, Config data) { - if (String.valueOf(false).equals(BlockStorage.getLocationInfo(b.getLocation(), "enabled"))) { + if ("false".equals(BlockStorage.getLocationInfo(b.getLocation(), "enabled"))) { return; } @@ -217,15 +217,13 @@ public abstract class AbstractEntityAssembler extends SimpleSl } private boolean findResource(BlockMenu menu, ItemStack item, int[] slots) { - Material resource = item.getType(); - int required = item.getAmount(); int found = 0; for (int slot : slots) { - if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(resource), true, false)) { + if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), item, true, false)) { found += menu.getItemInSlot(slot).getAmount(); - if (found > required) { + if (found >= item.getAmount()) { return true; } } @@ -239,7 +237,7 @@ public abstract class AbstractEntityAssembler extends SimpleSl int headCount = getHead().getAmount(); for (int slot : bodySlots) { - if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), new ItemStack(getBody().getType()), true, false)) { + if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), getBody(), true, false)) { int amount = inv.getItemInSlot(slot).getAmount(); if (amount >= bodyCount) { @@ -254,7 +252,7 @@ public abstract class AbstractEntityAssembler extends SimpleSl } for (int slot : headSlots) { - if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), new ItemStack(getHead().getType()), true, false)) { + if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), getHead(), true, false)) { int amount = inv.getItemInSlot(slot).getAmount(); if (amount >= headCount) {