less restricting use of shapes

This commit is contained in:
gnembon committed 2021-04-12 07:57:04 -03:00
1 parent cd9a5b96c2
commit 92cc545896
2 files changed
+31 -28

No files matched your search

@@ -331,6 +331,8 @@ public class Auxiliary {
expression.addLazyFunction("draw_shape", -1, (c, t, lv) ->
{
CarpetContext cc = (CarpetContext)c;
ServerWorld world = cc.s.getWorld();
MinecraftServer server = world.getServer();
ServerPlayerEntity player[] = {null};
List<Pair<ShapeDispatcher.ExpiringShape, Map<String,Value>>> shapes = new ArrayList<>();
if (lv.size() == 1) // bulk
@@ -340,14 +342,14 @@ public class Auxiliary {
for (Value list : ((ListValue) specLoad).getItems())
{
if (!(list instanceof ListValue)) throw new InternalExpressionException("In bulk mode - shapes need to be provided as a list of shape specs");
shapes.add( ShapeDispatcher.fromFunctionArgs(cc, ((ListValue) list).getItems(), player));
shapes.add( ShapeDispatcher.fromFunctionArgs(server, world, ((ListValue) list).getItems(), player));
}
}
else
{
List<Value> params = new ArrayList<>();
for (LazyValue v : lv) params.add(v.evalValue(c));
shapes.add(ShapeDispatcher.fromFunctionArgs(cc, params, player));
shapes.add(ShapeDispatcher.fromFunctionArgs(server, world, params, player));
}
ShapeDispatcher.sendShape(