mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 19:46:42 +01:00
Revert: Don't use NaN! Seriously, it's a bad idea. Crashes everyplace.
This commit is contained in:
parent
ffc0f3d816
commit
c9d2c99ccc
2 changed files with 5 additions and 5 deletions
|
@ -12,6 +12,6 @@ public interface IGravity {
|
||||||
float getGravitationConstant();
|
float getGravitationConstant();
|
||||||
|
|
||||||
default void clearGraviationConstant() {
|
default void clearGraviationConstant() {
|
||||||
setGraviationConstant(Float.NaN);
|
setGraviationConstant(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ class PlayerGravityDelegate implements IUpdatable, IGravity, InbtSerialisable, I
|
||||||
|
|
||||||
public boolean isFlying = false;
|
public boolean isFlying = false;
|
||||||
|
|
||||||
private float gravity = Float.NaN;
|
private float gravity = 0;
|
||||||
|
|
||||||
public PlayerGravityDelegate(IPlayer player) {
|
public PlayerGravityDelegate(IPlayer player) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
@ -122,7 +122,7 @@ class PlayerGravityDelegate implements IUpdatable, IGravity, InbtSerialisable, I
|
||||||
isFlying = entity.capabilities.isFlying && !entity.capabilities.isCreativeMode;
|
isFlying = entity.capabilities.isFlying && !entity.capabilities.isCreativeMode;
|
||||||
|
|
||||||
if (!entity.capabilities.isFlying || !entity.capabilities.isCreativeMode) {
|
if (!entity.capabilities.isFlying || !entity.capabilities.isCreativeMode) {
|
||||||
if (gravity != Float.NaN) {
|
if (gravity != 0) {
|
||||||
entity.motionY += 0.08;
|
entity.motionY += 0.08;
|
||||||
entity.motionY -= gravity;
|
entity.motionY -= gravity;
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ class PlayerGravityDelegate implements IUpdatable, IGravity, InbtSerialisable, I
|
||||||
compound.setFloat("flightExperience", flightExperience);
|
compound.setFloat("flightExperience", flightExperience);
|
||||||
compound.setBoolean("isFlying", isFlying);
|
compound.setBoolean("isFlying", isFlying);
|
||||||
|
|
||||||
if (gravity != Float.NaN) {
|
if (gravity != 0) {
|
||||||
compound.setFloat("gravity", gravity);
|
compound.setFloat("gravity", gravity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ class PlayerGravityDelegate implements IUpdatable, IGravity, InbtSerialisable, I
|
||||||
if (compound.hasKey("gravity")) {
|
if (compound.hasKey("gravity")) {
|
||||||
gravity = compound.getFloat("gravity");
|
gravity = compound.getFloat("gravity");
|
||||||
} else {
|
} else {
|
||||||
gravity = Float.NaN;
|
gravity = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue