From 707b5e6f0c4251f419d66b4c6c75018c6cc50b83 Mon Sep 17 00:00:00 2001 From: hhhzzzsss Date: Fri, 31 May 2024 19:53:28 -0500 Subject: [PATCH] Fixed glitch with sending extra movement packet after cleanup --- .../mixin/ClientCommonNetworkHandlerMixin.java | 12 +++++++----- .../hhhzzzsss/songplayer/playing/SongHandler.java | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/mixin/ClientCommonNetworkHandlerMixin.java b/src/main/java/com/github/hhhzzzsss/songplayer/mixin/ClientCommonNetworkHandlerMixin.java index 1201372..a2bb466 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/mixin/ClientCommonNetworkHandlerMixin.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/mixin/ClientCommonNetworkHandlerMixin.java @@ -29,11 +29,13 @@ public class ClientCommonNetworkHandlerMixin { private void onSendPacket(Packet packet, CallbackInfo ci) { Stage lastStage = SongHandler.getInstance().lastStage; - if (!SongHandler.getInstance().isIdle() && lastStage != null && packet instanceof PlayerMoveC2SPacket) { - if (!Config.getConfig().rotate) { - connection.send(new PlayerMoveC2SPacket.Full(lastStage.position.getX() + 0.5, lastStage.position.getY(), lastStage.position.getZ() + 0.5, SongPlayer.MC.player.getYaw(), SongPlayer.MC.player.getPitch(), true)); - if (SongPlayer.fakePlayer != null) { - SongPlayer.fakePlayer.copyStagePosAndPlayerLook(); + if (!SongHandler.getInstance().isIdle() && packet instanceof PlayerMoveC2SPacket) { + if (lastStage != null) { + if (!Config.getConfig().rotate) { + connection.send(new PlayerMoveC2SPacket.Full(lastStage.position.getX() + 0.5, lastStage.position.getY(), lastStage.position.getZ() + 0.5, SongPlayer.MC.player.getYaw(), SongPlayer.MC.player.getPitch(), true)); + if (SongPlayer.fakePlayer != null) { + SongPlayer.fakePlayer.copyStagePosAndPlayerLook(); + } } } ci.cancel(); diff --git a/src/main/java/com/github/hhhzzzsss/songplayer/playing/SongHandler.java b/src/main/java/com/github/hhhzzzsss/songplayer/playing/SongHandler.java index a4a1278..29fd86e 100644 --- a/src/main/java/com/github/hhhzzzsss/songplayer/playing/SongHandler.java +++ b/src/main/java/com/github/hhhzzzsss/songplayer/playing/SongHandler.java @@ -862,6 +862,6 @@ public class SongHandler { } public boolean isIdle() { - return currentSong == null && currentPlaylist == null && songQueue.isEmpty() && !cleaningUp; + return currentSong == null && currentPlaylist == null && songQueue.isEmpty() && !cleaningUp && !dirty; } } \ No newline at end of file