Change "Ping" packet behavior

Changed "Ping" packet to not create client-local Battle instance when
received, but rather only act if client-local Battle instance exists.

This change was also made on the neoforge branches.
This commit is contained in:
Stephen Seo 2024-10-25 15:46:56 +09:00
parent 4c0872b7ad
commit fde09d116d

View file

@ -46,13 +46,12 @@ public class PacketBattlePing {
@Override @Override
public void accept(PacketBattlePing pkt, CustomPayloadEvent.Context ctx) { public void accept(PacketBattlePing pkt, CustomPayloadEvent.Context 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.setBattleGuiBattleChanged();
TurnBasedMinecraftMod.proxy.setBattleGuiTime(pkt.decisionSeconds);
TurnBasedMinecraftMod.proxy.pauseMCMusic();
} }
TurnBasedMinecraftMod.proxy.setBattleGuiAsGui();
TurnBasedMinecraftMod.proxy.setBattleGuiBattleChanged();
TurnBasedMinecraftMod.proxy.setBattleGuiTime(pkt.decisionSeconds);
TurnBasedMinecraftMod.proxy.pauseMCMusic();
}); });
ctx.setPacketHandled(true); ctx.setPacketHandled(true);
} }