mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-28 11:29:17 +00:00
improved codes
This commit is contained in:
@@ -4,30 +4,37 @@ import org.joml.Vector3f;
|
||||
|
||||
public class Collider {
|
||||
private final Vector3f position;
|
||||
private final double width;
|
||||
private final double height;
|
||||
private final Vector3f point1;
|
||||
private final Vector3f point2;
|
||||
private final boolean canBeHitByProjectile;
|
||||
|
||||
public Collider(boolean canBeHitByProjectile, double height, Vector3f position, double width) {
|
||||
public Collider(boolean canBeHitByProjectile, Vector3f position, Vector3f point1, Vector3f point2) {
|
||||
this.canBeHitByProjectile = canBeHitByProjectile;
|
||||
this.height = height;
|
||||
this.position = position;
|
||||
this.width = width;
|
||||
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);
|
||||
}
|
||||
|
||||
public boolean canBeHitByProjectile() {
|
||||
return canBeHitByProjectile;
|
||||
}
|
||||
|
||||
public double height() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public Vector3f position() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public double width() {
|
||||
return width;
|
||||
public Vector3f point1() {
|
||||
return point1;
|
||||
}
|
||||
|
||||
public Vector3f point2() {
|
||||
return point2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,39 +55,7 @@ public class CustomFurniture {
|
||||
return placements.get(anchorType);
|
||||
}
|
||||
|
||||
public static class Placement {
|
||||
private final FurnitureElement[] elements;
|
||||
private final HitBox[] hitboxes;
|
||||
private final Collider[] colliders;
|
||||
private final RotationRule rotationRule;
|
||||
private final AlignmentRule alignmentRule;
|
||||
|
||||
public Placement(FurnitureElement[] elements, HitBox[] hitboxes, Collider[] colliders, RotationRule rotationRule, AlignmentRule alignmentRule) {
|
||||
this.elements = elements;
|
||||
this.hitboxes = hitboxes;
|
||||
this.colliders = colliders;
|
||||
this.rotationRule = rotationRule;
|
||||
this.alignmentRule = alignmentRule;
|
||||
}
|
||||
|
||||
public HitBox[] hitboxes() {
|
||||
return hitboxes;
|
||||
}
|
||||
|
||||
public Collider[] colliders() {
|
||||
return colliders;
|
||||
}
|
||||
|
||||
public FurnitureElement[] elements() {
|
||||
return elements;
|
||||
}
|
||||
|
||||
public RotationRule rotationRule() {
|
||||
return rotationRule;
|
||||
}
|
||||
|
||||
public AlignmentRule alignmentRule() {
|
||||
return alignmentRule;
|
||||
}
|
||||
public record Placement(FurnitureElement[] elements, HitBox[] hitBoxes, Collider[] colliders,
|
||||
RotationRule rotationRule, AlignmentRule alignmentRule) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user