Skip to content

Move MenuType API to utilize "real" boolean switch for BlockEntity's - #13439

Open
Y2Kwastaken wants to merge 7 commits into
PaperMC:mainfrom
Y2Kwastaken:lectern-behavior
Open

Y2Kwastaken wants to merge 7 commits into
PaperMC:mainfrom
Y2Kwastaken:lectern-behavior

Conversation

@Y2Kwastaken

@Y2Kwastaken Y2Kwastaken commented Dec 26, 2025 •

Copy link
Copy Markdown
Contributor

This PR changes how we handle fake BlockEntity instances. There is a change in logic by adding a "real" field to BlockEntity we can deterministically tell if the BlockEntities are "real." By this real means that it is in world currently and should have somewhat limited capabilities compared to its in world counterparts.

Previously, fake BlockEntity instances were given the player's world without limitations to get around internal assumptions. While somewhat functional, this caused some nasty unintended side effects around placement state, event broadcasting, and redstone/game events. The goal here is to keep fake block entities truly unplaced, while still allowing safe interaction paths where needed.

The goal here is also not to necessarily sacrifice event functionality as much as possible when it comes to Menus as part of their power is being able to utilize normal Bukkit events where otherwise you would have to delegate to NMS or other hacks.

This is good for review its a bug fix, even on latest it fixes the bug still.

Fixes #13438

@Y2Kwastaken
Y2Kwastaken requested a review from a team as a code owner December 26, 2025 18:36
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Dec 26, 2025
@Y2Kwastaken
Y2Kwastaken force-pushed the lectern-behavior branch 2 times, most recently from a1eec90 to febd434 Compare December 31, 2025 17:45
@Y2Kwastaken Y2Kwastaken changed the title Address Lectern spawning while utilizing MenuType API Move MenuType API to utilize true fake BlockEntity's Dec 31, 2025
@Y2Kwastaken
Y2Kwastaken force-pushed the lectern-behavior branch 3 times, most recently from bb7bfb3 to c65f85e Compare February 4, 2026 18:10
@Y2Kwastaken Y2Kwastaken changed the title Move MenuType API to utilize true fake BlockEntity's Move MenuType API to utilize "real" boolean switch for BlockEntity's Aug 6, 2026
@kennytv

kennytv commented Aug 6, 2026

Copy link
Copy Markdown
Member

Looking at setChanged calls, this causes chunk updates that should be behind the real flag as well

@Doc94 Doc94 self-assigned this Oct 13, 2026
@Doc94

Doc94 commented Oct 14, 2026

Copy link
Copy Markdown
Member

I make a few tests, currently with PlayerTakeLecternBookEvent/PlayerLecternPageChangeEvent if try to get the Lectern i get a NPE, not sure what can be a good solution for this..

Doc94 added 2 commits October 25, 2026 22:13
…/lectern-behavior

# Conflicts:
#	paper-server/patches/features/0017-Delay-close-callbacks-for-chests.patch

@Doc94 Doc94 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with lectern a few blocks (ref: https://pastes.dev/gpMp1Tck3d) this include a "breaking change" for the Lectern events but its what can happen and feel its better rather than try to make a fake block what can cause other issues...

@papermc-projects papermc-projects Bot moved this from Awaiting review to Delayed approval in Paper PR Queue Oct 26, 2026
@papermc-projects papermc-projects Bot moved this from Delayed approval to Full approval in Paper PR Queue Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Full approval

Development

Successfully merging this pull request may close these issues.

Lectern Block Entity appears in the world When utilizing The MenuType API

5 participants