C# Class fCraft.Map

显示文件 Open project: GlennMR/800craft Class Usage Examples

Public Properties

Property Type Description
Blocks byte[]
Bounds BoundingBox
DoorID int
Doors System.Collections.ArrayList
Height int
Length int
MessageBlockID int
MessageBlocks System.Collections.ArrayList
Portals System.Collections.ArrayList
Shadows ].short[
Volume int
Width int
portalID int

Private Properties

Property Type Description
DefineFallbackBlocks void
GetEdgeTexture string
Map System
OnMetaOrZoneChange void
ProcessDrawOps int
ProcessUpdates void
QueueDrawOp void

Public Methods

Method Description
CalculateShadows ( ) : void
ClearUpdateQueue ( ) : void

Clears all pending updates.

ConvertBlockTypes ( [ mapping ) : bool

Converts nonstandard (50-255) blocks using the given mapping.

GetBlock ( Vector3I coords ) : Block

Gets a block at given coordinates. Checks bounds.

GetBlock ( int x, int y, int z ) : Block

Gets a block at given coordinates. Checks bounds.

GetBlockByName ( [ blockName ) : Block

Tries to find a blocktype by name.

GetCompressedCopy ( [ stream, bool prependBlockCount ) : void

Writes a copy of the current map to a given stream, compressed with GZipStream.

GetFallbackBlock ( Block block ) : Block
GetFallbackMap ( ) : byte[]
InBounds ( Vector3I vec ) : bool

Checks whether the given coordinate (in block units) is within the bounds of the map.

InBounds ( int x, int y, int z ) : bool

Checks whether the given coordinate (in block units) is within the bounds of the map.

Index ( Vector3I coords ) : int

Converts given coordinates to a block array index.

Index ( int x, int y, int z ) : int

Converts given coordinates to a block array index.

IsRecommendedDimension ( int dimension ) : bool

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

IsValidDimension ( int dimension ) : bool

Checks if a given map dimension (width, height, or length) is acceptible. Values between 1 and 2047 are technically allowed.

MakeFloodBarrier ( ) : void

Makes an admincrete barrier, 1 block thick, around the lower half of the map.

Map ( World world, int width, int length, int height, bool initBlockArray ) : System

Creates an empty new map of given dimensions. Dimensions cannot be changed after creation.

QueueUpdate ( BlockUpdate update ) : void

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.

RemoveUnknownBlocktypes ( ) : bool

Replaces all nonstandard (50-255) blocks with air.

ResetSpawn ( ) : void

Resets the spawn to a valid Java 7 location (X, Y, and found Z) Old behaviour: Resets spawn to the default location (top center of the map).

Save ( [ fileName ) : bool

Saves this map to a file in the default format (FCMv3).

SearchColumn ( int x, int y, Block id ) : int
SearchColumn ( int x, int y, Block id, int zStart ) : int
SetBlock ( Vector3I coords, Block type ) : void

Sets a block at given coordinates. Checks bounds.

SetBlock ( int x, int y, int z, Block type ) : void

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.

StopAllDrawOps ( ) : void
ValidateHeader ( ) : bool

Private Methods

Method Description
DefineFallbackBlocks ( ) : void
GetEdgeTexture ( Block block ) : string
Map ( ) : System
OnMetaOrZoneChange ( object sender, EventArgs args ) : void
ProcessDrawOps ( int maxTotalUpdates ) : int
ProcessUpdates ( ) : void
QueueDrawOp ( [ op ) : void

Method Details

CalculateShadows() public method

public CalculateShadows ( ) : void
return void

ClearUpdateQueue() public method

Clears all pending updates.
public ClearUpdateQueue ( ) : void
return void

ConvertBlockTypes() public method

Converts nonstandard (50-255) blocks using the given mapping.
public ConvertBlockTypes ( [ mapping ) : bool
mapping [ Byte array of length 256.
return bool

GetBlock() public method

Gets a block at given coordinates. Checks bounds.
public GetBlock ( Vector3I coords ) : Block
coords Vector3I Coordinate vector (X,Y,Z).
return Block

GetBlock() public method

Gets a block at given coordinates. Checks bounds.
public GetBlock ( int x, int y, int z ) : Block
x int X coordinate (width).
y int Y coordinate (length, Notch's Z).
z int Z coordinate (height, Notch's Y).
return Block

GetBlockByName() public static method

Tries to find a blocktype by name.
public static GetBlockByName ( [ blockName ) : Block
blockName [ Name of the block.
return Block

GetCompressedCopy() public method

Writes a copy of the current map to a given stream, compressed with GZipStream.
public GetCompressedCopy ( [ stream, bool prependBlockCount ) : void
stream [ Stream to write the compressed data to.
prependBlockCount bool If true, prepends block data with signed, 32bit, big-endian block count.
return void

GetFallbackBlock() public static method

public static GetFallbackBlock ( Block block ) : Block
block Block
return Block

GetFallbackMap() public method

public GetFallbackMap ( ) : byte[]
return byte[]

InBounds() public method

Checks whether the given coordinate (in block units) is within the bounds of the map.
public InBounds ( Vector3I vec ) : bool
vec Vector3I Coordinate vector (X,Y,Z).
return bool

InBounds() public method

Checks whether the given coordinate (in block units) is within the bounds of the map.
public InBounds ( int x, int y, int z ) : bool
x int X coordinate (width).
y int Y coordinate (length, Notch's Z).
z int Z coordinate (height, Notch's Y).
return bool

Index() public method

Converts given coordinates to a block array index.
public Index ( Vector3I coords ) : int
coords Vector3I Coordinate vector (X,Y,Z).
return int

Index() public method

Converts given coordinates to a block array index.
public Index ( int x, int y, int z ) : int
x int X coordinate (width).
y int Y coordinate (length, Notch's Z).
z int Z coordinate (height, Notch's Y).
return int

IsRecommendedDimension() public static method

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
public static IsRecommendedDimension ( int dimension ) : bool
dimension int
return bool

IsValidDimension() public static method

Checks if a given map dimension (width, height, or length) is acceptible. Values between 1 and 2047 are technically allowed.
public static IsValidDimension ( int dimension ) : bool
dimension int
return bool

MakeFloodBarrier() public method

Makes an admincrete barrier, 1 block thick, around the lower half of the map.
public MakeFloodBarrier ( ) : void
return void

Map() public method

Creates an empty new map of given dimensions. Dimensions cannot be changed after creation.
public Map ( World world, int width, int length, int height, bool initBlockArray ) : System
world World World that owns this map. May be null, and may be changed later.
width int Width (horizontal, Notch's X).
length int Length (horizontal, Notch's Z).
height int Height (vertical, Notch's Y).
initBlockArray bool If true, the Blocks array will be created.
return System

QueueUpdate() public method

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.
public QueueUpdate ( BlockUpdate update ) : void
update BlockUpdate
return void

RemoveUnknownBlocktypes() public method

Replaces all nonstandard (50-255) blocks with air.
public RemoveUnknownBlocktypes ( ) : bool
return bool

ResetSpawn() public method

Resets the spawn to a valid Java 7 location (X, Y, and found Z) Old behaviour: Resets spawn to the default location (top center of the map).
public ResetSpawn ( ) : void
return void

Save() public method

Saves this map to a file in the default format (FCMv3).
public Save ( [ fileName ) : bool
fileName [
return bool

SearchColumn() public method

public SearchColumn ( int x, int y, Block id ) : int
x int
y int
id Block
return int

SearchColumn() public method

public SearchColumn ( int x, int y, Block id, int zStart ) : int
x int
y int
id Block
zStart int
return int

SetBlock() public method

Sets a block at given coordinates. Checks bounds.
public SetBlock ( Vector3I coords, Block type ) : void
coords Vector3I Coordinate vector (X,Y,Z).
type Block Block type to set.
return void

SetBlock() public method

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.
public SetBlock ( int x, int y, int z, Block type ) : void
x int X coordinate (width).
y int Y coordinate (length, Notch's Z).
z int Z coordinate (height, Notch's Y).
type Block Block type to set.
return void

StopAllDrawOps() public method

public StopAllDrawOps ( ) : void
return void

ValidateHeader() public method

public ValidateHeader ( ) : bool
return bool

Property Details

Blocks public_oe property

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.
public byte[] Blocks
return byte[]

Bounds public_oe property

Map boundaries. Can be useful for calculating volume or interesections.
public BoundingBox,fCraft Bounds
return BoundingBox

DoorID public_oe property

public int DoorID
return int

Doors public_oe property

public System.Collections.ArrayList Doors
return System.Collections.ArrayList

Height public_oe property

Map height, in blocks. Equivalent to Notch's Y (vertical).
public int Height
return int

Length public_oe property

Map length, in blocks. Equivalent to Notch's Z (horizontal).
public int Length
return int

MessageBlockID public_oe property

public int MessageBlockID
return int

MessageBlocks public_oe property

public System.Collections.ArrayList MessageBlocks
return System.Collections.ArrayList

Portals public_oe property

public System.Collections.ArrayList Portals
return System.Collections.ArrayList

Shadows public_oe property

public short[,] Shadows
return ].short[

Volume public_oe property

Map volume, in terms of blocks.
public int Volume
return int

Width public_oe property

Map width, in blocks. Equivalent to Notch's X (horizontal).
public int Width
return int

portalID public_oe property

public int portalID
return int