Improve 1.19.50 flags (#3422)

This commit is contained in:
Konicai 2022-11-29 16:34:09 -05:00 committed by GitHub
parent 49d3254ea9
commit c7e79299b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 16 deletions

View file

@ -355,14 +355,11 @@ public class Entity {
public void setFlags(ByteEntityMetadata entityMetadata) { public void setFlags(ByteEntityMetadata entityMetadata) {
byte xd = entityMetadata.getPrimitiveValue(); byte xd = entityMetadata.getPrimitiveValue();
setFlag(EntityFlag.ON_FIRE, ((xd & 0x01) == 0x01) && !getFlag(EntityFlag.FIRE_IMMUNE)); // Otherwise immune entities sometimes flicker onfire 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.SNEAKING, (xd & 0x02) == 0x02);
setFlag(EntityFlag.SPRINTING, (xd & 0x08) == 0x08); setFlag(EntityFlag.SPRINTING, (xd & 0x08) == 0x08);
// Swimming is ignored here and instead we rely on the pose // Swimming is ignored here and instead we rely on the pose
setFlag(EntityFlag.GLIDING, (xd & 0x80) == 0x80); setFlag(EntityFlag.GLIDING, (xd & 0x80) == 0x80);
}
setInvisible((xd & 0x20) == 0x20); setInvisible((xd & 0x20) == 0x20);
} }

View file

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

View file

@ -1284,12 +1284,8 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
this.pose = Pose.SNEAKING; this.pose = Pose.SNEAKING;
playerEntity.setBoundingBoxHeight(1.5f); 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) { public void setSwimming(boolean swimming) {
if (swimming) { if (swimming) {

View file

@ -5,7 +5,7 @@ netty = "4.1.80.Final"
guava = "29.0-jre" guava = "29.0-jre"
gson = "2.3.1" # Provided by Spigot 1.8.8 gson = "2.3.1" # Provided by Spigot 1.8.8
websocket = "1.5.1" 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" raknet = "1.6.28-20220125.214016-6"
mcauthlib = "d9d773e" mcauthlib = "d9d773e"
mcprotocollib = "9f78bd5" mcprotocollib = "9f78bd5"