Class BlockLayout
A set of blocks represented by dictionary of block positions mapped to block IDs. Used in blueprints and multi-block placement.
Inheritance
System.Object
BlockLayout
Assembly: Eco.Shared.dll
Syntax
public sealed class BlockLayout : Object, IEquatable<BlockLayout>
Constructors
BlockLayout()
Declaration
BlockLayout(IEnumerable<KeyValuePair<Vector3i, UInt16>>)
Declaration
public BlockLayout(IEnumerable<KeyValuePair<Vector3i, ushort>> blocks)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<Vector3i, System.UInt16>> |
blocks |
|
Properties
Blocks
Declaration
[Eco(true)]
public SortedDictionary<Vector3i, ushort> Blocks { get; set; }
Property Value
Type |
Description |
System.Collections.Generic.SortedDictionary<Vector3i, System.UInt16> |
|
Count
Declaration
public int Count { get; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
Clear()
Clear all block IDs from the blueprint.
Declaration
Equals(BlockLayout)
Declaration
public bool Equals(BlockLayout other)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
RemoveValue(Vector3i)
Clear the block from the given position if it is set.
Declaration
public void RemoveValue(Vector3i offset)
Parameters
SetFromRangeAndBlockId(IEnumerable<Vector3i>, UInt16)
Sets the blueprint to all the blocks of the range, relative to WorldRange.min, set to the given block ID.
Declaration
public void SetFromRangeAndBlockId(IEnumerable<Vector3i> worldRange, ushort blockId)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<Vector3i> |
worldRange |
|
System.UInt16 |
blockId |
|
SetValue(Vector3i, UInt16)
Set the block ID of a relative position, overwriting any existing block ID.
Declaration
public void SetValue(Vector3i offset, ushort blockId)
Parameters
Type |
Name |
Description |
Vector3i |
offset |
|
System.UInt16 |
blockId |
|
TryGetValue(Vector3i, out UInt16)
Gets the block ID for the given position if it exists.
Declaration
public bool TryGetValue(Vector3i offset, out ushort value)
Parameters
Type |
Name |
Description |
Vector3i |
offset |
|
System.UInt16 |
value |
|
Returns
Type |
Description |
System.Boolean |
|
Operators
Equality(BlockLayout, BlockLayout)
Declaration
public static bool operator ==(BlockLayout lhs, BlockLayout rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Inequality(BlockLayout, BlockLayout)
Declaration
public static bool operator !=(BlockLayout lhs, BlockLayout rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Implements
System.IEquatable<>
Extension Methods