Repository navigation
fix: keep the seal when a right-click uses a block instead of reading - #41
Conversation
Right-clicking a barrel, door, lever or other usable block while holding a sealed letter broke the seal even though the book never opened. Break it only when vanilla counts the written book as used, which happens right after the reading screen opens and on no other click. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coderabbitai review |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
✅ Action performedReview finished.
|
Problem
Right-clicking a barrel (or a door, lever or any other usable block) while holding a sealed letter broke its seal. BirdMessenger treated every right-click as reading, but on those clicks vanilla uses the block and the book never opens.
Fix
The seal now breaks on
PlayerStatisticIncrementEventforUSE_ITEM/WRITTEN_BOOK. In Paper 1.21.10,WrittenBookItem#useopens the reading screen and then counts the book as used, and nothing else counts a written book that way. (ItemStack#useOn,hurtEnemyandmineBlockonly count items with weapon or tool components, or a successfuluseOn.) So:usenever runs, so the seal holds. (Before, the old NORMAL-priority interact handler ignored denials.)The handler runs at MONITOR and also handles cancelled counts, because a cancelled count still means the book opened. The hand comes from the inventory: a client only tries the off hand when the main-hand item does nothing, and a written book always opens. Everything after that (character checks, next-tick swap, resolved-flag tolerance) is unchanged.
Testing
mvn verifyon Linux: 259 tests, 0 failures, line-coverage gate met. New tests cover other counts and materials, a main-hand book beating an off-hand letter, and the handler's priority. On Windows, the estate/mail-store tests fail the same way onmain(directory fsync).~/seal-test/test.js):EXPECT=bug): barrel and lever clicks broke the seal (bug reproduced).🤖 Generated with Claude Code