Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Entity data is discarded when canceling BreakEvent #808

Closed
Shadows-of-Fire opened this issue Apr 16, 2024 · 0 comments · Fixed by #809
Closed

Block Entity data is discarded when canceling BreakEvent #808

Shadows-of-Fire opened this issue Apr 16, 2024 · 0 comments · Fixed by #809
Labels
1.20 Targeted at Minecraft 1.20 1.21 Targeted at Minecraft 1.21 bug A bug or error

Comments

@Shadows-of-Fire
Copy link
Contributor

Shadows-of-Fire commented Apr 16, 2024

When breaking a block, the client will start a prediction about the break process via MultiPlayerGameMode#startPrediction, and immediately trigger the break on the client.

While the prediction is "active", changes to the block sent by the server via ClientboundBlockUpdatePacket will not be commited into the world, instead being delayed until a ClientboundBlockChangedAckPacket is sent (which will happen next tick). This process allows the client to reset the player's position if they moved into an illegally-broken block.

Since the block change is not committed into the world, other packets that rely on the block change being committed (such as ClientboundBlockEntityDataPacket) will be discarded, meaning that when a block is broken on the client but denied by the server, the BE data is lost from the client.

This is also a vanilla bug - if you place a sign in a spawn chunk (while spawn protection is active, which requires at least one op) and break it, the sign text will go blank.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.20 Targeted at Minecraft 1.20 1.21 Targeted at Minecraft 1.21 bug A bug or error
Projects
None yet
1 participant