Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-25 15:50:14 +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 final long entityId;
|
||||||
private Component title;
|
private Component title;
|
||||||
private float health;
|
private float health;
|
||||||
private final int color;
|
private int color;
|
||||||
private final int overlay;
|
private final int overlay;
|
||||||
private final int darkenSky;
|
private final int darkenSky;
|
||||||
|
|
||||||
@ -86,6 +86,16 @@ public class BossBar {
|
|||||||
session.sendUpstreamPacket(bossEventPacket);
|
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() {
|
public void removeBossBar() {
|
||||||
BossEventPacket bossEventPacket = new BossEventPacket();
|
BossEventPacket bossEventPacket = new BossEventPacket();
|
||||||
bossEventPacket.setBossUniqueEntityId(entityId);
|
bossEventPacket.setBossUniqueEntityId(entityId);
|
||||||
|
@ -46,6 +46,10 @@ public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslat
|
|||||||
}
|
}
|
||||||
// else we were able to log the user in
|
// 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()) {
|
switch (packet.getAction()) {
|
||||||
case ADD:
|
case ADD:
|
||||||
long entityId = session.getEntityCache().getNextEntityId().incrementAndGet();
|
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);
|
session.getEntityCache().addBossBar(packet.getUuid(), bossBar);
|
||||||
break;
|
break;
|
||||||
case UPDATE_TITLE:
|
case UPDATE_TITLE:
|
||||||
@ -54,6 +54,8 @@ public class JavaBossEventTranslator extends PacketTranslator<ClientboundBossEve
|
|||||||
session.getEntityCache().removeBossBar(packet.getUuid());
|
session.getEntityCache().removeBossBar(packet.getUuid());
|
||||||
break;
|
break;
|
||||||
case UPDATE_STYLE:
|
case UPDATE_STYLE:
|
||||||
|
if (bossBar != null) bossBar.updateColor(packet.getColor().ordinal());
|
||||||
|
break;
|
||||||
case UPDATE_FLAGS:
|
case UPDATE_FLAGS:
|
||||||
//todo
|
//todo
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren