Minor tweak to "Ping" packet
This commit changes the "Ping" packet to not create a client-side Battle instance if it does not exist when the packet is received.
This commit is contained in:
parent
d1962d0525
commit
367c407ec9
2 changed files with 10 additions and 6 deletions
|
@ -1,5 +1,10 @@
|
||||||
# Upcoming changes
|
# Upcoming changes
|
||||||
|
|
||||||
|
# Version NeoForge-1.26.3-MC-1.21.1
|
||||||
|
|
||||||
|
Tweak to "Ping" packet to not create client-local Battle instance if it does
|
||||||
|
not exist.
|
||||||
|
|
||||||
# Version Forge-1.26.2
|
# Version Forge-1.26.2
|
||||||
|
|
||||||
Show battling Entities next to their attack button in the BattleGUI.
|
Show battling Entities next to their attack button in the BattleGUI.
|
||||||
|
|
|
@ -31,13 +31,12 @@ public record PacketBattlePing(int battleID, int remainingSeconds) implements Cu
|
||||||
@Override
|
@Override
|
||||||
public void handle(final @NotNull PacketBattlePing pkt, IPayloadContext ctx) {
|
public void handle(final @NotNull PacketBattlePing pkt, IPayloadContext ctx) {
|
||||||
ctx.enqueueWork(() -> {
|
ctx.enqueueWork(() -> {
|
||||||
if (TurnBasedMinecraftMod.proxy.getLocalBattle() == null) {
|
if (TurnBasedMinecraftMod.proxy.getLocalBattle() != null) {
|
||||||
TurnBasedMinecraftMod.proxy.createLocalBattle(pkt.battleID);
|
|
||||||
}
|
|
||||||
TurnBasedMinecraftMod.proxy.setBattleGuiAsGui();
|
TurnBasedMinecraftMod.proxy.setBattleGuiAsGui();
|
||||||
TurnBasedMinecraftMod.proxy.setBattleGuiBattleChanged();
|
TurnBasedMinecraftMod.proxy.setBattleGuiBattleChanged();
|
||||||
TurnBasedMinecraftMod.proxy.setBattleGuiTime(pkt.remainingSeconds);
|
TurnBasedMinecraftMod.proxy.setBattleGuiTime(pkt.remainingSeconds);
|
||||||
TurnBasedMinecraftMod.proxy.pauseMCMusic();
|
TurnBasedMinecraftMod.proxy.pauseMCMusic();
|
||||||
|
}
|
||||||
}).exceptionally(e -> {
|
}).exceptionally(e -> {
|
||||||
ctx.disconnect(Component.literal("Exception handling PacketBattlePing! " + e.getMessage()));
|
ctx.disconnect(Component.literal("Exception handling PacketBattlePing! " + e.getMessage()));
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue