Fixed glitch with sending extra movement packet after cleanup

This commit is contained in:
hhhzzzsss 2024-05-31 19:53:28 -05:00
parent 2363900c05
commit 707b5e6f0c
2 changed files with 8 additions and 6 deletions

View file

@ -29,11 +29,13 @@ public class ClientCommonNetworkHandlerMixin {
private void onSendPacket(Packet<?> packet, CallbackInfo ci) { private void onSendPacket(Packet<?> packet, CallbackInfo ci) {
Stage lastStage = SongHandler.getInstance().lastStage; Stage lastStage = SongHandler.getInstance().lastStage;
if (!SongHandler.getInstance().isIdle() && lastStage != null && packet instanceof PlayerMoveC2SPacket) { if (!SongHandler.getInstance().isIdle() && packet instanceof PlayerMoveC2SPacket) {
if (!Config.getConfig().rotate) { if (lastStage != null) {
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 (!Config.getConfig().rotate) {
if (SongPlayer.fakePlayer != null) { 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));
SongPlayer.fakePlayer.copyStagePosAndPlayerLook(); if (SongPlayer.fakePlayer != null) {
SongPlayer.fakePlayer.copyStagePosAndPlayerLook();
}
} }
} }
ci.cancel(); ci.cancel();

View file

@ -862,6 +862,6 @@ public class SongHandler {
} }
public boolean isIdle() { public boolean isIdle() {
return currentSong == null && currentPlaylist == null && songQueue.isEmpty() && !cleaningUp; return currentSong == null && currentPlaylist == null && songQueue.isEmpty() && !cleaningUp && !dirty;
} }
} }