SPIGOT-4753: Add Pose API

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2019-04-27 10:26:35 +10:00
parent bd15f6a4bc
commit c118b02278
3 changed files with 93 additions and 0 deletions

View File

@@ -571,4 +571,16 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
@NotNull
BlockFace getFacing();
/**
* Gets the entity's current pose.
*
* <b>Note that the pose is only updated at the end of a tick, so may be
* inconsistent with other methods. eg {@link Player#isSneaking()} being
* true does not imply the current pose will be {@link Pose#SNEAKING}</b>
*
* @return current pose
*/
@NotNull
Pose getPose();
}

View File

@@ -0,0 +1,37 @@
package org.bukkit.entity;
/**
* Represents an entity body pose.
*/
public enum Pose {
/**
* Entity is standing normally.
*
*/
STANDING,
/**
* Entity is gliding.
*/
FALL_FLYING,
/**
* Entity is sleeping.
*/
SLEEPING,
/**
* Entity is swimming.
*/
SWIMMING,
/**
* Entity is riptiding with a trident.
*/
SPIN_ATTACK,
/**
* Entity is sneaking.
*/
SNEAKING,
/**
* Entity is dead.
*/
DYING;
}