mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-01 05:58:00 +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 = "/";
|
public static final String COMMAND_PREFIX = "/";
|
||||||
|
|
||||||
private volatile boolean running;
|
private volatile boolean running = true;
|
||||||
|
|
||||||
private final ConsoleSender consoleSender = new ConsoleSender();
|
private final ConsoleSender consoleSender = new ConsoleSender();
|
||||||
|
|
||||||
@ -51,7 +51,6 @@ public final class CommandManager {
|
|||||||
private CommandCallback unknownCommandCallback;
|
private CommandCallback unknownCommandCallback;
|
||||||
|
|
||||||
public CommandManager() {
|
public CommandManager() {
|
||||||
running = true;
|
|
||||||
// Setup console thread
|
// Setup console thread
|
||||||
Thread consoleThread = new Thread(() -> {
|
Thread consoleThread = new Thread(() -> {
|
||||||
BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
|
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
|
* @param sneaking true to make the entity sneak
|
||||||
*/
|
*/
|
||||||
public void setSneaking(boolean sneaking) {
|
public void setSneaking(boolean sneaking) {
|
||||||
this.crouched = sneaking;
|
setPose(sneaking ? Pose.SNEAKING : Pose.STANDING);
|
||||||
this.pose = sneaking ? Pose.SNEAKING : Pose.STANDING;
|
sendMetadataIndex(0); // update the crouched metadata
|
||||||
sendMetadataIndex(0);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
sendMetadataIndex(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1159,6 +1183,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P
|
|||||||
*
|
*
|
||||||
* @return the current position of the entity
|
* @return the current position of the entity
|
||||||
*/
|
*/
|
||||||
|
@NotNull
|
||||||
public Position getPosition() {
|
public Position getPosition() {
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
@ -86,9 +86,9 @@ public class WindowListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prevent the player from picking a ghost item in cursor
|
// Prevent the player from picking a ghost item in cursor
|
||||||
//if (!successful) {
|
if (!successful) {
|
||||||
refreshCursorItem(player, inventory);
|
refreshCursorItem(player, inventory);
|
||||||
//}
|
}
|
||||||
|
|
||||||
WindowConfirmationPacket windowConfirmationPacket = new WindowConfirmationPacket();
|
WindowConfirmationPacket windowConfirmationPacket = new WindowConfirmationPacket();
|
||||||
windowConfirmationPacket.windowId = windowId;
|
windowConfirmationPacket.windowId = windowId;
|
||||||
|
Loading…
Reference in New Issue
Block a user