mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-29 04:28:21 +01:00
Added Entity#setPose
This commit is contained in:
parent
32b8d83ac9
commit
cecf6310ca
@ -41,7 +41,7 @@ public final class CommandManager {
|
||||
|
||||
public static final String COMMAND_PREFIX = "/";
|
||||
|
||||
private volatile boolean running;
|
||||
private volatile boolean running = true;
|
||||
|
||||
private final ConsoleSender consoleSender = new ConsoleSender();
|
||||
|
||||
@ -51,7 +51,6 @@ public final class CommandManager {
|
||||
private CommandCallback unknownCommandCallback;
|
||||
|
||||
public CommandManager() {
|
||||
running = true;
|
||||
// Setup console thread
|
||||
Thread consoleThread = new Thread(() -> {
|
||||
BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
|
||||
|
@ -1136,9 +1136,33 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
|
||||
* @param sneaking true to make the entity sneak
|
||||
*/
|
||||
public void setSneaking(boolean sneaking) {
|
||||
this.crouched = sneaking;
|
||||
this.pose = sneaking ? Pose.SNEAKING : Pose.STANDING;
|
||||
sendMetadataIndex(0);
|
||||
setPose(sneaking ? Pose.SNEAKING : Pose.STANDING);
|
||||
sendMetadataIndex(0); // update the crouched metadata
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current entity pose.
|
||||
*
|
||||
* @return the entity pose
|
||||
*/
|
||||
@NotNull
|
||||
public Pose getPose() {
|
||||
return pose;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the entity pose.
|
||||
* <p>
|
||||
* The internal {@code crouched} and {@code swimming} field will be
|
||||
* updated accordingly.
|
||||
*
|
||||
* @param pose the new entity pose
|
||||
*/
|
||||
@NotNull
|
||||
public void setPose(@NotNull Pose pose) {
|
||||
this.crouched = pose == Pose.SNEAKING;
|
||||
this.swimming = pose == Pose.SWIMMING;
|
||||
this.pose = pose;
|
||||
sendMetadataIndex(6);
|
||||
}
|
||||
|
||||
@ -1159,6 +1183,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
|
||||
*
|
||||
* @return the current position of the entity
|
||||
*/
|
||||
@NotNull
|
||||
public Position getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
@ -86,9 +86,9 @@ public class WindowListener {
|
||||
}
|
||||
|
||||
// Prevent the player from picking a ghost item in cursor
|
||||
//if (!successful) {
|
||||
refreshCursorItem(player, inventory);
|
||||
//}
|
||||
if (!successful) {
|
||||
refreshCursorItem(player, inventory);
|
||||
}
|
||||
|
||||
WindowConfirmationPacket windowConfirmationPacket = new WindowConfirmationPacket();
|
||||
windowConfirmationPacket.windowId = windowId;
|
||||
|
Loading…
Reference in New Issue
Block a user