Struct BlockIndex
The flattened index of a block inside a 32x32x32 chunk. Consists of an uns
public readonly record struct BlockIndex : IComparable, IComparable<BlockIndex>, IEquatable<BlockIndex>
- Implements
- Inherited Members
Remarks
Value is formed by combining the axes into one 15-bit value. The five least-significant bits are the X axis, the next five are the Z axis, and the last five are the Y axis. All other bits should be zero.
Constructors
BlockIndex(int)
The flattened index of a block inside a 32x32x32 chunk. Consists of an uns
public BlockIndex(int Value)
Parameters
ValueintThe raw index value, in the range
0..32768.
Remarks
Value is formed by combining the axes into one 15-bit value. The five least-significant bits are the X axis, the next five are the Z axis, and the last five are the Y axis. All other bits should be zero.
BlockIndex(int, int, int)
public BlockIndex(int x, int y, int z)
Parameters
Properties
Value
The raw index value, in the range 0..32768.
public int Value { get; init; }
Property Value
X
X value. Values are in the range 0..32, where 0 is farthest west and 31 is farthest
east.
public int X { get; }
Property Value
Y
Y value. Values are in the range 0..32, where 0 is lowest down and 31 is highest up.
public int Y { get; }
Property Value
Z
Z value. Values are in the range 0..32, where 0 is farthest north and 31 is farthest
south.
public int Z { get; }
Property Value
Methods
CompareTo(BlockIndex)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(BlockIndex other)
Parameters
otherBlockIndexAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
CompareTo(object?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(object? obj)
Parameters
objobjectAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes objin the sort order.Zero This instance occurs in the same position in the sort order as obj.Greater than zero This instance follows objin the sort order.
Exceptions
- ArgumentException
objis not the same type as this instance.
Deconstruct(out int, out int, out int)
public void Deconstruct(out int x, out int y, out int z)
Parameters
Operators
implicit operator int(BlockIndex)
public static implicit operator int(BlockIndex index)
Parameters
indexBlockIndex
Returns
implicit operator (int, int, int)(BlockIndex)
public static implicit operator (int, int, int)(BlockIndex index)
Parameters
indexBlockIndex
Returns
implicit operator BlockIndex(int)
public static implicit operator BlockIndex(int value)
Parameters
valueint
Returns
implicit operator BlockIndex((int, int, int))
public static implicit operator BlockIndex((int, int, int) xyz)