1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-30 21:07:48 +01:00

Fixed when some crops not displays the proper name (#1199)

This commit is contained in:
KingCreator11 2021-06-01 11:22:05 -04:00 committed by GitHub
parent 03effd2e13
commit 47f47bd3df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1390,47 +1390,39 @@ public enum CMIMaterial {
id = id.replaceAll("_| |minecraft:", "").toLowerCase();
if (id.contains(":")) {
String[] split = id.split(":", 2);
String[] split = id.split(":", 2);
if (split.length > 1) {
try {
Integer ids = Integer.parseInt(split[0]);
Integer data = Integer.parseInt(split[1]);
int ids = Integer.parseInt(split[0]);
if (ids <= 0)
return CMIMaterial.NONE;
return get(ids, data);
} catch (Exception ex) {
return get(ids, Integer.parseInt(split[1]));
} catch (NumberFormatException ex) {
}
try {
Integer data = Integer.parseInt(split[1]);
int data = Integer.parseInt(split[1]);
id = split[0];
CMIMaterial mat = ItemManager.byName.get(id + ":" + data);
if (mat != null) {
if (mat != null && mat.getLegacyId() > 0 && (mat = get(mat.getLegacyId(), data)) != null) {
return mat;
}
CMIMaterial mat1 = ItemManager.byName.get(id);
if (mat1 != null && mat1.getLegacyId() > 0) {
mat = get(mat1.getLegacyId(), data);
if (mat != null) {
return mat;
}
}
} catch (Exception ex) {
} catch (NumberFormatException ex) {
}
}
CMIMaterial mat = ItemManager.byName.get(id);
if (mat != null) {
return mat;
}
try {
mat = ItemManager.byId.get(Integer.parseInt(id));
if (mat != null) {
if ((mat = ItemManager.byId.get(Integer.parseInt(id))) != null) {
return mat;
}
} catch (Exception ex) {
} catch (NumberFormatException ex) {
}
return CMIMaterial.NONE;
@ -2765,4 +2757,4 @@ public enum CMIMaterial {
public boolean isLegacy() {
return legacy;
}
}
}