Correct itemByStack(), fixes #10 and #36

This commit is contained in:
HappyPikachu 2018-01-10 00:35:27 -05:00
parent 3d7d2de1d1
commit b305ed5f0b
2 changed files with 12 additions and 5 deletions

3
.gitignore vendored
View File

@ -2,4 +2,5 @@
/dependency-reduced-pom.xml /dependency-reduced-pom.xml
/.classpath /.classpath
/.project /.project
/.settings /.settings
/bin/

View File

@ -817,10 +817,16 @@ 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())) {
return item; if (itemStack.getType().isSolid() && item.getType().isSolid()) {
} else if (itemStack.getType().equals(item.getType()) && item.getSubTypeId() == itemStack.getDurability()) { //Solid, so check durability (Podzol, Colored Wool, et al.)
return item; if (item.isDurable()) {
return item;
}
} else {
//Not solid, so ignore durability (Stick, Stone Button, et al.)
return item;
}
} }
} }