Class JOMLConversion
java.lang.Object
dev.ryanhcode.sable.companion.math.JOMLConversion
Utility for converting between Mojang and JOML math types.
- Since:
- 1.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.joml.Vector3dcA non-changing always (0.5, 0.5, 0.5) vector.static final org.joml.Vector3dcA non-changing always (1.0, 1.0, 1.0) vector.static final org.joml.QuaterniondcA non-changing always zero vector.static final org.joml.Vector3dcA non-changing always zero vector. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.joml.Vector3datBottomCenterOf(net.minecraft.core.Vec3i toCopy) Copies the coordinates of a Mojang Vec3i and centers them horizontally (x and z).static org.joml.Vector3datBottomCenterOf(net.minecraft.core.Vec3i toCopy, org.joml.Vector3d dest) Copies the coordinates of a Mojang Vec3i and centers them horizontally (x and z).static org.joml.Vector3datCenterOf(net.minecraft.core.Vec3i toCopy) Copies the coordinates of a Mojang Vec3i and centers them.static org.joml.Vector3datCenterOf(net.minecraft.core.Vec3i toCopy, org.joml.Vector3d dest) Copies the coordinates of a Mojang Vec3i and centers them.static org.joml.Vector3datLowerCornerOf(net.minecraft.core.Vec3i toCopy) Copies the coordinates of a Mojang Vec3i exactly.static org.joml.Vector3datLowerCornerOf(net.minecraft.core.Vec3i toCopy, org.joml.Vector3d dest) Copies the coordinates of a Mojang Vec3i exactly.static org.joml.Vector3datLowerCornerWithOffset(net.minecraft.core.Vec3i toCopy, double offsetX, double offsetY, double offsetZ) Copies the coordinates of a Mojang Vec3i exactly with offset.static org.joml.Vector3datLowerCornerWithOffset(net.minecraft.core.Vec3i toCopy, double offsetX, double offsetY, double offsetZ, org.joml.Vector3d dest) Copies the coordinates of a Mojang Vec3i exactly with offset.static org.joml.Vector3dgetAABBCenter(net.minecraft.world.phys.AABB aabb) Calculates the center of the specified Mojang AABB.static org.joml.Vector3dgetAABBCenter(net.minecraft.world.phys.AABB aabb, org.joml.Vector3d dest) Calculates the center of the specified Mojang AABB.static org.joml.Vector3dtoJOML(net.minecraft.core.Position vec3) Converts a Mojang Vec3 to a JOML Vector3d.static org.joml.Vector3dtoJOML(net.minecraft.core.Position vec3, org.joml.Vector3d dest) Converts a Mojang Vec3 to a JOML Vector3d.static org.joml.Vector3itoJOML(net.minecraft.core.Vec3i vec3) Converts a Mojang Vec3i to a JOML Vector3i.static org.joml.Vector3itoJOML(net.minecraft.core.Vec3i vec3, org.joml.Vector3i dest) Converts a Mojang Vec3I to a JOML Vector3i.static org.joml.Vector2ftoJOML(net.minecraft.world.phys.Vec2 vec2) Converts a Mojang Vec2 to a JOML Vector2f.static org.joml.Vector2ftoJOML(net.minecraft.world.phys.Vec2 vec2, org.joml.Vector2f dest) Converts a Mojang Vec2 to a JOML Vector2f.static net.minecraft.world.phys.Vec2toMojang(org.joml.Vector2fc vec2f) Converts a JOML Vector2f to a Mojang Vec2.static net.minecraft.world.phys.Vec3toMojang(org.joml.Vector3dc vec3d) Converts a JOML Vector3d to a Mojang Vec3.static net.minecraft.core.Vec3itoMojang(org.joml.Vector3ic vec3i) Converts a JOML Vector3i to a Mojang Vec3i.static org.joml.Vector3dupFromBottomCenterOf(net.minecraft.core.Vec3i toCopy, double verticalOffset) Copies the coordinates of a Mojang Vec3i and centers them horizontally and applies a vertical offset.static org.joml.Vector3dupFromBottomCenterOf(net.minecraft.core.Vec3i toCopy, double verticalOffset, org.joml.Vector3d dest) Copies the coordinates of a Mojang Vec3i and centers them horizontally and applies a vertical offset.
-
Field Details
-
ZERO
public static final org.joml.Vector3dc ZEROA non-changing always zero vector. -
ONE
public static final org.joml.Vector3dc ONEA non-changing always (1.0, 1.0, 1.0) vector. -
HALF
public static final org.joml.Vector3dc HALFA non-changing always (0.5, 0.5, 0.5) vector. -
QUAT_IDENTITY
public static final org.joml.Quaterniondc QUAT_IDENTITYA non-changing always zero vector.
-
-
Constructor Details
-
JOMLConversion
public JOMLConversion()
-
-
Method Details
-
toJOML
@Contract(value="_,_->param2", mutates="param2") public static org.joml.Vector3d toJOML(net.minecraft.core.Position vec3, org.joml.Vector3d dest) Converts a Mojang Vec3 to a JOML Vector3d.- Parameters:
vec3- The Mojang Vec3dest- The JOML vector to store into- Returns:
- The passed in JOML Vector3d
-
toJOML
@Contract(value="_->new", pure=true) public static org.joml.Vector3d toJOML(net.minecraft.core.Position vec3) Converts a Mojang Vec3 to a JOML Vector3d.- Parameters:
vec3- the Mojang Vec3- Returns:
- A new JOML Vector3d
-
toJOML
@Contract(value="_,_->param2", mutates="param2") public static org.joml.Vector2f toJOML(net.minecraft.world.phys.Vec2 vec2, org.joml.Vector2f dest) Converts a Mojang Vec2 to a JOML Vector2f.- Parameters:
vec2- The Mojang Vec2dest- The JOML vector to store into- Returns:
- The passed in JOML Vector2f
-
toJOML
@Contract(value="_->new", pure=true) public static org.joml.Vector2f toJOML(net.minecraft.world.phys.Vec2 vec2) Converts a Mojang Vec2 to a JOML Vector2f.- Parameters:
vec2- The Mojang Vec2- Returns:
- A new JOML Vector2f
-
toJOML
@Contract(value="_,_->param2", mutates="param2") public static org.joml.Vector3i toJOML(net.minecraft.core.Vec3i vec3, org.joml.Vector3i dest) Converts a Mojang Vec3I to a JOML Vector3i.- Parameters:
vec3- the Mojang Vec3idest- The JOML vector to store into- Returns:
- The passed in JOML Vector3d
-
toJOML
@Contract(value="_->new", pure=true) public static org.joml.Vector3i toJOML(net.minecraft.core.Vec3i vec3) Converts a Mojang Vec3i to a JOML Vector3i.- Parameters:
vec3- the Mojang Vec3i- Returns:
- A new JOML Vector3d
-
atLowerCornerOf
@Contract(value="_,_->param2", mutates="param2") public static org.joml.Vector3d atLowerCornerOf(net.minecraft.core.Vec3i toCopy, org.joml.Vector3d dest) Copies the coordinates of a Mojang Vec3i exactly.- Parameters:
toCopy- The Mojang Vec3idest- The JOML vector to store into- Returns:
- The passed in JOML Vector3d
-
atLowerCornerOf
@Contract(value="_->new", pure=true) public static org.joml.Vector3d atLowerCornerOf(net.minecraft.core.Vec3i toCopy) Copies the coordinates of a Mojang Vec3i exactly.- Parameters:
toCopy- The Mojang Vec3i- Returns:
- A new JOML Vector3d
-
atLowerCornerWithOffset
@Contract(value="_,_,_,_,_->param5", mutates="param5") public static org.joml.Vector3d atLowerCornerWithOffset(net.minecraft.core.Vec3i toCopy, double offsetX, double offsetY, double offsetZ, org.joml.Vector3d dest) Copies the coordinates of a Mojang Vec3i exactly with offset.- Parameters:
toCopy- The Mojang Vec3ioffsetX- Offset in the x to addoffsetY- Offset in the y to addoffsetZ- Offset in the z to adddest- The JOML vector to store into- Returns:
- The passed in JOML Vector3d
-
atLowerCornerWithOffset
@Contract(value="_,_,_,_->new", pure=true) public static org.joml.Vector3d atLowerCornerWithOffset(net.minecraft.core.Vec3i toCopy, double offsetX, double offsetY, double offsetZ) Copies the coordinates of a Mojang Vec3i exactly with offset.- Parameters:
toCopy- The Mojang Vec3ioffsetX- Offset in the x to addoffsetY- Offset in the y to addoffsetZ- Offset in the z to add- Returns:
- A new JOML Vector3d
-
atCenterOf
@Contract(value="_,_->param2", mutates="param2") public static org.joml.Vector3d atCenterOf(net.minecraft.core.Vec3i toCopy, org.joml.Vector3d dest) Copies the coordinates of a Mojang Vec3i and centers them.- Parameters:
toCopy- The Mojang Vec3idest- The JOML vector to store into- Returns:
- The passed in JOML Vector3d
-
atCenterOf
@Contract(value="_->new", pure=true) public static org.joml.Vector3d atCenterOf(net.minecraft.core.Vec3i toCopy) Copies the coordinates of a Mojang Vec3i and centers them.- Parameters:
toCopy- The Mojang Vec3i- Returns:
- A new JOML Vector3d
-
atBottomCenterOf
@Contract(value="_,_->param2", mutates="param2") public static org.joml.Vector3d atBottomCenterOf(net.minecraft.core.Vec3i toCopy, org.joml.Vector3d dest) Copies the coordinates of a Mojang Vec3i and centers them horizontally (x and z).- Parameters:
toCopy- The Mojang Vec3idest- The JOML vector to store into- Returns:
- The passed in JOML Vector3d
-
atBottomCenterOf
@Contract(value="_->new", pure=true) public static org.joml.Vector3d atBottomCenterOf(net.minecraft.core.Vec3i toCopy) Copies the coordinates of a Mojang Vec3i and centers them horizontally (x and z).- Parameters:
toCopy- The Mojang Vec3i- Returns:
- A new JOML Vector3d
-
upFromBottomCenterOf
@Contract(value="_,_,_->param3", mutates="param3") public static org.joml.Vector3d upFromBottomCenterOf(net.minecraft.core.Vec3i toCopy, double verticalOffset, org.joml.Vector3d dest) Copies the coordinates of a Mojang Vec3i and centers them horizontally and applies a vertical offset.- Parameters:
toCopy- The Mojang Vec3idest- The JOML vector to store into- Returns:
- The passed in JOML Vector3d
-
upFromBottomCenterOf
@Contract(value="_,_->new", pure=true) public static org.joml.Vector3d upFromBottomCenterOf(net.minecraft.core.Vec3i toCopy, double verticalOffset) Copies the coordinates of a Mojang Vec3i and centers them horizontally and applies a vertical offset.- Parameters:
toCopy- The Mojang Vec3i- Returns:
- A new JOML Vector3d
-
toMojang
@Contract(value="_->new", pure=true) public static net.minecraft.world.phys.Vec3 toMojang(org.joml.Vector3dc vec3d) Converts a JOML Vector3d to a Mojang Vec3.- Parameters:
vec3d- the JOML Vector3d- Returns:
- the Mojang Vec3
-
toMojang
@Contract(value="_->new", pure=true) public static net.minecraft.world.phys.Vec2 toMojang(org.joml.Vector2fc vec2f) Converts a JOML Vector2f to a Mojang Vec2.- Parameters:
vec2f- the JOML Vector2f- Returns:
- the Mojang Vec2
-
toMojang
@Contract(value="_->new", pure=true) public static net.minecraft.core.Vec3i toMojang(org.joml.Vector3ic vec3i) Converts a JOML Vector3i to a Mojang Vec3i.- Parameters:
vec3i- the JOML Vector3d- Returns:
- the Mojang Vec3
-
getAABBCenter
@Contract(value="_->new", pure=true) public static org.joml.Vector3d getAABBCenter(net.minecraft.world.phys.AABB aabb) Calculates the center of the specified Mojang AABB.- Parameters:
aabb- The Mojang AABB- Returns:
- A new JOML Vector3d
-
getAABBCenter
@Contract(value="_,_->param2", mutates="param2") public static org.joml.Vector3d getAABBCenter(net.minecraft.world.phys.AABB aabb, org.joml.Vector3d dest) Calculates the center of the specified Mojang AABB.- Parameters:
aabb- The Mojang AABBdest- The JOML vector to store into- Returns:
- The passed in JOML Vector3d
-