Lookup by id if the string passed to Block/ItemType.lookup() is an integer

This commit is contained in:
zml2008 2012-02-04 21:04:20 -08:00
parent 0bea058328
commit 2f2d3f8045
2 changed files with 10 additions and 2 deletions

View File

@ -234,7 +234,11 @@ public enum BlockType {
* @return
*/
public static BlockType lookup(String name, boolean fuzzy) {
return StringUtil.lookup(lookup, name, fuzzy);
try {
return fromID(Integer.parseInt(name));
} catch (NumberFormatException e) {
return StringUtil.lookup(lookup, name, fuzzy);
}
}
/**

View File

@ -412,7 +412,11 @@ public enum ItemType {
* @return
*/
public static ItemType lookup(String name, boolean fuzzy) {
return StringUtil.lookup(lookup, name, fuzzy);
try {
return fromID(Integer.parseInt(name));
} catch (NumberFormatException e) {
return StringUtil.lookup(lookup, name, fuzzy);
}
}
/**