mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-02 11:21:15 +01:00
Remove unnecessary casts
This commit is contained in:
parent
3067f1daaa
commit
5f75ea7d3a
@ -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;
|
||||
}
|
||||
|
@ -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.
|
||||
* <p>
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
@ -422,15 +422,15 @@ public class Vector implements PublicCloneable<Vector> {
|
||||
double sinTheta = Math.sin(angle);
|
||||
double dotProduct = this.dot(axis);
|
||||
|
||||
this.x = (float) (x2 * dotProduct * (1d - cosTheta)
|
||||
this.x = x2 * dotProduct * (1d - cosTheta)
|
||||
+ x * cosTheta
|
||||
+ (-z2 * y + y2 * z) * sinTheta);
|
||||
this.y = (float) (y2 * dotProduct * (1d - cosTheta)
|
||||
+ (-z2 * y + y2 * z) * sinTheta;
|
||||
this.y = y2 * dotProduct * (1d - cosTheta)
|
||||
+ y * cosTheta
|
||||
+ (z2 * x - x2 * z) * sinTheta);
|
||||
this.z = (float) (z2 * dotProduct * (1d - cosTheta)
|
||||
+ (z2 * x - x2 * z) * sinTheta;
|
||||
this.z = z2 * dotProduct * (1d - cosTheta)
|
||||
+ z * cosTheta
|
||||
+ (-y2 * x + x2 * y) * sinTheta);
|
||||
+ (-y2 * x + x2 * y) * sinTheta;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user