return { cBlockArea = { Desc = [[ This class is used when multiple adjacent blocks are to be manipulated. Because of chunking and multithreading, manipulating single blocks using {{cWorld|cWorld:SetBlock}}() is a rather time-consuming operation (locks for exclusive access need to be obtained, chunk lookup is done for each block), so whenever you need to manipulate multiple adjacent blocks, it's better to wrap the operation into a cBlockArea access. cBlockArea is capable of reading / writing across chunk boundaries, has no chunk lookups for get and set operations and is not subject to multithreading locking (because it is not shared among threads).
cBlockArea remembers its origin (MinX, MinY, MinZ coords in the Read() call) and therefore supports absolute as well as relative get / set operations. Despite that, the contents of a cBlockArea can be written back into the world at any coords. Most functions in this class come in pair, one that works with the absolute coords (what the coords would have been in the original world the area was read from) and one (usually with "Rel" in their name) that work on the relative coords (those range from zero to Size - 1). Also note that most functions will raise an error if an out-of-range coord is supplied to them.
cBlockArea can hold any combination of the following datatypes:
Block entities stored inside a cBlockArea object have their position set to the relative position within the area.
Typical usage:
function Callback({{cBlockEntity|BlockEntity}})Returns false if there's no block entity at the specified coords. Returns the value that the callback has returned otherwise.", }, { Params = { { Name = "Coords", Type = "Vector3i", }, { Name = "Callback", Type = "function", }, }, Returns = { Name = "HasCalled", Type = "boolean", }, Notes = "Calls the specified callback with the block entity at the specified absolute coords. The CallbackFunction has the following signature:
function Callback({{cBlockEntity|BlockEntity}})Returns false if there's no block entity at the specified coords. Returns the value that the callback has returned otherwise.", }, }, -- DoWithBlockEntityAt DoWithBlockEntityRelAt = { { Params = { { Name = "RelX", Type = "number", }, { Name = "RelY", Type = "number", }, { Name = "RelZ", Type = "number", }, { Name = "Callback", Type = "function", }, }, Returns = { Name = "HasCalled", Type = "boolean", }, Notes = "Calls the specified callback with the block entity at the specified relative coords. The CallbackFunction has the following signature:
function Callback({{cBlockEntity|BlockEntity}})Returns false if there's no block entity at the specified coords. Returns the value that the callback has returned otherwise.", }, { Params = { { Name = "RelCoords", Type = "Vector3i", }, { Name = "Callback", Type = "function", }, }, Returns = { Name = "HasCalled", Type = "boolean", }, Notes = "Calls the specified callback with the block entity at the specified relative coords. The CallbackFunction has the following signature:
function Callback({{cBlockEntity|BlockEntity}})Returns false if there's no block entity at the specified coords. Returns the value that the callback has returned otherwise.", }, }, -- DoWithBlockEntityRelAt DumpToRawFile = { Params = { { Name = "FileName", Type = "string", }, }, Notes = "Dumps the raw data into a file. For debugging purposes only.", }, Expand = { Params = { { Name = "SubMinX", Type = "number", }, { Name = "AddMaxX", Type = "number", }, { Name = "SubMinY", Type = "number", }, { Name = "AddMaxY", Type = "number", }, { Name = "SubMinZ", Type = "number", }, { Name = "AddMaxZ", Type = "number", }, }, Notes = "Expands the specified number of blocks from each border. Modifies the size of this blockarea object. New blocks created with this operation are filled with zeroes.", }, Fill = { Params = { { Name = "DataTypes", Type = "number", }, { Name = "BlockType", Type = "number", }, { Name = "BlockMeta", Type = "number", IsOptional = true, }, { Name = "BlockLight", Type = "number", IsOptional = true, }, { Name = "BlockSkyLight", Type = "number", IsOptional = true, }, }, Notes = "Fills the entire block area with the same values, specified. Uses the DataTypes param to determine which content types are modified.", }, FillRelCuboid = { { Params = { { Name = "RelCuboid", Type = "cCuboid", }, { Name = "DataTypes", Type = "number", }, { Name = "BlockType", Type = "number", }, { Name = "BlockMeta", Type = "number", IsOptional = true, }, { Name = "BlockLight", Type = "number", IsOptional = true, }, { Name = "BlockSkyLight", Type = "number", IsOptional = true, }, }, Notes = "Fills the specified cuboid (in relative coords) with the same values (like Fill() ).", }, { Params = { { Name = "MinRelX", Type = "number", }, { Name = "MaxRelX", Type = "number", }, { Name = "MinRelY", Type = "number", }, { Name = "MaxRelY", Type = "number", }, { Name = "MinRelZ", Type = "number", }, { Name = "MaxRelZ", Type = "number", }, { Name = "DataTypes", Type = "number", }, { Name = "BlockType", Type = "number", }, { Name = "BlockMeta", Type = "number", IsOptional = true, }, { Name = "BlockLight", Type = "number", IsOptional = true, }, { Name = "BlockSkyLight", Type = "number", IsOptional = true, }, }, Notes = "Fills the specified cuboid with the same values (like Fill() ).", }, }, ForEachBlockEntity = { Params = { { Name = "Coords", Type = "Vector3i", }, { Name = "Callback", Type = "function", }, }, Returns = { Name = "HasProcessedAll", Type = "boolean", }, Notes = "Calls the specified callback with the block entity for each block entity contained in the object. Returns true if all block entities have been processed (including when there are zero block entities), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature:
function Callback({{cBlockEntity|BlockEntity}})The callback should return false or no value to continue with the next block entity, or true to abort the enumeration.", }, -- ForEachBlockEntity GetBlockLight = { Params = { { Name = "BlockX", Type = "number", }, { Name = "BlockY", Type = "number", }, { Name = "BlockZ", Type = "number", }, }, Returns = { { Name = "BlockLight", Type = "number", }, }, Notes = "Returns the blocklight (emissive light) at the specified absolute coords", }, GetBlockMeta = { Params = { { Name = "BlockX", Type = "number", }, { Name = "BlockY", Type = "number", }, { Name = "BlockZ", Type = "number", }, }, Returns = { { Name = "BlockMeta", Type = "number", }, }, Notes = "Returns the block meta at the specified absolute coords", }, GetBlockSkyLight = { Params = { { Name = "BlockX", Type = "number", }, { Name = "BlockY", Type = "number", }, { Name = "BlockZ", Type = "number", }, }, Returns = { { Name = "BlockSkyLight", Type = "number", }, }, Notes = "Returns the skylight at the specified absolute coords", }, GetBlockType = { Params = { { Name = "BlockX", Type = "number", }, { Name = "BlockY", Type = "number", }, { Name = "BlockZ", Type = "number", }, }, Returns = { { Name = "BLOCKTYPE", Type = "number", }, }, Notes = "Returns the block type at the specified absolute coords", }, GetBlockTypeMeta = { Params = { { Name = "BlockX", Type = "number", }, { Name = "BlockY", Type = "number", }, { Name = "BlockZ", Type = "number", }, }, Returns = { { Name = "BlockType", Type = "number", }, { Name = "BlockMeta", Type = "number", }, }, Notes = "Returns the block type and meta at the specified absolute coords", }, GetBounds = { Params = {}, Returns = { { Name = "Bounds", Type = "cCuboid", } }, Notes = "Returns the {{cCuboid|cuboid}} that specifies the original coords of the world from which the area was read. Basically constructs a {{cCuboid}} out of GetOrigin() and GetOrigin() + GetCoordRange().", }, GetCoordRange = { Returns = { { Name = "MaxX", Type = "number", }, { Name = "MaxY", Type = "number", }, { Name = "MaxZ", Type = "number", }, }, Notes = "Returns the maximum relative coords in all 3 axes. See also GetSize().", }, GetDataTypes = { Returns = { { Type = "number", }, }, Notes = "Returns the mask of datatypes (ba* constants added together) that the object is currently holding.", }, GetNonAirCropRelCoords = { Params = { { Name = "IgnoredBlockType", Type = "number", IsOptional = true, }, }, Returns = { { Name = "MinRelX", Type = "number", }, { Name = "MinRelY", Type = "number", }, { Name = "MinRelZ", Type = "number", }, { Name = "MaxRelX", Type = "number", }, { Name = "MaxRelY", Type = "number", }, { Name = "MaxRelZ", Type = "number", }, }, Notes = "Returns the minimum and maximum coords in each direction for the first block in each direction of type different to IgnoredBlockType (E_BLOCK_AIR by default). If there are no non-ignored blocks within the area, or blocktypes are not present, the returned values are reverse-ranges (MinX <- m_RangeX, MaxX <- 0 etc.). IgnoreBlockType defaults to air.", }, GetOrigin = { Returns = { { Name = "OriginX", Type = "number", }, { Name = "OriginY", Type = "number", }, { Name = "OriginZ", Type = "number", }, }, Notes = "Returns the origin coords of where the area was read from.", }, GetOriginX = { Returns = { { Type = "number", }, }, Notes = "Returns the origin x-coord", }, GetOriginY = { Returns = { { Type = "number", }, }, Notes = "Returns the origin y-coord", }, GetOriginZ = { Returns = { { Type = "number", }, }, Notes = "Returns the origin z-coord", }, GetRelBlockLight = { Params = { { Name = "RelBlockX", Type = "number", }, { Name = "RelBlockY", Type = "number", }, { Name = "RelBlockZ", Type = "number", }, }, Returns = { { Name = "NIBBLETYPE", Type = "number", }, }, Notes = "Returns the blocklight at the specified relative coords", }, GetRelBlockMeta = { Params = { { Name = "RelBlockX", Type = "number", }, { Name = "RelBlockY", Type = "number", }, { Name = "RelBlockZ", Type = "number", }, }, Returns = { { Name = "NIBBLETYPE", Type = "number", }, }, Notes = "Returns the block meta at the specified relative coords", }, GetRelBlockSkyLight = { Params = { { Name = "RelBlockX", Type = "number", }, { Name = "RelBlockY", Type = "number", }, { Name = "RelBlockZ", Type = "number", }, }, Returns = { { Name = "NIBBLETYPE", Type = "number", }, }, Notes = "Returns the skylight at the specified relative coords", }, GetRelBlockType = { Params = { { Name = "RelBlockX", Type = "number", }, { Name = "RelBlockY", Type = "number", }, { Name = "RelBlockZ", Type = "number", }, }, Returns = { { Name = "BLOCKTYPE", Type = "number", }, }, Notes = "Returns the block type at the specified relative coords", }, GetRelBlockTypeMeta = { Params = { { Name = "RelBlockX", Type = "number", }, { Name = "RelBlockY", Type = "number", }, { Name = "RelBlockZ", Type = "number", }, }, Returns = { { Name = "BLOCKTYPE", Type = "number", }, { Name = "NIBBLETYPE", Type = "number", }, }, Notes = "Returns the block type and meta at the specified relative coords", }, GetSize = { Returns = { { Name = "SizeX", Type = "number", }, { Name = "SizeY", Type = "number", }, { Name = "SizeZ", Type = "number", }, }, Notes = "Returns the size of the area in all 3 axes. See also GetCoordRange().", }, GetSizeX = { Returns = { { Type = "number", }, }, Notes = "Returns the size of the held data in the x-axis", }, GetSizeY = { Returns = { { Type = "number", }, }, Notes = "Returns the size of the held data in the y-axis", }, GetSizeZ = { Returns = { { Type = "number", }, }, Notes = "Returns the size of the held data in the z-axis", }, GetVolume = { Returns = { { Type = "number", }, }, Notes = "Returns the volume of the area - the total number of blocks stored within.", }, GetWEOffset = { Returns = { { Type = "Vector3i", }, }, Notes = "Returns the WE offset, a data value sometimes stored in the schematic files. Cuberite doesn't use this value, but provides access to it using this method. The default is {0, 0, 0}.", }, HasBlockEntities = { Returns = { { Type = "boolean", }, }, Notes = "Returns true if current datatypes include block entities.", }, HasBlockLights = { Returns = { { Type = "boolean", }, }, Notes = "Returns true if current datatypes include blocklight", }, HasBlockMetas = { Returns = { { Type = "boolean", }, }, Notes = "Returns true if current datatypes include block metas", }, HasBlockSkyLights = { Returns = { { Type = "boolean", }, }, Notes = "Returns true if current datatypes include skylight", }, HasBlockTypes = { Returns = { { Type = "boolean", }, }, Notes = "Returns true if current datatypes include block types", }, IsValidCoords = { { Params = { { Name = "BlockX", Type = "number", }, { Name = "BlockY", Type = "number", }, { Name = "BlockZ", Type = "number", }, }, Returns = { { Type = "boolean", }, }, Notes = "Returns true if the specified absolute coords are within the area.", }, { Params = { { Name = "Coords", Type = "Vector3i", }, }, Returns = { { Type = "boolean", }, }, Notes = "Returns true if the specified absolute coords are within the area.", }, }, -- IsValidCoords IsValidDataTypeCombination = { IsStatic = true, Params = { { Name = "DataTypes", Type = "number", }, }, Returns = { { Type = "boolean", }, }, Notes = "Returns true if the specified combination of datatypes (ba* constants added together) is valid. Most combinations are valid, but for example baBlockEntities without baTypes is an invalid combination.", }, -- IsValidDataTypeCombination IsValidRelCoords = { { Params = { { Name = "RelBlockX", Type = "number", }, { Name = "RelBlockY", Type = "number", }, { Name = "RelBlockZ", Type = "number", }, }, Returns = { { Type = "boolean", } }, Notes = "Returns true if the specified relative coords are within the area.", }, { Params = { { Name = "RelCoords", Type = "Vector3i", }, }, Returns = { { Type = "boolean", } }, Notes = "Returns true if the specified relative coords are within the area.", }, }, -- IsValidRelCoords LoadFromSchematicFile = { Params = { { Name = "FileName", Type = "string", }, }, Returns = { { Type = "boolean" }, }, Notes = "Clears current content and loads new content from the specified schematic file. Returns true if successful. Returns false and logs error if unsuccessful, old content is preserved in such a case.", }, LoadFromSchematicString = { Params = { { Name = "SchematicData", Type = "string", }, }, Returns = { { Type = "boolean" }, }, Notes = "Clears current content and loads new content from the specified string (assumed to contain .schematic data). Returns true if successful. Returns false and logs error if unsuccessful, old content is preserved in such a case.", }, Merge = { { Params = { { Name = "BlockAreaSrc", Type = "cBlockArea", }, { Name = "RelMinCoords", Type = "number", }, { Name = "Strategy", Type = "string", }, }, Notes = "Merges BlockAreaSrc into this object at the specified relative coords, using the specified strategy", }, { Params = { { Name = "BlockAreaSrc", Type = "cBlockArea", }, { Name = "RelX", Type = "number", }, { Name = "RelY", Type = "number", }, { Name = "RelZ", Type = "number", }, { Name = "Strategy", Type = "string", }, }, Notes = "Merges BlockAreaSrc into this object at the specified relative coords, using the specified strategy", }, }, MirrorXY = { Notes = "Mirrors this block area around the XY plane. Modifies blocks' metas (if present) to match (i. e. furnaces facing the opposite direction).", }, MirrorXYNoMeta = { Notes = "Mirrors this block area around the XY plane. Doesn't modify blocks' metas.", }, MirrorXZ = { Notes = "Mirrors this block area around the XZ plane. Modifies blocks' metas (if present)", }, MirrorXZNoMeta = { Notes = "Mirrors this block area around the XZ plane. Doesn't modify blocks' metas.", }, MirrorYZ = { Notes = "Mirrors this block area around the YZ plane. Modifies blocks' metas (if present)", }, MirrorYZNoMeta = { Notes = "Mirrors this block area around the YZ plane. Doesn't modify blocks' metas.", }, Read = { { Params = { { Name = "World", Type = "cWorld", }, { Name = "Cuboid", Type = "cCuboid", }, }, Returns = { { Name = "IsSuccess", Type = "boolean", }, }, Notes = "Reads the area from World, returns true if successful. baTypes and baMetas are read.", }, { Params = { { Name = "World", Type = "cWorld", }, { Name = "Cuboid", Type = "cCuboid", }, { Name = "DataTypes", Type = "number", }, }, Returns = { { Name = "IsSuccess", Type = "boolean", }, }, Notes = "Reads the area from World, returns true if successful. DataTypes is the sum of baXXX datatypes to be read", }, { Params = { { Name = "World", Type = "cWorld", }, { Name = "Point1", Type = "Vector3i", }, { Name = "Point2", Type = "Vector3i", }, }, Returns = { { Name = "IsSuccess", Type = "boolean", }, }, Notes = "Reads the area from World, returns true if successful. baTypes and baMetas are read.", }, { Params = { { Name = "World", Type = "cWorld", }, { Name = "Point1", Type = "Vector3i", }, { Name = "Point2", Type = "Vector3i", }, { Name = "DataTypes", Type = "number", }, }, Returns = { { Name = "IsSuccess", Type = "boolean", }, }, Notes = "Reads the area from World, returns true if successful. DataTypes is a sum of baXXX datatypes to be read.", }, { Params = { { Name = "World", Type = "cWorld", }, { Name = "MinX", Type = "number", }, { Name = "MaxX", Type = "number", }, { Name = "MinY", Type = "number", }, { Name = "MaxY", Type = "number", }, { Name = "MinZ", Type = "number", }, { Name = "MaxZ", Type = "number", }, }, Returns = { { Type = "boolean", }, }, Notes = "Reads the area from World, returns true if successful. baTypes and baMetas are read.", }, { Params = { { Name = "World", Type = "cWorld", }, { Name = "MinX", Type = "number", }, { Name = "MaxX", Type = "number", }, { Name = "MinY", Type = "number", }, { Name = "MaxY", Type = "number", }, { Name = "MinZ", Type = "number", }, { Name = "MaxZ", Type = "number", }, { Name = "DataTypes", Type = "number", }, }, Returns = { { Type = "boolean", }, }, Notes = "Reads the area from World, returns true if successful. DataTypes is a sum of baXXX datatypes to read.", }, }, RelLine = { { Params = { { Name = "RelPoint1", Type = "Vector3i", }, { Name = "RelPoint2", Type = "Vector3i", }, { Name = "DataTypes", Type = "number", }, { Name = "BlockType", Type = "number", }, { Name = "BlockMeta", Type = "number", IsOptional = true, }, { Name = "BlockLight", Type = "number", IsOptional = true, }, { Name = "BlockSkyLight", Type = "number", IsOptional = true, }, }, Notes = "Draws a line between the two specified points. Sets only datatypes specified by DataTypes (baXXX constants).", }, { Params = { { Name = "RelX1", Type = "number", }, { Name = "RelY1", Type = "number", }, { Name = "RelZ1", Type = "number", }, { Name = "RelX2", Type = "number", }, { Name = "RelY2", Type = "number", }, { Name = "RelZ2", Type = "number", }, { Name = "DataTypes", Type = "number", }, { Name = "BlockType", Type = "number", }, { Name = "BlockMeta", Type = "number", IsOptional = true, }, { Name = "BlockLight", Type = "number", IsOptional = true, }, { Name = "BlockSkyLight", Type = "number", IsOptional = true, }, }, Notes = "Draws a line between the two specified points. Sets only datatypes specified by DataTypes (baXXX constants).", }, }, RotateCCW = { Notes = "Rotates the block area around the Y axis, counter-clockwise (east -> north). Modifies blocks' metas (if present) to match.", }, RotateCCWNoMeta = { Notes = "Rotates the block area around the Y axis, counter-clockwise (east -> north). Doesn't modify blocks' metas.", }, RotateCW = { Notes = "Rotates the block area around the Y axis, clockwise (north -> east). Modifies blocks' metas (if present) to match.", }, RotateCWNoMeta = { Notes = "Rotates the block area around the Y axis, clockwise (north -> east). Doesn't modify blocks' metas.", }, SaveToSchematicFile = { Params = { { Name = "FileName", Type = "string", }, }, Returns = { { Type = "boolean", }, }, Notes = "Saves the current contents to a schematic file. Returns true if successful.", }, SaveToSchematicString = { Returns = { { Type = "string", }, }, Notes = "Saves the current contents to a string (in a .schematic file format). Returns the data if successful, nil if failed.", }, SetBlockLight = { Params = { { Name = "BlockX", Type = "number", }, { Name = "BlockY", Type = "number", }, { Name = "BlockZ", Type = "number", }, { Name = "BlockLight", Type = "number", }, }, Notes = "Sets the blocklight at the specified absolute coords", }, SetBlockMeta = { Params = { { Name = "BlockX", Type = "number", }, { Name = "BlockY", Type = "number", }, { Name = "BlockZ", Type = "number", }, { Name = "BlockMeta", Type = "number", }, }, Notes = "Sets the block meta at the specified absolute coords", }, SetBlockSkyLight = { Params = { { Name = "BlockX", Type = "number", }, { Name = "BlockY", Type = "number", }, { Name = "BlockZ", Type = "number", }, { Name = "BlockSkyLight", Type = "number", }, }, Notes = "Sets the skylight at the specified absolute coords", }, SetBlockType = { Params = { { Name = "BlockX", Type = "number", }, { Name = "BlockY", Type = "number", }, { Name = "BlockZ", Type = "number", }, { Name = "BlockType", Type = "number", }, }, Notes = "Sets the block type at the specified absolute coords", }, SetBlockTypeMeta = { Params = { { Name = "BlockX", Type = "number", }, { Name = "BlockY", Type = "number", }, { Name = "BlockZ", Type = "number", }, { Name = "BlockType", Type = "number", }, { Name = "BlockMeta", Type = "number", }, }, Notes = "Sets the block type and meta at the specified absolute coords", }, SetOrigin = { { Params = { { Name = "Origin", Type = "Vector3i", }, }, Notes = "Resets the origin for the absolute coords. Only affects how absolute coords are translated into relative coords.", }, { Params = { { Name = "OriginX", Type = "number", }, { Name = "OriginY", Type = "number", }, { Name = "OriginZ", Type = "number", }, }, Notes = "Resets the origin for the absolute coords. Only affects how absolute coords are translated into relative coords.", }, }, SetRelBlockLight = { Params = { { Name = "RelBlockX", Type = "number", }, { Name = "RelBlockY", Type = "number", }, { Name = "RelBlockZ", Type = "number", }, { Name = "BlockLight", Type = "number", }, }, Notes = "Sets the blocklight at the specified relative coords", }, SetRelBlockMeta = { Params = { { Name = "RelBlockX", Type = "number", }, { Name = "RelBlockY", Type = "number", }, { Name = "RelBlockZ", Type = "number", }, { Name = "BlockMeta", Type = "number", }, }, Notes = "Sets the block meta at the specified relative coords", }, SetRelBlockSkyLight = { Params = { { Name = "RelBlockX", Type = "number", }, { Name = "RelBlockY", Type = "number", }, { Name = "RelBlockZ", Type = "number", }, { Name = "BlockSkyLight", Type = "number", }, }, Notes = "Sets the skylight at the specified relative coords", }, SetRelBlockType = { Params = { { Name = "RelBlockX", Type = "number", }, { Name = "RelBlockY", Type = "number", }, { Name = "RelBlockZ", Type = "number", }, { Name = "BlockType", Type = "number", }, }, Notes = "Sets the block type at the specified relative coords", }, SetRelBlockTypeMeta = { Params = { { Name = "RelBlockX", Type = "number", }, { Name = "RelBlockY", Type = "number", }, { Name = "RelBlockZ", Type = "number", }, { Name = "BlockType", Type = "number", }, { Name = "BlockMeta", Type = "number", }, }, Notes = "Sets the block type and meta at the specified relative coords", }, SetWEOffset = { { Params = { { Name = "Offset", Type = "Vector3i", }, }, Notes = "Sets the WE offset, a data value sometimes stored in the schematic files. Mostly used for WorldEdit. Cuberite doesn't use this value, but provides access to it using this method.", }, { Params = { { Name = "OffsetX", Type = "number", }, { Name = "OffsetY", Type = "number", }, { Name = "OffsetZ", Type = "number", }, }, Notes = "Sets the WE offset, a data value sometimes stored in the schematic files. Mostly used for WorldEdit. Cuberite doesn't use this value, but provides access to it using this method.", }, }, Write = { { Params = { { Name = "World", Type = "cWorld", }, { Name = "MinPoint", Type = "Vector3i", }, }, Returns = { { Name = "IsSuccess", Type = "boolean", }, }, Notes = "Writes the area into World at the specified coords, returns true if successful. baTypes and baMetas are written.", }, { Params = { { Name = "World", Type = "cWorld", }, { Name = "MinPoint", Type = "Vector3i", }, { Name = "DataTypes", Type = "number", }, }, Returns = { { Name = "IsSuccess", Type = "boolean", }, }, Notes = "Writes the area into World at the specified coords, returns true if successful. DataTypes is the sum of baXXX datatypes to write.", }, { Params = { { Name = "World", Type = "cWorld", }, { Name = "MinX", Type = "number", }, { Name = "MinY", Type = "number", }, { Name = "MinZ", Type = "number", }, }, Returns = { { Name = "IsSuccess", Type = "boolean", }, }, Notes = "Writes the area into World at the specified coords, returns true if successful. baTypes and baMetas are written.", }, { Params = { { Name = "World", Type = "cWorld", }, { Name = "MinX", Type = "number", }, { Name = "MinY", Type = "number", }, { Name = "MinZ", Type = "number", }, { Name = "DataTypes", Type = "number", }, }, Returns = { { Name = "IsSuccess", Type = "boolean", }, }, Notes = "Writes the area into World at the specified coords, returns true if successful. DataTypes is the sum of baXXX datatypes to write.", }, }, }, Constants = { baBlockEntities = { Notes = "Operations should work on block entities. Note that this flag is invalid without baTypes.", }, baLight = { Notes = "Operations should work on block (emissive) light", }, baMetas = { Notes = "Operations should work on block metas", }, baSkyLight = { Notes = "Operations should work on skylight", }, baTypes = { Notes = "Operation should work on block types", }, msDifference = { Notes = "Block becomes air if 'self' and src are the same. Otherwise it becomes the src block.", }, msFillAir = { Notes = "'self' is overwritten by Src only where 'self' has air blocks", }, msImprint = { Notes = "Src overwrites 'self' anywhere where 'self' has non-air blocks", }, msLake = { Notes = "Special mode for merging lake images", }, msMask = { Notes = "The blocks that are exactly the same are kept in 'self', all differing blocks are replaced by air", }, msOverwrite = { Notes = "Src overwrites anything in 'self'", }, msSimpleCompare = { Notes = "The blocks that are exactly the same are replaced with air, all differing blocks are replaced by stone", }, msSpongePrint = { Notes = "Similar to msImprint, sponge block doesn't overwrite anything, all other blocks overwrite everything", }, }, ConstantGroups = { BATypes = { Include = "ba.*", TextBefore = [[ The following constants are used to signalize the datatype to read or write: ]], }, eMergeStrategy = { Include = "ms.*", TextAfter = "See below for a detailed explanation of the individual merge strategies.", TextBefore = [[ The Merge() function can use different strategies to combine the source and destination blocks. The following constants are used: ]], }, }, AdditionalInfo = { { Header = "Merge strategies", Contents = [[
The strategy parameter specifies how individual blocks are combined together, using the table below.
area block | result | |||
---|---|---|---|---|
this | Src | msOverwrite | msFillAir | msImprint |
air | air | air | air | air |
A | air | air | A | A |
air | B | B | B | B |
A | B | B | A | B |
A | A | A | A | A |
So to sum up:
For each strategy, evaluate the table rows from top downwards, the first match wins.
msDifference - changes all the blocks which are the same to air. Otherwise the source block gets placed.
area block | Notes | ||
---|---|---|---|
* | B | B | The blocks are different so we use block B |
B | B | Air | The blocks are the same so we get air. |
msLake - used for merging areas with lava and water lakes, in the appropriate generator.
area block | Notes | ||
---|---|---|---|
self | Src | result | |
A | sponge | A | Sponge is the NOP block |
* | air | air | Air always gets hollowed out, even under the oceans |
water | * | water | Water is never overwritten |
lava | * | lava | Lava is never overwritten |
* | water | water | Water always overwrites anything |
* | lava | lava | Lava always overwrites anything |
dirt | stone | stone | Stone overwrites dirt |
grass | stone | stone | ... and grass |
mycelium | stone | stone | ... and mycelium |
A | stone | A | ... but nothing else |
A | * | A | Everything else is left as it is |
msSpongePrint - used for most prefab-generators to merge the prefabs. Similar to msImprint, but uses the sponge block as the NOP block instead, so that the prefabs may carve out air pockets, too.
area block | Notes | ||
---|---|---|---|
self | Src | result | |
A | sponge | A | Sponge is the NOP block |
* | B | B | Everything else overwrites anything |
msMask - the blocks that are the same in the other area are kept, all the differing blocks are replaced with air. Meta is used in the comparison, too, two blocks of the same type but different meta are considered different and thus replaced with air.
area block | Notes | ||
---|---|---|---|
self | Src | result | |
A | A | A | Same blocks are kept |
A | non-A | air | Differing blocks are replaced with air |
msDifference - the blocks that are the same in both areas are replaced with air, all the differing blocks are kept from the first area. Meta is used in the comparison, too, two blocks of the same type but different meta are considered different.
area block | Notes | ||
---|---|---|---|
self | Src | result | |
A | A | air | Same blocks are replaced with air |
A | non-A | A | Differing blocks are kept from 'self' |
msSimpleCompare - the blocks that are the same in both areas are replaced with air, all the differing blocks are replaced with stone. Meta is used in the comparison, too, two blocks of the same type but different meta are considered different.
area block | Notes | ||
---|---|---|---|
self | Src | result | |
A | A | air | Same blocks are replaced with air |
A | non-A | stone | Differing blocks are replaced with stone |