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
FastBlockPos(int, int, int, int)
public FastBlockPos(int x, int y, int z, int dimension)
Parameters
FastBlockPos(BlockPos)
public FastBlockPos(BlockPos pos)
Parameters
posBlockPos
Fields
X
[ProtoMember(1)]
[JsonProperty]
public int X
Field Value
Y
public int Y
Field Value
Z
[ProtoMember(3)]
[JsonProperty]
public int Z
Field Value
dimension
public int dimension
Field Value
Properties
InternalY
[ProtoMember(2)]
[JsonProperty]
public int InternalY { get; set; }
Property Value
Methods
AddCopy(int)
Creates a copy of this blocks position and offsets it by given xyz
public FastBlockPos AddCopy(int xyz)
Parameters
xyzint
Returns
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
Returns
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
Returns
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
facingBlockFacing
Returns
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
facingBlockFacinglengthint
Returns
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
vectorFastVec3i
Returns
AddCopy(Vec3i)
Creates a copy of this blocks position and offsets it by given xyz
public FastBlockPos AddCopy(Vec3i vector)
Parameters
vectorVec3i
Returns
DivCopy(int)
Creates a copy of this blocks position and divides it by given factor
public FastBlockPos DivCopy(int factor)
Parameters
factorint
Returns
DownCopy(int)
Creates a copy of this blocks position with the y-position adjusted by -length
public FastBlockPos DownCopy(int length = 1)
Parameters
lengthint
Returns
EastCopy(int)
Creates a copy of this blocks position with the x-position adjusted by +length
public FastBlockPos EastCopy(int length = 1)
Parameters
lengthint
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
otherBlockPosAn object to compare with this object.
Returns
Equals(FastBlockPos)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(FastBlockPos other)
Parameters
otherFastBlockPosAn object to compare with this object.
Returns
FromIndex3d(int, int, int, int)
public static FastBlockPos FromIndex3d(int index3d, int cx, int cy, int cz)
Parameters
Returns
GetHashCode()
same as in FastBlockPos so they can be safely compared
public override int GetHashCode()
Returns
NorthCopy(int)
Creates a copy of this blocks position with the z-position adjusted by -length
public FastBlockPos NorthCopy(int length = 1)
Parameters
lengthint
Returns
Offset(BlockFacing)
Offsets the position into the direction of given block face
public FastBlockPos Offset(BlockFacing facing)
Parameters
facingBlockFacing
Returns
SouthCopy(int)
Creates a copy of this blocks position with the z-position adjusted by +length
public FastBlockPos SouthCopy(int length = 1)
Parameters
lengthint
Returns
SubCopy(int, int, int)
public FastBlockPos SubCopy(int x, int y, int z)
Parameters
Returns
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
posFastBlockPos
Returns
ToIndex3d()
public int ToIndex3d()
Returns
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
lengthint
Returns
WestCopy(int)
Creates a copy of this blocks position with the x-position adjusted by -length
public FastBlockPos WestCopy(int length = 1)
Parameters
lengthint
Returns
Operators
operator +(FastBlockPos, int)
public static FastBlockPos operator +(FastBlockPos left, int right)
Parameters
leftFastBlockPosrightint
Returns
operator +(FastBlockPos, FastBlockPos)
public static FastBlockPos operator +(FastBlockPos left, FastBlockPos right)
Parameters
leftFastBlockPosrightFastBlockPos
Returns
operator /(FastBlockPos, int)
public static FastBlockPos operator /(FastBlockPos left, int right)
Parameters
leftFastBlockPosrightint
Returns
operator ==(FastBlockPos, FastBlockPos)
public static bool operator ==(FastBlockPos left, FastBlockPos right)
Parameters
leftFastBlockPosrightFastBlockPos
Returns
operator !=(FastBlockPos, FastBlockPos)
public static bool operator !=(FastBlockPos left, FastBlockPos right)
Parameters
leftFastBlockPosrightFastBlockPos
Returns
operator *(int, FastBlockPos)
public static FastBlockPos operator *(int left, FastBlockPos right)
Parameters
leftintrightFastBlockPos
Returns
operator *(FastBlockPos, int)
public static FastBlockPos operator *(FastBlockPos left, int right)
Parameters
leftFastBlockPosrightint
Returns
operator -(FastBlockPos, int)
public static FastBlockPos operator -(FastBlockPos left, int right)
Parameters
leftFastBlockPosrightint
Returns
operator -(FastBlockPos, FastBlockPos)
public static FastBlockPos operator -(FastBlockPos left, FastBlockPos right)
Parameters
leftFastBlockPosrightFastBlockPos