chore: Update EaglercraftVersion to 0.3.1 and reset motionX and motionZ if they are NaN or infinite

This commit is contained in:
HoosierTransfer 2024-05-09 18:19:03 -04:00
parent 61125d8774
commit ce0c54cabb
2 changed files with 14 additions and 3 deletions

View File

@ -9,7 +9,7 @@ public class EaglercraftVersion {
/// Customize these to fit your fork:
public static final String projectForkName = "Eaglercraft Lambda";
public static final String projectForkVersion = "0.3.0";
public static final String projectForkVersion = "0.3.1";
public static final String projectForkVendor = "hoosiertransfer";
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";

View File

@ -1435,8 +1435,8 @@ public abstract class EntityLivingBase extends Entity {
if (rotation < 0.0F) {
double d9 = d8 * (double) (-MathHelper.sin(rotation)) * 0.04D;
this.motionY += d9 * 3.2D;
this.motionX -= vec3d.xCoord * d9 / d6;
this.motionZ -= vec3d.zCoord * d9 / d6;
this.motionX -= vec3d.xCoord * d9 / (d6);
this.motionZ -= vec3d.zCoord * d9 / (d6);
}
if (d6 > 0.0D) {
@ -1447,6 +1447,17 @@ public abstract class EntityLivingBase extends Entity {
this.motionX *= 0.9900000095367432D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9900000095367432D;
// if motion is nan or infinite, reset it
if (Double.isNaN(this.motionX) || Double.isInfinite(this.motionX)) {
this.motionX = 0.0D;
}
if (Double.isNaN(this.motionZ) || Double.isInfinite(this.motionZ)) {
this.motionZ = 0.0D;
}
this.motionX = MathHelper.clamp_double(this.motionX, -4.0D, 4.0D);
this.motionZ = MathHelper.clamp_double(this.motionZ, -4.0D, 4.0D);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.isCollidedHorizontally && !this.worldObj.isRemote) {