mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
inventory fixes
By: Tahg <tahgtahv@gmail.com>
This commit is contained in:
parent
12bb9e3573
commit
0788f8e7d0
@ -179,7 +179,14 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
||||
}
|
||||
|
||||
public int firstPartial(ItemStack item) {
|
||||
return firstPartial(item.getTypeId());
|
||||
CraftItemStack[] inventory = getContents();
|
||||
for (int i = 0; i < inventory.length; i++) {
|
||||
CraftItemStack cItem = inventory[i];
|
||||
if (item != null && cItem.getTypeId() == item.getTypeId() && cItem.getAmount() < cItem.getMaxStackSize() && cItem.getDurability() == item.getDurability()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public HashMap<Integer, ItemStack> addItem(ItemStack... items) {
|
||||
@ -195,7 +202,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
||||
ItemStack item = items[i];
|
||||
while (true) {
|
||||
// Do we already have a stack of it?
|
||||
int firstPartial = firstPartial( item.getTypeId() );
|
||||
int firstPartial = firstPartial(item);
|
||||
|
||||
// Drat! no partial stack
|
||||
if (firstPartial == -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user