mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-28 11:29:17 +00:00
added collider
This commit is contained in:
@@ -3,21 +3,18 @@ package net.momirealms.craftengine.core.entity.furniture;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class Collider {
|
||||
private final Vector3f position;
|
||||
private final Vector3f point1;
|
||||
private final Vector3f point2;
|
||||
private final boolean canBeHitByProjectile;
|
||||
|
||||
public Collider(boolean canBeHitByProjectile, Vector3f position, Vector3f point1, Vector3f point2) {
|
||||
public Collider(boolean canBeHitByProjectile, Vector3f point1, Vector3f point2) {
|
||||
this.canBeHitByProjectile = canBeHitByProjectile;
|
||||
this.position = position;
|
||||
this.point1 = point1;
|
||||
this.point2 = point2;
|
||||
}
|
||||
|
||||
public Collider(boolean canBeHitByProjectile, Vector3f position, float width, float height) {
|
||||
this.canBeHitByProjectile = canBeHitByProjectile;
|
||||
this.position = position;
|
||||
this.point1 = new Vector3f(position.x - width / 2, position.y, position.z - width / 2);
|
||||
this.point2 = new Vector3f(position.x + width / 2, position.y + height, position.z + width / 2);
|
||||
}
|
||||
@@ -26,10 +23,6 @@ public class Collider {
|
||||
return canBeHitByProjectile;
|
||||
}
|
||||
|
||||
public Vector3f position() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public Vector3f point1() {
|
||||
return point1;
|
||||
}
|
||||
|
||||
@@ -21,5 +21,5 @@ public interface FurnitureElement {
|
||||
|
||||
Vector3f position();
|
||||
|
||||
void addSpawnPackets(int entityId, double x, double y, double z, float yaw, Consumer<Object> packets);
|
||||
void addSpawnPackets(int entityId, double x, double y, double z, float yaw, Quaternionf conjugated, Consumer<Object> packets);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.momirealms.craftengine.core.entity.furniture;
|
||||
|
||||
import net.momirealms.craftengine.core.util.Key;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
@@ -10,7 +11,7 @@ public interface HitBox {
|
||||
|
||||
Key type();
|
||||
|
||||
void addSpawnPackets(int[] entityId, double x, double y, double z, float yaw, Consumer<Object> packets);
|
||||
void addSpawnPackets(int[] entityId, double x, double y, double z, float yaw, Quaternionf conjugated, Consumer<Object> packets);
|
||||
|
||||
int[] acquireEntityIds(Supplier<Integer> entityIdSupplier);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user