diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index 2ea87de9..0090417f 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -218,11 +218,13 @@ public class CarpetExpression Value v0 = params.get(0).evalValue(c); if (v0 instanceof BlockValue) { - Value retval = new StringValue(test.apply( ((BlockValue) v0).getBlockState(), ((BlockValue) v0).getPos())); + String strVal = test.apply( ((BlockValue) v0).getBlockState(), ((BlockValue) v0).getPos()); + Value retval = strVal != null ? new StringValue(strVal) : Value.NULL; return (c_, t_) -> retval; } BlockValue block = BlockValue.fromParams(cc, params, 0).block; - Value retval = new StringValue(test.apply(block.getBlockState(), block.getPos())); + String strVal = test.apply(block.getBlockState(), block.getPos()); + Value retval = strVal != null ? new StringValue(strVal) : Value.NULL; return (c_, t_) -> retval; }