NPCs properly stay floating when not navigating and in the air.

This commit is contained in:
luisc committed 2021-12-08 04:41:41 -06:00
1 parent 2147bd00d0
commit c2564de470
3 files changed
+5 -13

No files matched your search

@@ -31,17 +31,16 @@ public abstract class EntityNPCFlying extends EntityNPCInterface {
public void onLivingUpdate()
{
if(!canFly() || this.isJumping){
super.onLivingUpdate();
super.onLivingUpdate();
if(!canFly()){
return;
}
if (!this.onGround && !this.getMoveHelper().isUpdating())
{
this.motionY *= 0.0D;
this.velocityChanged = true;
}
super.onLivingUpdate();
}
@Override
@@ -931,13 +931,6 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
return true;
}
@Override
public void addVelocity(double d, double d1, double d2) {
if (isWalking() && !isKilled())
super.addVelocity(d, d1, d2);
}
@Override
public void readEntityFromNBT(NBTTagCompound compound) {
super.readEntityFromNBT(compound);
@@ -460,14 +460,14 @@ public class ScriptEntity<T extends Entity> implements IEntity {
@Override
public void knockback(int power, float direction){
float v = direction * (float)Math.PI / 180.0F;
entity.velocityChanged = true;
entity.addVelocity(-MathHelper.sin(v) * (float)power, 0.1D + power * 0.04f, MathHelper.cos(v) * (float)power);
entity.velocityChanged = true;
}
public void knockback(int xpower, int ypower, int zpower, float direction){
float v = direction * (float)Math.PI / 180.0F;
entity.velocityChanged = true;
entity.addVelocity(-MathHelper.sin(v) * (float)xpower, 0.1D + ypower * 0.04f, MathHelper.cos(v) * (float)zpower);
entity.velocityChanged = true;
}
public void setImmune(int ticks) {