From c7e79299b698e9d4e89f508ee70667921d47792b Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Tue, 29 Nov 2022 16:34:09 -0500 Subject: [PATCH] Improve 1.19.50 flags (#3422) --- .../java/org/geysermc/geyser/entity/type/Entity.java | 11 ++++------- .../entity/type/player/SessionPlayerEntity.java | 4 +--- .../org/geysermc/geyser/session/GeyserSession.java | 6 +----- gradle/libs.versions.toml | 2 +- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java index fff15a494..663dd3c33 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java @@ -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); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java index be1eca2c3..74b95b73c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java @@ -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; } diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index 0d4eee1dd..17a609fb7 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -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) { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 01b7179f3..5218c3e8a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ netty = "4.1.80.Final" guava = "29.0-jre" gson = "2.3.1" # Provided by Spigot 1.8.8 websocket = "1.5.1" -protocol = "2.9.15-20221129.032348-1" +protocol = "2.9.15-20221129.204554-2" raknet = "1.6.28-20220125.214016-6" mcauthlib = "d9d773e" mcprotocollib = "9f78bd5"