Skip to content

Commit 473b4af

Browse files
authored
Add missing check whether the player is set in client tick emulation 1.21.2->1.21 (#1090)
1 parent b7c8891 commit 473b4af

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_2to1_21/task/PlayerPacketsTickTask.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.viaversion.viabackwards.protocol.v1_21_2to1_21.storage.PlayerStorage;
2323
import com.viaversion.viaversion.api.connection.ProtocolInfo;
2424
import com.viaversion.viaversion.api.connection.UserConnection;
25+
import com.viaversion.viaversion.api.data.entity.EntityTracker;
2526
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
2627
import com.viaversion.viaversion.api.protocol.packet.State;
2728
import com.viaversion.viaversion.protocol.ProtocolRunnable;
@@ -39,13 +40,14 @@ public PlayerPacketsTickTask() {
3940
@Override
4041
public void run(final UserConnection connection) {
4142
final ProtocolInfo protocolInfo = connection.getProtocolInfo();
42-
if (protocolInfo.getClientState() != State.PLAY || protocolInfo.getServerState() != State.PLAY) {
43+
final EntityTracker entityTracker = connection.getEntityTracker(Protocol1_21_2To1_21.class);
44+
if (protocolInfo.getClientState() != State.PLAY || protocolInfo.getServerState() != State.PLAY || !entityTracker.hasClientEntityId()) {
4345
return;
4446
}
4547

4648
final Channel channel = connection.getChannel();
4749
channel.eventLoop().submit(() -> {
48-
if (!channel.isActive() || protocolInfo.getClientState() != State.PLAY || protocolInfo.getServerState() != State.PLAY) {
50+
if (!channel.isActive() || protocolInfo.getClientState() != State.PLAY || protocolInfo.getServerState() != State.PLAY || !entityTracker.hasClientEntityId()) {
4951
return;
5052
}
5153
try {

0 commit comments

Comments
 (0)