Fix bounding box for 1.19.40 after death + respawn (#3374)

Co-authored-by: onebeastchris <105284508+onebeastchris@users.noreply.github.com>
This commit is contained in:
Konicai 2022-10-29 20:08:41 -04:00 committed by GitHub
parent 0d3b77e567
commit cc82f4b871
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -120,6 +120,16 @@ public class SessionPlayerEntity extends PlayerEntity {
refreshSpeed = true; refreshSpeed = true;
} }
/**
* Since 1.19.40, the client must be re-informed of its bounding box on respawn
* See https://github.com/GeyserMC/Geyser/issues/3370
*/
public void updateBoundingBox() {
dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, getBoundingBoxHeight());
dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, getBoundingBoxWidth());
updateBedrockMetadata();
}
@Override @Override
public boolean setBoundingBoxHeight(float height) { public boolean setBoundingBoxHeight(float height) {
if (super.setBoundingBoxHeight(height)) { if (super.setBoundingBoxHeight(height)) {

View file

@ -75,6 +75,9 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
attributesPacket.setRuntimeEntityId(entity.getGeyserId()); attributesPacket.setRuntimeEntityId(entity.getGeyserId());
attributesPacket.getAttributes().addAll(entity.getAttributes().values()); attributesPacket.getAttributes().addAll(entity.getAttributes().values());
session.sendUpstreamPacket(attributesPacket); session.sendUpstreamPacket(attributesPacket);
// Bounding box must be sent after a player dies and respawns since 1.19.40
entity.updateBoundingBox();
break; break;
case START_SWIMMING: case START_SWIMMING:
if (!entity.getFlag(EntityFlag.SWIMMING)) { if (!entity.getFlag(EntityFlag.SWIMMING)) {