
net.minecraft.server.EntityFlying Maven / Gradle / Ivy
package net.minecraft.server;
import org.bukkit.entity.Flying;
import org.jetbrains.annotations.NotNull;
public abstract class EntityFlying extends EntityInsentient {
public EntityFlying(World world) {
super(world);
}
@NotNull
@Override
public Flying getEntityBukkit() {
return (Flying) super.getEntityBukkit();
}
public void fall(float f, float f1) {
}
public void updateFallState(double y, boolean onGround, Block block, BlockPosition blockposition) {
}
public void moveEntityWithHeading(float strafe, float forward) {
if (this.isInWater()) {
this.moveFlying(strafe, forward, 0.02F);
this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.800000011920929D;
this.motY *= 0.800000011920929D;
this.motZ *= 0.800000011920929D;
} else if (this.isInLava()) {
this.moveFlying(strafe, forward, 0.02F);
this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.5D;
this.motY *= 0.5D;
this.motZ *= 0.5D;
} else {
float f2 = 0.91F;
if (this.onGround) {
f2 = this.world.getType(new BlockPosition(MathHelper.floor(this.locX), MathHelper.floor(this.getBoundingBox().b) - 1, MathHelper.floor(this.locZ))).getBlock().frictionFactor * 0.91F;
}
float f3 = 0.16277136F / (f2 * f2 * f2);
this.moveFlying(strafe, forward, this.onGround ? 0.1F * f3 : 0.02F);
f2 = 0.91F;
if (this.onGround) {
f2 = this.world.getType(new BlockPosition(MathHelper.floor(this.locX), MathHelper.floor(this.getBoundingBox().b) - 1, MathHelper.floor(this.locZ))).getBlock().frictionFactor * 0.91F;
}
this.move(this.motX, this.motY, this.motZ);
this.motX *= f2;
this.motY *= f2;
this.motZ *= f2;
}
this.prevLimbSwingAmount = this.limbSwingAmount;
double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f4 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;
if (f4 > 1.0F) {
f4 = 1.0F;
}
this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
this.limbSwing += this.limbSwingAmount;
}
public boolean isOnLadder() {
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy