Update item_category (#473)
* Update item_catrgory so it doesnt crash with an item which has no category
This commit is contained in:
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) ->
|
expression.addLazyFunction("item_category", 1, (c, t, lv) ->
|
||||||
{
|
{
|
||||||
ItemStackArgument item = NBTSerializableValue.parseItem(lv.get(0).evalValue(c).getString());
|
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;
|
return (_c, _t) -> res;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user