Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-20 06:50:09 +01:00
Boss bar colors now work in Bedrock 1.18!!
Dieser Commit ist enthalten in:
Ursprung
75d1a6364c
Commit
3f296e32a1
@ -42,7 +42,7 @@ public class BossBar {
|
||||
private final long entityId;
|
||||
private Component title;
|
||||
private float health;
|
||||
private final int color;
|
||||
private int color;
|
||||
private final int overlay;
|
||||
private final int darkenSky;
|
||||
|
||||
@ -86,6 +86,16 @@ public class BossBar {
|
||||
session.sendUpstreamPacket(bossEventPacket);
|
||||
}
|
||||
|
||||
public void updateColor(int color) {
|
||||
this.color = color;
|
||||
BossEventPacket bossEventPacket = new BossEventPacket();
|
||||
bossEventPacket.setBossUniqueEntityId(entityId);
|
||||
bossEventPacket.setAction(BossEventPacket.Action.UPDATE_STYLE);
|
||||
bossEventPacket.setColor(color);
|
||||
|
||||
session.sendUpstreamPacket(bossEventPacket);
|
||||
}
|
||||
|
||||
public void removeBossBar() {
|
||||
BossEventPacket bossEventPacket = new BossEventPacket();
|
||||
bossEventPacket.setBossUniqueEntityId(entityId);
|
||||
|
@ -46,6 +46,10 @@ public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslat
|
||||
}
|
||||
// else we were able to log the user in
|
||||
}
|
||||
if (session.isLoggedIn()) {
|
||||
// Sigh
|
||||
session.getEntityCache().updateBossBars();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class JavaBossEventTranslator extends PacketTranslator<ClientboundBossEve
|
||||
switch (packet.getAction()) {
|
||||
case ADD:
|
||||
long entityId = session.getEntityCache().getNextEntityId().incrementAndGet();
|
||||
bossBar = new BossBar(session, entityId, packet.getTitle(), packet.getHealth(), 0, 1, 0);
|
||||
bossBar = new BossBar(session, entityId, packet.getTitle(), packet.getHealth(), packet.getColor().ordinal(), 1, 0);
|
||||
session.getEntityCache().addBossBar(packet.getUuid(), bossBar);
|
||||
break;
|
||||
case UPDATE_TITLE:
|
||||
@ -54,6 +54,8 @@ public class JavaBossEventTranslator extends PacketTranslator<ClientboundBossEve
|
||||
session.getEntityCache().removeBossBar(packet.getUuid());
|
||||
break;
|
||||
case UPDATE_STYLE:
|
||||
if (bossBar != null) bossBar.updateColor(packet.getColor().ordinal());
|
||||
break;
|
||||
case UPDATE_FLAGS:
|
||||
//todo
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren