diff --git a/src/main/java/net/minestom/server/collision/CollisionUtils.java b/src/main/java/net/minestom/server/collision/CollisionUtils.java index dbdf738c2..a55d0f172 100644 --- a/src/main/java/net/minestom/server/collision/CollisionUtils.java +++ b/src/main/java/net/minestom/server/collision/CollisionUtils.java @@ -115,9 +115,9 @@ public class CollisionUtils { } // find the corner which moved the least - float smallestDisplacement = Float.POSITIVE_INFINITY; + double smallestDisplacement = Double.POSITIVE_INFINITY; for (int i = 0; i < corners.length; i++) { - final float displacement = (float) corners[i].distance(cornersCopy[i]); + final double displacement = corners[i].distance(cornersCopy[i]); if (displacement < smallestDisplacement) { smallestDisplacement = displacement; } diff --git a/src/main/java/net/minestom/server/entity/Entity.java b/src/main/java/net/minestom/server/entity/Entity.java index 354b6eff8..cf8a169c5 100644 --- a/src/main/java/net/minestom/server/entity/Entity.java +++ b/src/main/java/net/minestom/server/entity/Entity.java @@ -93,9 +93,9 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P // Velocity protected Vector velocity = new Vector(); // Movement in block per second - protected float gravityDragPerTick; - protected float gravityAcceleration; - protected float gravityTerminalVelocity; + protected double gravityDragPerTick; + protected double gravityAcceleration; + protected double gravityTerminalVelocity; protected int gravityTickCount; // Number of tick where gravity tick was applied private boolean autoViewable; @@ -485,8 +485,8 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P Vector newVelocityOut = new Vector(); // Gravity force - final float gravityY = !noGravity ? Math.min( - gravityDragPerTick + (gravityAcceleration * (float) gravityTickCount), + final double gravityY = !noGravity ? Math.min( + gravityDragPerTick + (gravityAcceleration * (double) gravityTickCount), gravityTerminalVelocity) : 0f; final Vector deltaPos = new Vector( @@ -711,7 +711,8 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P * Changes the internal entity bounding box. *
* WARNING: this does not change the entity hit-box which is client-side.
- * @param x the bounding box X size
+ *
+ * @param x the bounding box X size
* @param y the bounding box Y size
* @param z the bounding box Z size
*/
@@ -814,7 +815,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
*
* @return the gravity drag per tick in block
*/
- public float getGravityDragPerTick() {
+ public double getGravityDragPerTick() {
return gravityDragPerTick;
}
@@ -823,7 +824,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
*
* @return the gravity acceleration in block
*/
- public float getGravityAcceleration() {
+ public double getGravityAcceleration() {
return gravityAcceleration;
}
@@ -832,7 +833,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
*
* @return the maximum gravity velocity in block
*/
- public float getGravityTerminalVelocity() {
+ public double getGravityTerminalVelocity() {
return gravityTerminalVelocity;
}
diff --git a/src/main/java/net/minestom/server/utils/Vector.java b/src/main/java/net/minestom/server/utils/Vector.java
index e3c36bb7b..225f174f1 100644
--- a/src/main/java/net/minestom/server/utils/Vector.java
+++ b/src/main/java/net/minestom/server/utils/Vector.java
@@ -422,15 +422,15 @@ public class Vector implements PublicCloneable