Update item_category (#473)

* Update item_catrgory so it doesnt crash with an item which has no category
This commit is contained in:
Ghoulboy authored and GitHub committed 2020-09-23 20:59:53 -03:00
1 parent 279ac0f1d3
commit 38bda134b7
1 file changed
+3 -1
@@ -53,7 +53,9 @@ public class Inventories {
expression.addLazyFunction("item_category", 1, (c, t, lv) ->
{
ItemStackArgument item = NBTSerializableValue.parseItem(lv.get(0).evalValue(c).getString());
Value res = new StringValue(item.getItem().getGroup().getName());
ItemGroup ig = item.getItem().getGroup();
Value res = (ig==null)?Value.NULL:new StringValue(ig.getName());
return (_c, _t) -> res;
});