Skip to content
This repository was archived by the owner on Jan 17, 2026. It is now read-only.

Commit 226225f

Browse files
fixed sync issues
1 parent 18b8666 commit 226225f

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/main/java/de/florianmichael/vialoadingbase/platform/providers/VLBMovementTransmitterProvider.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* This file is part of ViaLoadingBase - https://github.com/FlorianMichael/ViaLoadingBase
3-
* Copyright (C) 2022-2023 FlorianMichael/EnZaXD and contributors
2+
* This file is part of ViaProtocolHack - https://github.com/RaphiMC/ViaProtocolHack
3+
* Copyright (C) 2023 RK_01/RaphiMC and contributors
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -40,20 +40,19 @@ public Object getGroundPacket() {
4040
@Override
4141
public void sendPlayer(UserConnection userConnection) {
4242
if (userConnection.getProtocolInfo().getState() != State.PLAY) return;
43-
44-
final int playerId = userConnection.getEntityTracker(Protocol1_9To1_8.class).clientEntityId();
45-
if (playerId == -1) return; // Only apply if the player is initialized
43+
if (userConnection.getEntityTracker(Protocol1_9To1_8.class).clientEntityId() == -1) return;
4644

4745
final MovementTracker movementTracker = userConnection.get(MovementTracker.class);
4846
movementTracker.incrementIdlePacket();
49-
50-
final PacketWrapper c03 = PacketWrapper.create(ServerboundPackets1_8.PLAYER_MOVEMENT, userConnection);
51-
c03.write(Type.BOOLEAN, movementTracker.isGround());
52-
53-
try {
54-
c03.scheduleSendToServer(Protocol1_9To1_8.class);
55-
} catch (Exception e) {
56-
e.printStackTrace();
57-
}
47+
final boolean onGround = movementTracker.isGround();
48+
49+
userConnection.getChannel().eventLoop().submit(() -> {
50+
try {
51+
final PacketWrapper playerMovement = PacketWrapper.create(ServerboundPackets1_8.PLAYER_MOVEMENT, userConnection);
52+
playerMovement.write(Type.BOOLEAN, onGround); // on ground
53+
playerMovement.sendToServer(Protocol1_9To1_8.class);
54+
} catch (Throwable ignored) {
55+
}
56+
});
5857
}
5958
}

0 commit comments

Comments
 (0)