issues with mocked inventories, fixes #946

This commit is contained in:
gnembon committed 2021-06-22 00:35:03 -03:00
1 parent 85415463cd
commit cf6eb2c7d6
1 file changed
+4 -6
@@ -48,7 +48,7 @@ public class EquipmentInventory implements Inventory
catch (IndexOutOfBoundsException ignored) catch (IndexOutOfBoundsException ignored)
{ {
//going out of the index should be really exceptional //going out of the index should be really exceptional
return null; return ItemStack.EMPTY;
} }
return mob.getEquippedStack(slotSlot); return mob.getEquippedStack(slotSlot);
} }
@@ -64,11 +64,9 @@ public class EquipmentInventory implements Inventory
catch (IndexOutOfBoundsException ignored) catch (IndexOutOfBoundsException ignored)
{ {
//going out of the index should be really exceptional //going out of the index should be really exceptional
return null; return ItemStack.EMPTY;
} }
ItemStack stack = mob.getEquippedStack(slotSlot); return mob.getEquippedStack(slotSlot).split(amount);
stack.decrement(amount);
return stack;
} }
@Override @Override
@@ -82,7 +80,7 @@ public class EquipmentInventory implements Inventory
catch (IndexOutOfBoundsException ignored) catch (IndexOutOfBoundsException ignored)
{ {
//going out of the index should be really exceptional //going out of the index should be really exceptional
return null; return ItemStack.EMPTY;
} }
ItemStack previous = mob.getEquippedStack(slotSlot); ItemStack previous = mob.getEquippedStack(slotSlot);
mob.equipStack(slotSlot, ItemStack.EMPTY); mob.equipStack(slotSlot, ItemStack.EMPTY);