geforkt von Mirrors/Paper
SPIGOT-4753: Add Pose API
By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
Ursprung
bd15f6a4bc
Commit
c118b02278
@ -571,4 +571,16 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
BlockFace getFacing();
|
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();
|
||||||
}
|
}
|
||||||
|
37
paper-api/src/main/java/org/bukkit/entity/Pose.java
Normale Datei
37
paper-api/src/main/java/org/bukkit/entity/Pose.java
Normale Datei
@ -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;
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package org.bukkit.event.entity;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Pose;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when an entity changes its pose.
|
||||||
|
*
|
||||||
|
* @see Entity#getPose()
|
||||||
|
*/
|
||||||
|
public class EntityPoseChangeEvent extends EntityEvent {
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
//
|
||||||
|
private final Pose pose;
|
||||||
|
|
||||||
|
public EntityPoseChangeEvent(@NotNull Entity who, @NotNull Pose pose) {
|
||||||
|
super(who);
|
||||||
|
this.pose = pose;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the entity's new pose.
|
||||||
|
*
|
||||||
|
* @return the new pose
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public Pose getPose() {
|
||||||
|
return pose;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren