Skip to content

Commit

Permalink
Handle play packets on main thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 committed Jan 21, 2024
1 parent 8f1d721 commit ac73fbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public void onServerReady() {

@Override
protected void receive(ClientPlayNetworking.PlayPacketHandler<?> handler, CustomPayload payload) {
((ClientPlayNetworking.PlayPacketHandler) handler).receive(payload, this.client.player, this);
this.client.execute(() -> {
((ClientPlayNetworking.PlayPacketHandler) handler).receive(payload, client.player, ClientPlayNetworkAddon.this);
});
}

// impl details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ public void onClientReady() {
}

@Override
protected void receive(ServerPlayNetworking.PlayPayloadHandler<?> handler, CustomPayload payload) {
// TODO 1.20.5 fix me
((ServerPlayNetworking.PlayPayloadHandler) handler).receive(payload, this.handler.player, this);
protected void receive(ServerPlayNetworking.PlayPayloadHandler<?> payloadHandler, CustomPayload payload) {
this.server.execute(() -> {
((ServerPlayNetworking.PlayPayloadHandler) payloadHandler).receive(payload, ServerPlayNetworkAddon.this.handler.player, ServerPlayNetworkAddon.this);
});
}

// impl details
Expand Down

0 comments on commit ac73fbc

Please sign in to comment.