Fix boss bars not showing up on dimension switch

This commit is contained in:
Camotoy 2023-05-07 02:59:44 -04:00
parent 6e9b272f50
commit 0d25a3f04d
2 changed files with 9 additions and 1 deletions

View file

@ -155,6 +155,14 @@ 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

@ -238,7 +238,7 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
attributesPacket.getAttributes().addAll(entity.getAttributes().values());
session.sendUpstreamPacket(attributesPacket);
session.getEntityCache().updateBossBars();
session.getEntityCache().addBossBars();
break;
case JUMP:
entity.setOnGround(false); // Increase block break time while jumping