![]() |
fCraft
0.638
Custom Minecraft Server
|
Represents a map file (associated with a world or not). Maps can be created blank (using Map constructor), generated terrain (using MapGenerator), or loaded from file (using fCraft.MapConversion.MapUtility). More...
Collaboration diagram for fCraft.Map:Public Member Functions | |
| void | ResetSpawn () |
| Resets spawn to the default location (top center of the map). | |
| Map (World world, int width, int length, int height, bool initBlockArray) | |
| Creates an empty new map of given dimensions. Dimensions cannot be changed after creation. | |
| bool | Save ([NotNull] string fileName) |
| Saves this map to a file in the default format (FCMv3). | |
| int | Index (int x, int y, int z) |
| Converts given coordinates to a block array index. | |
| int | Index (Vector3I coords) |
| Converts given coordinates to a block array index. | |
| void | SetBlock (int x, int y, int z, Block type) |
| Sets a block in a safe way. Note that using SetBlock does not relay changes to players. Use QueueUpdate() for changing blocks on live maps/worlds. | |
| void | SetBlock (Vector3I coords, Block type) |
| Sets a block at given coordinates. Checks bounds. | |
| void | SetBlock (int index, Block type) |
| Sets a block at given coordinates. | |
| Block | GetBlock (int x, int y, int z) |
| Gets a block at given coordinates. Checks bounds. | |
| Block | GetBlock (Vector3I coords) |
| Gets a block at given coordinates. Checks bounds. | |
| bool | InBounds (int x, int y, int z) |
| Checks whether the given coordinate (in block units) is within the bounds of the map. | |
| bool | InBounds (Vector3I vec) |
| Checks whether the given coordinate (in block units) is within the bounds of the map. | |
| void | QueueUpdate (BlockUpdate update) |
| Queues a new block update to be processed. Due to concurrent nature of the server, there is no guarantee that updates will be applied in any specific order. | |
| void | ClearUpdateQueue () |
| Clears all pending updates. | |
| void | CancelAllDrawOps () |
| Cancels and stops all active draw operations. | |
| bool | ConvertBlockTypes ([NotNull] byte[] mapping) |
| Converts nonstandard (50-255) blocks using the given mapping. | |
| bool | RemoveUnknownBlocktypes () |
| Replaces all nonstandard (50-255) blocks with air. | |
| short[,] | ComputeHeightmap () |
| Calculates a 2D heightmap, based on the highest solid block for each column of blocks. Air, Brown/Red mushrooms, Glass, Leaves, Red/Yellow flowers, and Saplings are considered non-solid. | |
| byte[] | GetCompressedCopy () |
| Gets a compressed (GZip) copy of the map (raw block data with signed, 32bit, big-endian block count prepended). If the map has not been modified since last GetCompressedCopy call, returns a cached copy. | |
| int | SearchColumn (int x, int y, Block id) |
| Searches the map, from top to bottom, for the first appearance of a given block. | |
| int | SearchColumn (int x, int y, Block id, int zStart) |
| Searches the map, from top to bottom, for the first appearance of a given block. | |
Static Public Member Functions | |
| static bool | IsValidDimension (int dimension) |
| Checks if a given map dimension (width, height, or length) is acceptable. Values between 1 and 2047 are technically allowed. | |
| static bool | IsRecommendedDimension (int dimension) |
| Checks if a given map dimension (width, height, or length) is among the set of recommended values Recommended values are: 16, 32, 64, 128, 256, 512, 1024 | |
| static bool | GetBlockByName ([NotNull] string blockName, bool allowNoneBlock, out Block block) |
| Finds Block corresponding to given blockName. | |
Public Attributes | |
| const MapFormat | SaveFormat = MapFormat.FCMv3 |
| Current default map format for saving. | |
| readonly int | Width |
| Map width, in blocks. Equivalent to Notch's X (horizontal). | |
| readonly int | Length |
| Map length, in blocks. Equivalent to Notch's Z (horizontal). | |
| readonly int | Height |
| Map height, in blocks. Equivalent to Notch's Y (vertical). | |
| readonly BoundingBox | Bounds |
| Map boundaries. Can be useful for calculating volume or interesections. | |
| readonly int | Volume |
| Map volume, in terms of blocks. | |
| byte[] | Blocks |
| Array of map blocks. Use Index(x,y,h) to convert coordinates to array indices. Use QueueUpdate() for working on live maps to ensure that all players get updated. | |
Properties | |
| World | World [get, set] |
| The world associated with this map, if any. May be null. | |
| Position | Spawn [get, set] |
| Default spawning point on the map. A warning is logged when given coordinates are outside the map. | |
| bool | HasChangedSinceSave [get, set] |
| Whether the map was modified since last time it was saved. | |
| DateTime | DateModified [get, set] |
| DateTime | DateCreated [get, set] |
| Guid | Guid [get, set] |
| MetadataCollection< string > | Metadata [get, set] |
| Map metadata, excluding zones. | |
| ZoneCollection | Zones [get, set] |
| All zones within a map. | |
| int | UpdateQueueLength [get] |
| Number of blocks that are waiting to be processed. | |
| int | DrawQueueLength [get] |
| Number of active draw operations. | |
| long | DrawQueueBlockCount [get] |
| Total estimated number of blocks left to process, from all draw operations combined. | |
Represents a map file (associated with a world or not). Maps can be created blank (using Map constructor), generated terrain (using MapGenerator), or loaded from file (using fCraft.MapConversion.MapUtility).
| fCraft.Map.Map | ( | World | world, |
| int | width, | ||
| int | length, | ||
| int | height, | ||
| bool | initBlockArray | ||
| ) |
Creates an empty new map of given dimensions. Dimensions cannot be changed after creation.
| world | World that owns this map. May be null, and may be changed later. |
| width | Width (horizontal, Notch's X). |
| length | Length (horizontal, Notch's Z). |
| height | Height (vertical, Notch's Y). |
| initBlockArray | If true, the Blocks array will be created. |
| ArgumentOutOfRangeException | Width, length, or height is not between 16 and 2048. |
| ArgumentException | Map volume exceeds Int32.MaxValue. |
| void fCraft.Map.CancelAllDrawOps | ( | ) |
Cancels and stops all active draw operations.
| void fCraft.Map.ClearUpdateQueue | ( | ) |
Clears all pending updates.
| short [,] fCraft.Map.ComputeHeightmap | ( | ) |
Calculates a 2D heightmap, based on the highest solid block for each column of blocks. Air, Brown/Red mushrooms, Glass, Leaves, Red/Yellow flowers, and Saplings are considered non-solid.
| bool fCraft.Map.ConvertBlockTypes | ( | [NotNull] byte[] | mapping | ) |
Converts nonstandard (50-255) blocks using the given mapping.
| mapping | Byte array of length 256. |
| Block fCraft.Map.GetBlock | ( | int | x, |
| int | y, | ||
| int | z | ||
| ) |
Gets a block at given coordinates. Checks bounds.
| x | X coordinate (width). |
| y | Y coordinate (length, Notch's Z). |
| z | Z coordinate (height, Notch's Y). |
Gets a block at given coordinates. Checks bounds.
| coords | Coordinate vector (X,Y,Z). |
|
static |
Finds Block corresponding to given blockName.
| blockName | Given block name to parse. |
| allowNoneBlock | Whether "none" block type is acceptible. |
| block | Block corresponding to given blockName; Block.Undefined if value could not be parsed. |
| ArgumentNullException | blockName is null. |
| byte [] fCraft.Map.GetCompressedCopy | ( | ) |
Gets a compressed (GZip) copy of the map (raw block data with signed, 32bit, big-endian block count prepended). If the map has not been modified since last GetCompressedCopy call, returns a cached copy.
| bool fCraft.Map.InBounds | ( | int | x, |
| int | y, | ||
| int | z | ||
| ) |
Checks whether the given coordinate (in block units) is within the bounds of the map.
| x | X coordinate (width). |
| y | Y coordinate (length, Notch's Z). |
| z | Z coordinate (height, Notch's Y). |
| bool fCraft.Map.InBounds | ( | Vector3I | vec | ) |
Checks whether the given coordinate (in block units) is within the bounds of the map.
| vec | Coordinate vector (X,Y,Z). |
| int fCraft.Map.Index | ( | int | x, |
| int | y, | ||
| int | z | ||
| ) |
Converts given coordinates to a block array index.
| x | X coordinate (width). |
| y | Y coordinate (length, Notch's Z). |
| z | Z coordinate (height, Notch's Y). |
| int fCraft.Map.Index | ( | Vector3I | coords | ) |
Converts given coordinates to a block array index.
| coords | Coordinate vector (X,Y,Z). |
|
static |
Checks if a given map dimension (width, height, or length) is among the set of recommended values Recommended values are: 16, 32, 64, 128, 256, 512, 1024
|
static |
Checks if a given map dimension (width, height, or length) is acceptable. Values between 1 and 2047 are technically allowed.
| void fCraft.Map.QueueUpdate | ( | BlockUpdate | update | ) |
Queues a new block update to be processed. Due to concurrent nature of the server, there is no guarantee that updates will be applied in any specific order.
| bool fCraft.Map.RemoveUnknownBlocktypes | ( | ) |
Replaces all nonstandard (50-255) blocks with air.
| void fCraft.Map.ResetSpawn | ( | ) |
Resets spawn to the default location (top center of the map).
| bool fCraft.Map.Save | ( | [NotNull] string | fileName | ) |
Saves this map to a file in the default format (FCMv3).
| int fCraft.Map.SearchColumn | ( | int | x, |
| int | y, | ||
| Block | id | ||
| ) |
Searches the map, from top to bottom, for the first appearance of a given block.
| x | X coordinate (width). |
| y | Y coordinate (length, Notch's Z). |
| id | Block type to search for. |
| int fCraft.Map.SearchColumn | ( | int | x, |
| int | y, | ||
| Block | id, | ||
| int | zStart | ||
| ) |
Searches the map, from top to bottom, for the first appearance of a given block.
| x | X coordinate (width). |
| y | Y coordinate (length, Notch's Z). |
| id | Block type to search for. |
| zStart | Starting height. No blocks above this point will be checked. |
| void fCraft.Map.SetBlock | ( | int | x, |
| int | y, | ||
| int | z, | ||
| Block | type | ||
| ) |
Sets a block in a safe way. Note that using SetBlock does not relay changes to players. Use QueueUpdate() for changing blocks on live maps/worlds.
| x | X coordinate (width). |
| y | Y coordinate (length, Notch's Z). |
| z | Z coordinate (height, Notch's Y). |
| type | Block type to set. |
Sets a block at given coordinates. Checks bounds.
| coords | Coordinate vector (X,Y,Z). |
| type | Block type to set. |
| void fCraft.Map.SetBlock | ( | int | index, |
| Block | type | ||
| ) |
Sets a block at given coordinates.
| index | Index of the block (use map.Index(x,y,z)). |
| type | Block type to set. |
| byte [] fCraft.Map.Blocks |
Array of map blocks. Use Index(x,y,h) to convert coordinates to array indices. Use QueueUpdate() for working on live maps to ensure that all players get updated.
| readonly BoundingBox fCraft.Map.Bounds |
Map boundaries. Can be useful for calculating volume or interesections.
| readonly int fCraft.Map.Height |
Map height, in blocks. Equivalent to Notch's Y (vertical).
| readonly int fCraft.Map.Length |
Map length, in blocks. Equivalent to Notch's Z (horizontal).
| const MapFormat fCraft.Map.SaveFormat = MapFormat.FCMv3 |
Current default map format for saving.
| readonly int fCraft.Map.Volume |
Map volume, in terms of blocks.
| readonly int fCraft.Map.Width |
Map width, in blocks. Equivalent to Notch's X (horizontal).
|
getset |
|
getset |
|
get |
Total estimated number of blocks left to process, from all draw operations combined.
|
get |
Number of active draw operations.
|
getset |
|
getset |
Whether the map was modified since last time it was saved.
|
getset |
Map metadata, excluding zones.
|
getset |
Default spawning point on the map. A warning is logged when given coordinates are outside the map.
|
get |
Number of blocks that are waiting to be processed.
|
getset |
The world associated with this map, if any. May be null.
|
getset |
All zones within a map.