Fix Flying Gravity Syncing Issue

This commit is contained in:
Kam committed 2026-02-23 04:11:07 -05:00
1 parent adf9cd7012
commit 20dc8e0efc
2 files changed
+30 -10

No files matched your search

@@ -76,13 +76,13 @@ public abstract class EntityNPCFlying extends EntityNPCInterface {
this.flyLimitAllow = true;
setNpcFlyingState(true);
double d3 = this.motionY;
super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
this.motionY = d3;
double desiredMotionY = this.motionY;
if (this.getNavigator().noPath()) {
this.motionY = -Math.abs(this.ais.flyGravity);
desiredMotionY = -Math.abs(this.ais.flyGravity);
}
this.motionY = desiredMotionY;
super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
this.motionY = desiredMotionY;
this.updateLimbSwing();
}
@@ -140,13 +140,13 @@ public abstract class EntityNPCFlying extends EntityNPCInterface {
return;
}
double d3 = this.motionY;
super.performMountedMovement(strafe, forward, moveSpeed);
this.motionY = d3;
double desiredMotionY = this.motionY;
if (this.getNavigator().noPath()) {
this.motionY = -Math.abs(this.ais.flyGravity);
desiredMotionY = -Math.abs(this.ais.flyGravity);
}
this.motionY = desiredMotionY;
super.performMountedMovement(strafe, forward, moveSpeed);
this.motionY = desiredMotionY;
this.updateLimbSwing();
}
@@ -1806,6 +1806,11 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
compound.setBoolean("DeadBody", stats.hideKilledBody);
compound.setInteger("StandingState", ais.standingType.ordinal());
compound.setInteger("MovingState", ais.movingType.ordinal());
compound.setInteger("MovingType", ais.movementType);
compound.setDouble("FlySpeed", ais.flySpeed);
compound.setDouble("FlyGravity", ais.flyGravity);
compound.setBoolean("HasFlyLimit", ais.hasFlyLimit);
compound.setInteger("FlyHeightLimit", ais.flyHeightLimit);
compound.setInteger("Orientation", ais.orientation);
compound.setFloat("OffsetY", ais.bodyOffsetY);
compound.setInteger("Role", advanced.role.ordinal());
@@ -1854,6 +1859,21 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
stats.hideKilledBody = compound.getBoolean("DeadBody");
ais.standingType = EnumStandingType.values()[compound.getInteger("StandingState") % EnumStandingType.values().length];
ais.movingType = EnumMovingType.values()[compound.getInteger("MovingState") % EnumMovingType.values().length];
if (compound.hasKey("MovingType", Constants.NBT.TAG_INT)) {
ais.movementType = compound.getInteger("MovingType");
}
if (compound.hasKey("FlySpeed", Constants.NBT.TAG_DOUBLE)) {
ais.flySpeed = compound.getDouble("FlySpeed");
}
if (compound.hasKey("FlyGravity", Constants.NBT.TAG_DOUBLE)) {
ais.flyGravity = compound.getDouble("FlyGravity");
}
if (compound.hasKey("HasFlyLimit", Constants.NBT.TAG_BYTE)) {
ais.hasFlyLimit = compound.getBoolean("HasFlyLimit");
}
if (compound.hasKey("FlyHeightLimit", Constants.NBT.TAG_INT)) {
ais.flyHeightLimit = compound.getInteger("FlyHeightLimit");
}
ais.orientation = compound.getInteger("Orientation");
ais.bodyOffsetY = compound.getFloat("OffsetY");