Better material checking in 1.12-

This commit is contained in:
Esophose 2019-08-15 00:36:17 -06:00
parent 33d589387f
commit 55c5dcbd05

View File

@ -1131,24 +1131,37 @@ public enum Materials {
Materials pmat = null;
// Try 1.13+ names
for (Materials mat : Materials.values()) {
if (name.equalsIgnoreCase(mat.old12Mat)) {
if (name.equalsIgnoreCase(mat.name())) {
if (pmat == null) {
pmat = mat;
}
if (((byte) mat.data) == data) {
cachedSearch.put(mat.old12Mat + "," + data, mat);
cachedSearch.put(mat.name() + "," + data, mat);
return mat;
}
}
}
if (pmat != null) {
return pmat;
// Try 1.12- names
for (Materials mat : Materials.values()) {
if (name.equalsIgnoreCase(mat.name()))
if (name.equalsIgnoreCase(mat.old12Mat)) {
if (pmat == null) {
pmat = mat;
}
if (((byte) mat.data) == data) {
cachedSearch.put(mat.old12Mat + "," + data, mat);
return mat;
}
}
}
return null;
return pmat;
}
public boolean isSpawner() {
@ -1233,7 +1246,7 @@ public enum Materials {
case "CHESTPLATE":
return true;
default:
return false;
return false;
}
}