Boss bars should actually be more reliable on dimension switch

This commit is contained in:
Camotoy 2023-05-09 01:41:57 -04:00
parent a0b63abc6e
commit ed21a10101
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
2 changed files with 3 additions and 10 deletions

View file

@ -155,14 +155,6 @@ public class EntityCache {
}
}
/**
* Re-adds all boss bars to the client by re-creating the entities attached to them.
* This seems to fix boss bars showing up on dimension switch, as of Bedrock 1.19.81.
*/
public void addBossBars() {
bossBars.values().forEach(BossBar::addBossBar);
}
public void updateBossBars() {
bossBars.values().forEach(BossBar::updateBossBar);
}

View file

@ -87,6 +87,9 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
// Bounding box must be sent after a player dies and respawns since 1.19.40
entity.updateBoundingBox();
// Needed here since 1.19.81 for dimension switching
session.getEntityCache().updateBossBars();
break;
case START_SWIMMING:
if (!entity.getFlag(EntityFlag.SWIMMING)) {
@ -237,8 +240,6 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
attributesPacket.setRuntimeEntityId(entity.getGeyserId());
attributesPacket.getAttributes().addAll(entity.getAttributes().values());
session.sendUpstreamPacket(attributesPacket);
session.getEntityCache().addBossBars();
break;
case JUMP:
entity.setOnGround(false); // Increase block break time while jumping