fix: send correct block state ID when cancelling interact event (#2405)

The cancelled handler in handle_use_item_on sent block.id (BlockId)
instead of the actual BlockStateId, causing clients to see wrong
block states (e.g. stone appearing as snow) when plugins cancel
PlayerInteractEvent on right-click.
This commit is contained in:
Indrajeeth
2026-07-31 08:48:49 +05:30
committed by GitHub
parent f65b50d50f
commit 4b1479607a

View File

@@ -2282,9 +2282,10 @@ impl JavaClient {
server;
event;
'cancelled: {
let state_id = world.get_block_state_id(&position);
self.enqueue_packet(&CBlockUpdate::new(
position,
VarInt(block.id.as_u16() as i32),
VarInt(i32::from(state_id.as_u16())),
))
.await;
return Ok(());