mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-16 18:31:53 +01:00
Fixed removeItem implementation
By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
parent
3a61243363
commit
ecc5a3be98
1 changed files with 4 additions and 3 deletions
|
@ -234,18 +234,19 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||
if (first == -1) {
|
||||
item.setAmount( toDelete );
|
||||
leftover.put(i, item);
|
||||
break;
|
||||
} else {
|
||||
ItemStack itemStack = getItem(first);
|
||||
CraftItemStack itemStack = getItem(first);
|
||||
int amount = itemStack.getAmount();
|
||||
|
||||
if (amount <= toDelete) {
|
||||
toDelete -= amount;
|
||||
// clear the slot, all used up
|
||||
clear( i );
|
||||
clear( first );
|
||||
} else {
|
||||
// split the stack and store
|
||||
itemStack.setAmount( amount - toDelete );
|
||||
setItem( i, itemStack );
|
||||
setItem( first, itemStack );
|
||||
toDelete = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue