mirror of
https://github.com/Minestom/Minestom.git
synced 2024-06-24 13:34:53 +02:00
Set proper pose once flying finishes
This commit is contained in:
parent
1933914bbc
commit
ee435f43f2
|
@ -1069,6 +1069,8 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler
|
|||
* @param pose the new entity pose
|
||||
*/
|
||||
public void setPose(@NotNull Pose pose) {
|
||||
System.out.println("Set pose: " + pose);
|
||||
|
||||
this.entityMeta.setPose(pose);
|
||||
}
|
||||
|
||||
|
|
|
@ -1682,17 +1682,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
|||
* @param flying should the player fly
|
||||
*/
|
||||
public void setFlying(boolean flying) {
|
||||
if(this.flying != flying) {
|
||||
Pose pose = getPose();
|
||||
|
||||
if(this.isSneaking() && pose == Pose.STANDING) {
|
||||
setPose(Pose.SNEAKING);
|
||||
} else if(pose == Pose.SNEAKING) {
|
||||
setPose(Pose.STANDING);
|
||||
}
|
||||
}
|
||||
|
||||
this.flying = flying;
|
||||
refreshFlying(flying);
|
||||
refreshAbilities();
|
||||
}
|
||||
|
||||
|
@ -1705,6 +1695,17 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
|||
* @see #setFlying(boolean) instead
|
||||
*/
|
||||
public void refreshFlying(boolean flying) {
|
||||
//When the player starts or stops flying, their pose needs to change
|
||||
if(this.flying != flying) {
|
||||
Pose pose = getPose();
|
||||
|
||||
if(this.isSneaking() && pose == Pose.STANDING) {
|
||||
setPose(Pose.SNEAKING);
|
||||
} else if(pose == Pose.SNEAKING) {
|
||||
setPose(Pose.STANDING);
|
||||
}
|
||||
}
|
||||
|
||||
this.flying = flying;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user