Show / Hide Table of Contents

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
Implements
System.IEquatable<BlockLayout>
Namespace: Eco.Shared.Utils
Assembly: Eco.Shared.dll
Syntax
public sealed class BlockLayout : Object, IEquatable<BlockLayout>

Constructors

BlockLayout()

Declaration
public BlockLayout()

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
public void Clear()

Equals(BlockLayout)

Declaration
public bool Equals(BlockLayout other)
Parameters
Type Name Description
BlockLayout other
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
Type Name Description
Vector3i offset

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
Type Name Description
BlockLayout lhs
BlockLayout rhs
Returns
Type Description
System.Boolean

Inequality(BlockLayout, BlockLayout)

Declaration
public static bool operator !=(BlockLayout lhs, BlockLayout rhs)
Parameters
Type Name Description
BlockLayout lhs
BlockLayout rhs
Returns
Type Description
System.Boolean

Implements

System.IEquatable<>

Extension Methods

CommandLine.FeedFromCommandLine(Object)
CommandLine.ToCommandLineArgs(Object, Func<Object, Boolean>)
ListUtil.DepthFirstTraversal<T>(T, Func<T, IEnumerable<T>>)
EnumerableExtensions.SingleItemAsEnumerable<T>(T)
EventUtils.RaiseEvent<TEventArgs>(Object, String, TEventArgs)
PredicateUtils.MatchesAll<TEnumerable, T>(T, TEnumerable)
PredicateUtils.MatchesAll<T>(T, Func<T, Boolean>[])
PredicateUtils.MatchesAny<TEnumerable, T>(T, TEnumerable)
ReflectionUtils.PropertyValue<T>(Object, PropertyInfo)
ReflectionUtils.TryGetPropertyValueByName<T>(Object, String, out T)
ReflectionUtils.GetPropertyValueByName<T>(Object, String)
ReflectionUtils.SetPropertyByName(Object, String, Object)
ReflectionUtils.GetStructPropertyByName<T>(Object, String)
ReflectionUtils.GetStringPropertyByName(Object, String)
ReflectionUtils.ZipByProperty<T>(Object, Object, Object, Func<T, T, T>)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾