You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/usage/other/expressions.rst
+20-5Lines changed: 20 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -170,24 +170,39 @@ Functions
170
170
Additionally, it provides the following functions:
171
171
172
172
.. csv-table::
173
-
:widths:6, 15
173
+
:widths:7, 15
174
174
175
-
"``rotate(x, y, angle)``","Rotates the given coordinate pair by the given angle."
175
+
"``rotate(x, y, angle)``","Rotates the given coordinate pair by the given angle, in radians."
176
176
"``swap(x, y)``","Swaps the contents of the 2 given variables."
177
177
"``random()``","Returns a random positive number less than 1.0."
178
178
"``randint(max)``","Returns a random positive integer less than max."
179
+
"``perlin(seed, x, y, z, frequency, octaves, persisence)``","Generates perlin noise with the given parameters."
180
+
"``voronoi(seed, x, y, z, frequency)``","Generates voronoi noise with the given parameters."
181
+
"``ridgedmulti(seed, x, y, z, frequency, octaves)``","Generated ridged multi fractal noise with the given parameters."
179
182
180
183
.. topic:: Block Query Functions
181
184
182
-
The following functions can be used to query blocks in a world in an editting context.
185
+
The following functions can be used to query blocks in a world in an editing context. Note that they still use legacy ID and data, so they may have undefined behaviors for new (1.13+) blocks.
183
186
184
187
.. csv-table::
185
188
:widths: 8, 13
186
189
187
-
"``query(x, y, z, type, data)``","Returns true, if the block at the given coordinates has the given type and data value. If possible, the type and data of the block will be assigned to type and data."
188
-
"``queryRel(dx, dy, dz, type, data)``","Like query, except with relative world coordinates"
190
+
"``query(x, y, z, type, data)``","Returns true if the block at the given coordinates has the given legacy id and data value. If type or data are variables, the id and data of the block will be assigned to that variable."
191
+
"``queryRel(dx, dy, dz, type, data)``","Like query, except with an offset from the currently evaluated block coordinates"
189
192
"``queryAbs(xp, yp, zp, type, data)``","Like query, except with absolute world coordinates"
190
193
194
+
.. topic:: Buffer Functions
195
+
196
+
These functions provide access to data buffers (essentially, arrays). Two buffers are provided, one is a global shared buffer, and one is local to the expression. The function with `g` prepended accesses the global buffer, without the `g` accesses the local buffer.
197
+
198
+
.. csv-table::
199
+
:widths: 8, 13
200
+
201
+
"``(g)megabuf(index)``","Returns the value of the buffer at the given index."
202
+
"``(g)megabuf(index, value)``","Sets the value of the buffer at the given index."
203
+
"``(g)closest(x, y, z, index, count, stride)``","Finds the index of the closest set of x,y,z values (as in, three consecutive buffer values) to the given x,y,z values within *count* iterations and *stride* space between each iteration, starting at the given index value."
0 commit comments