mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix entity motion (arrows now rotate correctly) (#3307)
This commit is contained in:
parent
47d14e12eb
commit
c31bd456f6
1 changed files with 33 additions and 11 deletions
|
@ -216,19 +216,41 @@ public class Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) {
|
public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround) {
|
||||||
setYaw(yaw);
|
position = Vector3f.from(position.getX() + relX, position.getY() + relY, position.getZ() + relZ);
|
||||||
setPitch(pitch);
|
|
||||||
setHeadYaw(headYaw);
|
|
||||||
setOnGround(isOnGround);
|
|
||||||
this.position = Vector3f.from(position.getX() + relX, position.getY() + relY, position.getZ() + relZ);
|
|
||||||
|
|
||||||
MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket();
|
MoveEntityDeltaPacket moveEntityPacket = new MoveEntityDeltaPacket();
|
||||||
moveEntityPacket.setRuntimeEntityId(geyserId);
|
moveEntityPacket.setRuntimeEntityId(geyserId);
|
||||||
moveEntityPacket.setPosition(position);
|
if (relX != 0.0) {
|
||||||
moveEntityPacket.setRotation(getBedrockRotation());
|
moveEntityPacket.setX(position.getX());
|
||||||
moveEntityPacket.setOnGround(isOnGround);
|
moveEntityPacket.getFlags().add(MoveEntityDeltaPacket.Flag.HAS_X);
|
||||||
moveEntityPacket.setTeleported(false);
|
}
|
||||||
|
if (relY != 0.0) {
|
||||||
|
moveEntityPacket.setY(position.getY());
|
||||||
|
moveEntityPacket.getFlags().add(MoveEntityDeltaPacket.Flag.HAS_Y);
|
||||||
|
}
|
||||||
|
if (relZ != 0.0) {
|
||||||
|
moveEntityPacket.setZ(position.getZ());
|
||||||
|
moveEntityPacket.getFlags().add(MoveEntityDeltaPacket.Flag.HAS_Z);
|
||||||
|
}
|
||||||
|
if (pitch != this.pitch) {
|
||||||
|
this.pitch = pitch;
|
||||||
|
moveEntityPacket.setPitch(pitch);
|
||||||
|
moveEntityPacket.getFlags().add(MoveEntityDeltaPacket.Flag.HAS_PITCH);
|
||||||
|
}
|
||||||
|
if (yaw != this.yaw) {
|
||||||
|
this.yaw = yaw;
|
||||||
|
moveEntityPacket.setYaw(yaw);
|
||||||
|
moveEntityPacket.getFlags().add(MoveEntityDeltaPacket.Flag.HAS_YAW);
|
||||||
|
}
|
||||||
|
if (headYaw != this.headYaw) {
|
||||||
|
this.headYaw = headYaw;
|
||||||
|
moveEntityPacket.setHeadYaw(headYaw);
|
||||||
|
moveEntityPacket.getFlags().add(MoveEntityDeltaPacket.Flag.HAS_HEAD_YAW);
|
||||||
|
}
|
||||||
|
setOnGround(isOnGround);
|
||||||
|
if (isOnGround) {
|
||||||
|
moveEntityPacket.getFlags().add(MoveEntityDeltaPacket.Flag.ON_GROUND);
|
||||||
|
}
|
||||||
session.sendUpstreamPacket(moveEntityPacket);
|
session.sendUpstreamPacket(moveEntityPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue