Expose gravity and air drag (#14196)

This commit is contained in:
Daniel Karnaukh
2026-10-09 16:52:43 +02:00
committed by GitHub
parent cc7b98af63
commit 21a495c94c
3 changed files with 38 additions and 0 deletions
+2
View File
@@ -167,6 +167,8 @@ public net.minecraft.world.entity.Display$TextDisplay setText(Lnet/minecraft/net
public net.minecraft.world.entity.Display$TextDisplay setTextOpacity(B)V
public net.minecraft.world.entity.Entity DATA_TICKS_FROZEN
public net.minecraft.world.entity.Entity FLAG_INVISIBLE
public net.minecraft.world.entity.Entity getAirDrag()F
public net.minecraft.world.entity.Entity getDefaultGravity()D
public net.minecraft.world.entity.Entity getEncodeId()Ljava/lang/String;
public net.minecraft.world.entity.Entity getFireImmuneTicks()I
public net.minecraft.world.entity.Entity getSharedFlag(I)Z
@@ -921,6 +921,27 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
void setGravity(boolean gravity);
/**
* Returns the default acceleration due to gravity (in blocks per tick). Ignores {@link Entity#hasGravity()}.
*
* @return the default acceleration due to gravity
*/
double getDefaultGravity();
/**
* Returns the acceleration due to gravity (in blocks per tick). If {@link Entity#hasGravity()} is false, returns 0.
*
* @return the acceleration due to gravity
*/
double getGravity();
/**
* Returns the air drag factor applied to this entity.
*
* @return the air drag factor
*/
float getAirDrag();
/**
* Gets the period of time (in ticks) before this entity can use a portal.
*
@@ -938,6 +938,21 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
this.getHandle().setNoGravity(!gravity);
}
@Override
public double getDefaultGravity() {
return this.getHandle().getDefaultGravity();
}
@Override
public double getGravity() {
return this.getHandle().getGravity();
}
@Override
public float getAirDrag() {
return this.getHandle().getAirDrag();
}
@Override
public int getPortalCooldown() {
return this.getHandle().getPortalCooldown();