Skip to content
This repository has been archived by the owner on Aug 31, 2019. It is now read-only.

Fix addItem method in CraftInventory #239

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CraftBukkit/Reduce-ItemStack-copying.patch
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
- }
- }
- return -1;
+ return ListUtils.indexOf(storage(), Objects::isNull);
+ return ListUtils.indexOf(storage(), item -> item == null || Material.AIR.equals(item.getType()));
}

public int firstPartial(int materialId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ private int first(ItemStack item, boolean withAmount) {
}

public int firstEmpty() {
return ListUtils.indexOf(storage(), Objects::isNull);
return ListUtils.indexOf(storage(), item -> item == null || Material.AIR.equals(item.getType()));
}

public int firstPartial(int materialId) {
Expand Down