Skip to content

Fix breaking rebar blocks doesn't damage the tool#714

Merged
LordIdra merged 2 commits into
masterfrom
balugaq/fix-tool-damage
May 10, 2026
Merged

Fix breaking rebar blocks doesn't damage the tool#714
LordIdra merged 2 commits into
masterfrom
balugaq/fix-tool-damage

Conversation

@balugaq
Copy link
Copy Markdown
Collaborator

@balugaq balugaq commented Apr 25, 2026

No description provided.

@balugaq balugaq self-assigned this Apr 25, 2026
@balugaq balugaq linked an issue Apr 25, 2026 that may be closed by this pull request
@balugaq
Copy link
Copy Markdown
Collaborator Author

balugaq commented Apr 25, 2026

QQ_1777124335619

As the picture shows, when player breaks a block, it calls ServerPlayerGameMode.destoryBlock and callEvent (L352) and the event is handled by BlockListener, goes to BlockStorage.removeBlock, then set the block to air (PlayerBreak
doesn't override shouldSetToAir so returns true by default), causing the failure of the check at ServerPlayerGameMode (L372).
Normally the block is not air, and goes to the else branch, then calls mineBlock (L401) to damage the tool.

So add a override to fix this problem.

*tested

@balugaq balugaq marked this pull request as draft April 25, 2026 13:56
@balugaq balugaq marked this pull request as ready for review April 25, 2026 13:56
@LordIdra LordIdra merged commit 0804d3d into master May 10, 2026
3 checks passed
@LordIdra LordIdra deleted the balugaq/fix-tool-damage branch May 10, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Breaks rebar blocks doesn't damage the tool in hand

2 participants