diff --git a/src/main/java/carpet/script/utils/EquipmentInventory.java b/src/main/java/carpet/script/utils/EquipmentInventory.java index 723157c5..79f9cf68 100644 --- a/src/main/java/carpet/script/utils/EquipmentInventory.java +++ b/src/main/java/carpet/script/utils/EquipmentInventory.java @@ -48,7 +48,7 @@ public class EquipmentInventory implements Inventory catch (IndexOutOfBoundsException ignored) { //going out of the index should be really exceptional - return null; + return ItemStack.EMPTY; } return mob.getEquippedStack(slotSlot); } @@ -64,11 +64,9 @@ public class EquipmentInventory implements Inventory catch (IndexOutOfBoundsException ignored) { //going out of the index should be really exceptional - return null; + return ItemStack.EMPTY; } - ItemStack stack = mob.getEquippedStack(slotSlot); - stack.decrement(amount); - return stack; + return mob.getEquippedStack(slotSlot).split(amount); } @Override @@ -82,7 +80,7 @@ public class EquipmentInventory implements Inventory catch (IndexOutOfBoundsException ignored) { //going out of the index should be really exceptional - return null; + return ItemStack.EMPTY; } ItemStack previous = mob.getEquippedStack(slotSlot); mob.equipStack(slotSlot, ItemStack.EMPTY);