This commit is contained in:
Camotoy 2022-11-29 23:49:27 -05:00
commit 5fd041db4e
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
4 changed files with 7 additions and 16 deletions

View file

@ -355,14 +355,11 @@ public class Entity {
public void setFlags(ByteEntityMetadata entityMetadata) {
byte xd = entityMetadata.getPrimitiveValue();
setFlag(EntityFlag.ON_FIRE, ((xd & 0x01) == 0x01) && !getFlag(EntityFlag.FIRE_IMMUNE)); // Otherwise immune entities sometimes flicker onfire
// As of 1.19.50, the client does not want the sprinting, sneaking or gliding set on itself
if (!GameProtocol.supports1_19_50(session) || !(this instanceof SessionPlayerEntity)) {
setFlag(EntityFlag.SNEAKING, (xd & 0x02) == 0x02);
setFlag(EntityFlag.SPRINTING, (xd & 0x08) == 0x08);
setFlag(EntityFlag.SNEAKING, (xd & 0x02) == 0x02);
setFlag(EntityFlag.SPRINTING, (xd & 0x08) == 0x08);
// Swimming is ignored here and instead we rely on the pose
setFlag(EntityFlag.GLIDING, (xd & 0x80) == 0x80);
}
// Swimming is ignored here and instead we rely on the pose
setFlag(EntityFlag.GLIDING, (xd & 0x80) == 0x80);
setInvisible((xd & 0x20) == 0x20);
}

View file

@ -116,9 +116,7 @@ public class SessionPlayerEntity extends PlayerEntity {
@Override
public void setFlags(ByteEntityMetadata entityMetadata) {
super.setFlags(entityMetadata);
byte flags = entityMetadata.getPrimitiveValue();
session.setSwimmingInWater((flags & 0x10) == 0x10 && (flags & 0x08) == 0x08);
session.setSwimmingInWater((entityMetadata.getPrimitiveValue() & 0x10) == 0x10 && getFlag(EntityFlag.SPRINTING));
refreshSpeed = true;
}

View file

@ -1284,11 +1284,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
this.pose = Pose.SNEAKING;
playerEntity.setBoundingBoxHeight(1.5f);
}
// As of 1.19.50, the client does not want sneaking set on itself
if (!GameProtocol.supports1_19_50(this)) {
playerEntity.setFlag(EntityFlag.SNEAKING, sneaking);
}
playerEntity.setFlag(EntityFlag.SNEAKING, sneaking);
}
public void setSwimming(boolean swimming) {