Add support for triples of positions in volume (#321)
* Add support for triples of positions in volume it work good! * Updating docs * made it work with 5 arguments so like volume(x,y,z,pos) or volume(pos,x,y,z). Also renamed previous variables * updated docs * making it smarter * made it work for rect and diamond and cleaned up some earlier code * updated docs * did all ur stuffs * fixin the issues
This commit is contained in:
1 parent
29a81d53d6
commit
986909c1f4
3 files changed
+90
-77
No files matched your search
+12
-7
@@ -2346,10 +2346,11 @@ which would cause the expression not be evaluated for their boolean value.
|
||||
`scan` also handles `continue` and `break` statements, using `continue`'s return value to use in place of expression
|
||||
return value. `break` return value has no effect.
|
||||
|
||||
### `volume(x1, y1, z1, x2, y2, z2, expr)`
|
||||
### `volume(x1, y1, z1, x2, y2, z2, expr), volume(pos1, pos2, expr)`
|
||||
|
||||
Evaluates expression for each block in the area, the same as the `scan` function, but using two opposite corners of
|
||||
the rectangular cuboid. Any corners can be specified, its like you would do with `/fill` command.
|
||||
You can use a position or three coordinates to specify, it doesn't matter.
|
||||
|
||||
For return value and handling `break` and `continue` statements, see `scan` function above.
|
||||
|
||||
@@ -2361,15 +2362,19 @@ Returns the list of 6 neighbouring blocks to the argument. Commonly used with ot
|
||||
for(neighbours(x,y,z),air(_)) => 4 // number of air blocks around a block
|
||||
</pre>
|
||||
|
||||
### `rect(cx, cy, cz, dx?, dy?, dz?, px?, py?, pz?)`
|
||||
### `rect(cx, cy, cz, dx?, dy?, dz?, px?, py?, pz?), rect(centre, difference?, positive_diff?)`
|
||||
|
||||
returns an iterator, just like `range` function that iterates over rectangular cubarea of blocks. If only center
|
||||
point is specified, it iterates over 27 blocks. If `d` arguments are specified, expands selection by the respective
|
||||
number of blocks in each direction. If `p` arguments are specified, it uses `d` for negative offset, and `p` for positive.
|
||||
Returns an iterator, just like `range` function that iterates over a rectangular area of blocks. If only center
|
||||
point is specified, it iterates over 27 blocks. If `d` (`difference`) arguments are specified, expands selection by the respective
|
||||
number of blocks in each direction. If `p` (`positive_diff`) arguments are specified, it uses `d` (`difference`) for negative offset, and `p` for positive.
|
||||
|
||||
### `diamond(cx, cy, cz, radius?, height?)`
|
||||
`centre` can be defined either as three coordinates, a list of three coords, or a block value.
|
||||
`difference` and `positive_diff` can have the same representations, just if its a block, it computes the distance to the center
|
||||
as range instead of taking the values as is.`
|
||||
|
||||
Iterates over a diamond like area of blocks. With no radius and height, its 7 blocks centered around the middle
|
||||
### `diamond(cx, cy, cz, radius?, height?), diamond(centre, radius?, height?)`
|
||||
|
||||
Iterates over a diamond like area of blocks. With no radius and height, its 7 blocks centered around the middle `centre = l(cx, cy, cz)`
|
||||
(block + neighbours). With a radius specified, it expands shape on x and z coords, and with a custom height, on y.
|
||||
Any of these can be zero as well. radius of 0 makes a stick, height of 0 makes a diamond shape pad.
|
||||
# Entity API
|
||||
|
||||
Reference in new issue
Block a user