Fix missed chest open callbacks for max-range opens - #14141
Open
entrapy wants to merge 1 commit into
Open
Conversation
Member
|
Why is the whole description of your PR AI generated? Nobody wants to read that |
Contributor
|
Depends on #14084 |
Author
|
sorry, was causing issues on my server with some redstone farms, made an ai summary and rewrote it after. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Simple summary:
Delayed open/close path (introduced by "Delay open/close callbacks for chests") never adopts the opener's interaction range so the first scan is too small and can miss the player who opened the container.
This allows a player from ~4.8-5.5 blocks to open chests and other containers without activating redstone.
Simple explanation:
The code only schedules a recheck, but never does it properly; unlike the immediate path it does not do maxInteractionRange = max(arg, this.maxInteractionRange). The recheck's viewer scan uses AABB(pos).inflate(this.maxInteractionRange + 4.0), which for a fresh counter is only a 4-block box - while the server accepts block interactions from up to blockInteractionRange + 1.0 (5.5 blocks by default).
openCount stays at 0, so onOpen never runs which means the lid doesn't open, and GameEvent.CONTAINER_OPEN never fires which means redstone does not trigger.
recheckOpeners only reschedules itself while openCount > 0, so no further recheck happens - the container stays in this silent state for the entire session, and closing it fires nothing either.
Fix explanation:
The fix was pretty simple, basically a 1 liner. We adopt the passed interaction range in the delayed path matching what the code already does at the end of
incrementOpeners. The first recheck then scans an ~8.5-block box and once it finds the opener it setsopenCount = 1and keeps rescheduling while open. Behavior for normal-range opens is unchanged (the scan predicate still requireshasContainerOpen, and the count is recomputed from live viewers).