Class Vec3i
- Namespace
- Vintagestory.API.MathTools
- Assembly
- VintagestoryAPI.dll
Represents a vector of 3 ints. Go bug Tyron if you need more utility methods in this class.
[ProtoContract]
[JsonObject(MemberSerialization.OptIn)]
public class Vec3i : IEquatable<Vec3i>, IVec3
- Inheritance
-
Vec3i
- Implements
- Inherited Members
- Extension Methods
Constructors
Vec3i()
public Vec3i()
Vec3i(int, int, int)
public Vec3i(int x, int y, int z)
Parameters
Vec3i(BlockPos)
public Vec3i(BlockPos pos)
Parameters
pos
BlockPos
Fields
DirectAndIndirectNeighbours
List of offset of all direct and indirect neighbours of coordinate 0/0/0
public static readonly Vec3i[] DirectAndIndirectNeighbours
Field Value
- Vec3i[]
X
[ProtoMember(1)]
[JsonProperty]
public int X
Field Value
Y
[ProtoMember(2)]
[JsonProperty]
public int Y
Field Value
Z
[ProtoMember(3)]
[JsonProperty]
public int Z
Field Value
Properties
AsBlockPos
public BlockPos AsBlockPos { get; }
Property Value
AsVec3i
public Vec3i AsVec3i { get; }
Property Value
IsZero
public bool IsZero { get; }
Property Value
this[int]
Returns the n-th coordinate
public int this[int index] { get; set; }
Parameters
index
int
Property Value
XZ
public Vec2i XZ { get; }
Property Value
Zero
public static Vec3i Zero { get; }
Property Value
Methods
Add(int, int, int)
public Vec3i Add(int x, int y, int z)
Parameters
Returns
Add(int, int, int, Vec3i)
public Vec3i Add(int x, int y, int z, Vec3i intoVec)
Parameters
Returns
Add(BlockFacing, int)
public Vec3i Add(BlockFacing towardsFace, int length = 1)
Parameters
towardsFace
BlockFacinglength
int
Returns
AddCopy(int, int, int)
public Vec3i AddCopy(int x, int y, int z)
Parameters
Returns
AddCopy(BlockFacing)
public Vec3i AddCopy(BlockFacing facing)
Parameters
facing
BlockFacing
Returns
Clone()
public Vec3i Clone()
Returns
DistanceTo(Vec3i)
public double DistanceTo(Vec3i vec)
Parameters
vec
Vec3i
Returns
Equals(int, int, int)
public bool Equals(int x, int y, int z)
Parameters
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
Equals(Vec3i)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Vec3i other)
Parameters
other
Vec3iAn object to compare with this object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ManhattenDistanceTo(Vec3i)
public int ManhattenDistanceTo(Vec3i vec)
Parameters
vec
Vec3i
Returns
Reduce(int)
Substracts val from each coordinate if the coordinate if positive, otherwise it is added. If 0, the value is unchanged. The value must be a positive number
public void Reduce(int val = 1)
Parameters
val
int
ReduceX(int)
public void ReduceX(int val = 1)
Parameters
val
int
ReduceY(int)
public void ReduceY(int val = 1)
Parameters
val
int
ReduceZ(int)
public void ReduceZ(int val = 1)
Parameters
val
int
Set(int, int, int)
public Vec3i Set(int positionX, int positionY, int positionZ)
Parameters
Returns
Set(Vec3i)
public Vec3i Set(Vec3i fromPos)
Parameters
fromPos
Vec3i
Returns
SquareDistanceTo(int, int, int)
public long SquareDistanceTo(int x, int y, int z)
Parameters
Returns
SquareDistanceTo(Vec3i)
public long SquareDistanceTo(Vec3i vec)
Parameters
vec
Vec3i
Returns
ToBlockPos()
public BlockPos ToBlockPos()
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
operator +(Vec3i, Vec3i)
public static Vec3i operator +(Vec3i left, Vec3i right)
Parameters
Returns
operator /(Vec3i, int)
public static Vec3i operator /(Vec3i left, int right)
Parameters
Returns
operator ==(Vec3i, Vec3i)
public static bool operator ==(Vec3i left, Vec3i right)
Parameters
Returns
operator !=(Vec3i, Vec3i)
public static bool operator !=(Vec3i left, Vec3i right)
Parameters
Returns
operator *(int, Vec3i)
public static Vec3i operator *(int left, Vec3i right)
Parameters
Returns
operator *(Vec3i, int)
public static Vec3i operator *(Vec3i left, int right)
Parameters
Returns
operator -(Vec3i, Vec3i)
public static Vec3i operator -(Vec3i left, Vec3i right)
Parameters
Returns
operator -(Vec3i)
public static Vec3i operator -(Vec3i vec)
Parameters
vec
Vec3i