Archived
0

Merge branch 'dev/utils' into dev/world

This commit is contained in:
2021-07-17 17:37:07 +03:00
10 changed files with 217 additions and 27 deletions

View File

@@ -0,0 +1,49 @@
package mc.utils.vector;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
@Getter
@EqualsAndHashCode
@ToString
public class Vector2f {
private float x;
private float y;
public Vector2f(float x, float y) {
this.x = x;
this.y = y;
}
public Vector2f(Vector2f vector2f) {
this(vector2f.getX(), vector2f.getY());
}
public Vector2f() {
this(0f, 0f);
}
public void set(float x, float y) {
this.x = x;
this.y = y;
}
public void set(Vector2f vector2f) {
this.set(vector2f.getX(), vector2f.getY());
}
public void add(float x, float y) {
this.x += x;
this.y += y;
}
public void add(Vector2f vector2f) {
this.add(vector2f.getX(), vector2f.getY());
}
public Vector2f copy() {
return new Vector2f(this);
}
}

View File

@@ -0,0 +1,53 @@
package mc.utils.vector;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
@Getter
@EqualsAndHashCode
@ToString
public class Vector3d {
private double x;
private double y;
private double z;
public Vector3d(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
}
public Vector3d(Vector3d vector3d) {
this(vector3d.getX(), vector3d.getY(), vector3d.getZ());
}
public Vector3d() {
this(0d, 0d, 0d);
}
public void set(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
}
public void set(Vector3d vector3d) {
this.set(vector3d.getX(), vector3d.getY(), vector3d.getZ());
}
public void add(double x, double y, double z) {
this.x += x;
this.y += y;
this.z += z;
}
public void add(Vector3d vector3d) {
this.add(vector3d.getX(), vector3d.getY(), vector3d.getZ());
}
public Vector3d copy() {
return new Vector3d(this);
}
}

View File

@@ -0,0 +1,53 @@
package mc.utils.vector;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
@Getter
@EqualsAndHashCode
@ToString
public class Vector3i {
private int x;
private int y;
private int z;
public Vector3i(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public Vector3i(Vector3i vector3i) {
this(vector3i.getX(), vector3i.getY(), vector3i.getZ());
}
public Vector3i() {
this(0, 0, 0);
}
public void set(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public void set(Vector3i vector3i) {
this.set(vector3i.getX(), vector3i.getY(), vector3i.getZ());
}
public void add(int x, int y, int z) {
this.x += x;
this.y += y;
this.z += z;
}
public void add(Vector3i vector3i) {
this.add(vector3i.getX(), vector3i.getY(), vector3i.getZ());
}
public Vector3i copy() {
return new Vector3i(this);
}
}