2012-10-01 22:19:09 +02:00
WorldEdit API
2012-10-14 03:45:50 +02:00
=============
The WorldEdit API is composed of multiple modules, each of which is independent and can be used without the other. Each module is contained within a single file.
2012-10-01 22:19:09 +02:00
For more information, see the [README ](README.md ).
2012-10-14 03:45:50 +02:00
Manipulations
-------------
Contained in manipulations.lua, this module allows several node operations to be applied over a region.
2012-10-21 23:49:43 +02:00
### count = worldedit.set(pos1, pos2, nodename)
2012-10-01 22:19:09 +02:00
Sets a region defined by positions `pos1` and `pos2` to `nodename` . To clear to region, use "air" as the value of `nodename` .
Returns the number of nodes set.
2012-10-21 23:49:43 +02:00
### count = worldedit.replace(pos1, pos2, searchnode, replacenode)
2012-10-01 22:19:09 +02:00
Replaces all instances of `searchnode` with `replacenode` in a region defined by positions `pos1` and `pos2` .
Returns the number of nodes replaced.
2012-10-21 23:49:43 +02:00
### count = worldedit.copy(pos1, pos2, axis, amount)
2012-10-14 03:45:50 +02:00
Copies the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") by `amount` nodes.
Returns the number of nodes copied.
2012-10-21 23:49:43 +02:00
### count = worldedit.move(pos1, pos2, axis, amount)
2012-10-14 03:45:50 +02:00
Moves the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") by `amount` nodes.
Returns the number of nodes moved.
2012-10-21 23:49:43 +02:00
### count = worldedit.stack(pos1, pos2, axis, count)
2012-10-14 03:45:50 +02:00
Duplicates the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") `count` times.
Returns the number of nodes stacked.
2012-12-12 23:17:56 +01:00
### count, newpos1, newpos2 = worldedit.transpose(pos1, pos2, axis1, axis2)
2012-10-14 03:45:50 +02:00
Transposes a region defined by the positions `pos1` and `pos2` between the `axis1` and `axis2` axes ("x" or "y" or "z").
2012-12-12 23:17:56 +01:00
Returns the number of nodes transposed, the new position 1, and the new position 2.
2012-10-14 03:45:50 +02:00
2012-10-21 23:49:43 +02:00
### count = worldedit.flip(pos1, pos2, axis)
2012-10-14 03:45:50 +02:00
Flips a region defined by the positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z").
Returns the number of nodes flipped.
2012-12-12 23:17:56 +01:00
### count, newpos2, newpos2 = worldedit.rotate(pos1, pos2, angle)
2012-10-14 03:45:50 +02:00
Rotates a region defined by the positions `pos1` and `pos2` by `angle` degrees clockwise around the y axis (supporting 90 degree increments only).
2012-12-12 23:17:56 +01:00
Returns the number of nodes rotated, the new position 1, and the new position 2.
2012-10-14 03:45:50 +02:00
2012-10-21 23:49:43 +02:00
### count = worldedit.dig(pos1, pos2)
2012-10-14 03:45:50 +02:00
Digs a region defined by positions `pos1` and `pos2` .
Returns the number of nodes dug.
Primitives
----------
Contained in primitives.lua, this module allows the creation of several geometric primitives.
2012-10-21 23:49:43 +02:00
### count = worldedit.hollow_sphere(pos, radius, nodename)
2012-10-01 22:19:09 +02:00
Adds a hollow sphere at `pos` with radius `radius` , composed of `nodename` .
Returns the number of nodes added.
2012-10-21 23:49:43 +02:00
### count = worldedit.sphere(pos, radius, nodename)
2012-10-01 22:19:09 +02:00
Adds a sphere at `pos` with radius `radius` , composed of `nodename` .
Returns the number of nodes added.
2012-10-21 23:49:43 +02:00
### count = worldedit.hollow_cylinder(pos, axis, length, radius, nodename)
2012-10-01 22:19:09 +02:00
Adds a hollow cylinder at `pos` along the `axis` axis ("x" or "y" or "z") with length `length` and radius `radius` , composed of `nodename` .
Returns the number of nodes added.
2012-10-21 23:49:43 +02:00
### count = worldedit.cylinder(pos, axis, length, radius, nodename)
2012-10-01 22:19:09 +02:00
Adds a cylinder at `pos` along the `axis` axis ("x" or "y" or "z") with length `length` and radius `radius` , composed of `nodename` .
Returns the number of nodes added.
2012-10-21 23:49:43 +02:00
### count = worldedit.pyramid(pos, height, nodename)
2012-10-01 22:19:09 +02:00
Adds a pyramid at `pos` with height `height` .
Returns the number of nodes added.
2012-10-21 23:49:43 +02:00
### count = worldedit.spiral(pos, width, height, spacer, nodename)
2012-10-01 22:19:09 +02:00
Adds a spiral at `pos` with width `width` , height `height` , space between walls `spacer` , composed of `nodename` .
2012-12-12 23:17:56 +01:00
Returns the number of nodes added.
2012-10-14 03:45:50 +02:00
Visualization
-------------
Contained in visualization.lua, this module allows nodes to be visualized in different ways.
2012-10-01 22:19:09 +02:00
2012-10-21 23:49:43 +02:00
### volume = worldedit.volume(pos1, pos2)
Determines the volume of the region defined by positions `pos1` and `pos2` .
Returns the volume.
### count = worldedit.hide(pos1, pos2)
2012-10-01 22:19:09 +02:00
2012-10-14 03:45:50 +02:00
Hides all nodes in a region defined by positions `pos1` and `pos2` by non-destructively replacing them with invisible nodes.
2012-10-01 22:19:09 +02:00
2012-10-14 03:45:50 +02:00
Returns the number of nodes hidden.
2012-10-01 22:19:09 +02:00
2012-10-21 23:49:43 +02:00
### count = worldedit.suppress(pos1, pos2, nodename)
2012-10-01 22:19:09 +02:00
2012-10-14 03:45:50 +02:00
Suppresses all instances of `nodename` in a region defined by positions `pos1` and `pos2` by non-destructively replacing them with invisible nodes.
2012-10-01 22:19:09 +02:00
2012-10-14 03:45:50 +02:00
Returns the number of nodes suppressed.
2012-10-01 22:19:09 +02:00
2012-10-21 23:49:43 +02:00
### count = worldedit.highlight(pos1, pos2, nodename)
2012-10-01 22:19:09 +02:00
2012-10-21 23:49:43 +02:00
Highlights all instances of `nodename` in a region defined by positions `pos1` and `pos2` by non-destructively hiding all other nodes.
2012-10-01 22:19:09 +02:00
2012-10-14 03:45:50 +02:00
Returns the number of nodes found.
2012-10-01 22:19:09 +02:00
2012-10-21 23:49:43 +02:00
### count = worldedit.restore(pos1, pos2)
2012-10-01 22:19:09 +02:00
2012-10-14 03:45:50 +02:00
Restores all nodes hidden with WorldEdit functions in a region defined by positions `pos1` and `pos2` .
2012-10-01 22:19:09 +02:00
2012-10-14 03:45:50 +02:00
Returns the number of nodes restored.
2012-10-01 22:19:09 +02:00
2012-10-14 03:45:50 +02:00
Serialization
-------------
Contained in serialization.lua, this module allows regions of nodes to be serialized and deserialized to formats suitable for use outside MineTest.
2012-10-01 22:19:09 +02:00
2012-10-21 23:49:43 +02:00
### data, count = worldedit.serialize(pos1, pos2)
2012-10-01 22:19:09 +02:00
Converts the region defined by positions `pos1` and `pos2` into a single string.
Returns the serialized data and the number of nodes serialized.
2012-10-21 23:49:43 +02:00
### pos1, pos2, count = worldedit.allocate(originpos, value)
Determines the volume the nodes represented by string `value` would occupy if deserialized at `originpos` .
Returns the two corner positions and the number of nodes.
### count = worldedit.deserialize(originpos, value)
2012-10-01 22:19:09 +02:00
Loads the nodes represented by string `value` at position `originpos` .
Returns the number of nodes deserialized.
2012-10-21 23:49:43 +02:00
### count = worldedit.deserialize_old(originpos, value)
2012-10-01 22:19:09 +02:00
Loads the nodes represented by string `value` at position `originpos` , using the older table-based WorldEdit format.
This function is deprecated, and should not be used unless there is a need to support legacy WorldEdit save files.
Returns the number of nodes deserialized.
2012-10-21 23:49:43 +02:00
### count = worldedit.metasave(pos1, pos2, file)
2012-10-01 22:19:09 +02:00
Saves the nodes and meta defined by positions `pos1` and `pos2` into a file.
Returns the number of nodes saved.
2012-10-21 23:49:43 +02:00
### count = worldedit.metaload(pos1, file)
2012-10-01 22:19:09 +02:00
Loads the nodes and meta from `file` to position `pos1` .
Returns the number of nodes loaded.