Skip to content

Commit

Permalink
More maths
Browse files Browse the repository at this point in the history
  • Loading branch information
LatvianModder committed Oct 21, 2023
1 parent 49186e3 commit 96e8f36
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions common/src/main/java/dev/latvian/mods/kubejs/bindings/KMath.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
package dev.latvian.mods.kubejs.bindings;

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f;
import com.mojang.math.Quaternion;
import com.mojang.math.Vector3d;
import com.mojang.math.Vector3f;
import com.mojang.math.Vector4f;
import net.minecraft.core.BlockPos;
import net.minecraft.world.phys.Vec3;

public class KMath {
public static final double E = 2.7182818284590452354;
Expand All @@ -12,6 +20,39 @@ public static BlockPos block(double x, double y, double z) {
return new BlockPos(x, y, z);
}

// why
public static Vec3 v3(double x, double y, double z) {
return new Vec3(x, y, z);
}

public static Vector3d v3d(double x, double y, double z) {
return new Vector3d(x, y, z);
}

public static Vector3f v3f(float x, float y, float z) {
return new Vector3f(x, y, z);
}

public static Vector4f v4f(float x, float y, float z, float w) {
return new Vector4f(x, y, z, w);
}

public static Matrix3f m3f() {
return new Matrix3f();
}

public static Matrix4f m4f() {
return new Matrix4f();
}

public static PoseStack poseStack() {
return new PoseStack();
}

public static Quaternion quaternion(float x, float y, float z, float w) {
return new Quaternion(x, y, z, w);
}

public static double rad(double value) {
return value * DEGREES_TO_RADIANS;
}
Expand Down

0 comments on commit 96e8f36

Please sign in to comment.