diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index 0ab51a92..c80dee86 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -400,6 +400,8 @@ public class CarpetExpression * place_item('piston,x,y,z,'down') // places a piston facing down * place_item('carrot',x,y,z) // attempts to plant a carrot plant. Returns true if could place carrots at that position. * + *
biome(pos)returns biome at that block position.
*set_biome(pos, biome_name)changes biome at that block position.
*update(pos)lower(expr), uppper(expr), title(expr)Returns lowercase, uppercase or titlecase representation of a string representation of the passed expression
+ *
+ * lower('aBc') => 'abc'
+ * upper('aBc') => 'ABC'
+ * title('aBc') => 'Abc'
+ *
+ *
* length(expr)Returns length of the expression, the length of the string, * the length of the integer part of the number, or length of the list
@@ -2483,6 +2492,13 @@ public class Expression implements Cloneable } }); + addUnaryFunction("lower", v -> new StringValue(v.getString().toLowerCase(Locale.ROOT))); + + addUnaryFunction("upper", v -> new StringValue(v.getString().toUpperCase(Locale.ROOT))); + + addUnaryFunction("title", v -> new StringValue(WordUtils.capitalizeFully(v.getString()))); + + addUnaryFunction("type", v -> new StringValue(v.getTypeString())); addUnaryFunction("length", v -> new NumericValue(v.length()));