mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 21:31:25 +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) {
|
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) {
|
public HashMap<Integer, ItemStack> addItem(ItemStack... items) {
|
||||||
@ -195,7 +202,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
ItemStack item = items[i];
|
ItemStack item = items[i];
|
||||||
while (true) {
|
while (true) {
|
||||||
// Do we already have a stack of it?
|
// Do we already have a stack of it?
|
||||||
int firstPartial = firstPartial( item.getTypeId() );
|
int firstPartial = firstPartial(item);
|
||||||
|
|
||||||
// Drat! no partial stack
|
// Drat! no partial stack
|
||||||
if (firstPartial == -1) {
|
if (firstPartial == -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user