Table of Contents

Struct FastBlockPos

Namespace
Vintagestory.API.MathTools
Assembly
VintagestoryAPI.dll
[ProtoContract]
[JsonObject(MemberSerialization.OptIn)]
public struct FastBlockPos : IEquatable<BlockPos>, IEquatable<FastBlockPos>
Implements
Inherited Members
Extension Methods

Constructors

FastBlockPos()

public FastBlockPos()

FastBlockPos(int, int, int)

public FastBlockPos(int x, int y, int z)

Parameters

x int
y int
z int

FastBlockPos(int, int, int, int)

public FastBlockPos(int x, int y, int z, int dimension)

Parameters

x int
y int
z int
dimension int

FastBlockPos(BlockPos)

public FastBlockPos(BlockPos pos)

Parameters

pos BlockPos

Fields

X

[ProtoMember(1)]
[JsonProperty]
public int X

Field Value

int

Y

public int Y

Field Value

int

Z

[ProtoMember(3)]
[JsonProperty]
public int Z

Field Value

int

dimension

public int dimension

Field Value

int

Properties

InternalY

[ProtoMember(2)]
[JsonProperty]
public int InternalY { get; set; }

Property Value

int

Methods

AddCopy(int)

Creates a copy of this blocks position and offsets it by given xyz

public FastBlockPos AddCopy(int xyz)

Parameters

xyz int

Returns

FastBlockPos

AddCopy(int, int, int)

Creates a copy of this blocks position and offsets it by given xyz

public FastBlockPos AddCopy(int dx, int dy, int dz)

Parameters

dx int
dy int
dz int

Returns

FastBlockPos

AddCopy(float, float, float)

Creates a copy of this blocks position and offsets it by given xyz

public FastBlockPos AddCopy(float dx, float dy, float dz)

Parameters

dx float
dy float
dz float

Returns

FastBlockPos

AddCopy(BlockFacing)

Creates a copy of this blocks position and offsets it in the direction of given block face

public FastBlockPos AddCopy(BlockFacing facing)

Parameters

facing BlockFacing

Returns

FastBlockPos

AddCopy(BlockFacing, int)

Creates a copy of this blocks position and offsets it in the direction of given block face

public FastBlockPos AddCopy(BlockFacing facing, int length)

Parameters

facing BlockFacing
length int

Returns

FastBlockPos

AddCopy(FastVec3i)

Creates a copy of this block's position and offsets it in the direction of the given vector

public FastBlockPos AddCopy(FastVec3i vector)

Parameters

vector FastVec3i

Returns

FastBlockPos

AddCopy(Vec3i)

Creates a copy of this blocks position and offsets it by given xyz

public FastBlockPos AddCopy(Vec3i vector)

Parameters

vector Vec3i

Returns

FastBlockPos

DivCopy(int)

Creates a copy of this blocks position and divides it by given factor

public FastBlockPos DivCopy(int factor)

Parameters

factor int

Returns

FastBlockPos

DownCopy(int)

Creates a copy of this blocks position with the y-position adjusted by -length

public FastBlockPos DownCopy(int length = 1)

Parameters

length int

Returns

FastBlockPos

EastCopy(int)

Creates a copy of this blocks position with the x-position adjusted by +length

public FastBlockPos EastCopy(int length = 1)

Parameters

length int

Returns

FastBlockPos

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Equals(BlockPos?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(BlockPos? other)

Parameters

other BlockPos

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(FastBlockPos)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(FastBlockPos other)

Parameters

other FastBlockPos

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

FromIndex3d(int, int, int, int)

public static FastBlockPos FromIndex3d(int index3d, int cx, int cy, int cz)

Parameters

index3d int
cx int
cy int
cz int

Returns

FastBlockPos

GetHashCode()

same as in FastBlockPos so they can be safely compared

public override int GetHashCode()

Returns

int

NorthCopy(int)

Creates a copy of this blocks position with the z-position adjusted by -length

public FastBlockPos NorthCopy(int length = 1)

Parameters

length int

Returns

FastBlockPos

Offset(BlockFacing)

Offsets the position into the direction of given block face

public FastBlockPos Offset(BlockFacing facing)

Parameters

facing BlockFacing

Returns

FastBlockPos

SouthCopy(int)

Creates a copy of this blocks position with the z-position adjusted by +length

public FastBlockPos SouthCopy(int length = 1)

Parameters

length int

Returns

FastBlockPos

SubCopy(int, int, int)

public FastBlockPos SubCopy(int x, int y, int z)

Parameters

x int
y int
z int

Returns

FastBlockPos

SubCopy(FastBlockPos)

Substract a position => you'll have the manhattan distance.
If used within a non-zero dimension the resulting FastBlockPos will be dimensionless as it's a distance or offset between two positions

public FastBlockPos SubCopy(FastBlockPos pos)

Parameters

pos FastBlockPos

Returns

FastBlockPos

ToIndex3d()

public int ToIndex3d()

Returns

int

ToString()

Returns the fully qualified type name of this instance.

public override readonly string ToString()

Returns

string

The fully qualified type name.

UpCopy(int)

Creates a copy of this blocks position with the y-position adjusted by +length

public FastBlockPos UpCopy(int length = 1)

Parameters

length int

Returns

FastBlockPos

WestCopy(int)

Creates a copy of this blocks position with the x-position adjusted by -length

public FastBlockPos WestCopy(int length = 1)

Parameters

length int

Returns

FastBlockPos

Operators

operator +(FastBlockPos, int)

public static FastBlockPos operator +(FastBlockPos left, int right)

Parameters

left FastBlockPos
right int

Returns

FastBlockPos

operator +(FastBlockPos, FastBlockPos)

public static FastBlockPos operator +(FastBlockPos left, FastBlockPos right)

Parameters

left FastBlockPos
right FastBlockPos

Returns

FastBlockPos

operator /(FastBlockPos, int)

public static FastBlockPos operator /(FastBlockPos left, int right)

Parameters

left FastBlockPos
right int

Returns

FastBlockPos

operator ==(FastBlockPos, FastBlockPos)

public static bool operator ==(FastBlockPos left, FastBlockPos right)

Parameters

left FastBlockPos
right FastBlockPos

Returns

bool

operator !=(FastBlockPos, FastBlockPos)

public static bool operator !=(FastBlockPos left, FastBlockPos right)

Parameters

left FastBlockPos
right FastBlockPos

Returns

bool

operator *(int, FastBlockPos)

public static FastBlockPos operator *(int left, FastBlockPos right)

Parameters

left int
right FastBlockPos

Returns

FastBlockPos

operator *(FastBlockPos, int)

public static FastBlockPos operator *(FastBlockPos left, int right)

Parameters

left FastBlockPos
right int

Returns

FastBlockPos

operator -(FastBlockPos, int)

public static FastBlockPos operator -(FastBlockPos left, int right)

Parameters

left FastBlockPos
right int

Returns

FastBlockPos

operator -(FastBlockPos, FastBlockPos)

public static FastBlockPos operator -(FastBlockPos left, FastBlockPos right)

Parameters

left FastBlockPos
right FastBlockPos

Returns

FastBlockPos