Merge pull request #41 from FlyingPikachu/master

Correct itemByStack(), fixes #10 and #36
This commit is contained in:
Nick Minkler 2018-01-09 22:34:42 -08:00 committed by GitHub
commit bf98e28a93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
/.classpath /.classpath
/.project /.project
/.settings /.settings
/bin/

View File

@ -817,12 +817,18 @@ public class Items {
} }
for (ItemInfo item : items) { for (ItemInfo item : items) {
if (itemStack.getType().equals(item.getType()) && item.isDurable()) { if (itemStack.getType().equals(item.getType())) {
if (itemStack.getType().isSolid() && item.getType().isSolid()) {
//Solid, so check durability (Podzol, Colored Wool, et al.)
if (item.isDurable()) {
return item; return item;
} else if (itemStack.getType().equals(item.getType()) && item.getSubTypeId() == itemStack.getDurability()) { }
} else {
//Not solid, so ignore durability (Stick, Stone Button, et al.)
return item; return item;
} }
} }
}
return null; return null;
} }