Repository navigation
Reduce server cost of room rebuilds and block updates - #131
Merged
RealAntEngineer merged 4 commits intoOct 19, 2026
Merged
Conversation
onBlockPlaced runs for every block update in every dimension. It now returns early on the client (rooms are server logic and the client receives the shape through entity data), and uses a single entity query around the block instead of up to seven, with an early exit when no room is nearby.
Every block update in or beside a room used to run a full room search immediately on the server thread, so a piston, a door or any machine firing many updates in a row caused many searches in one tick. Updates now only flag the room; the rebuild runs on the room's next tick, at most once every 5 ticks, and a burst collapses into one rebuild. A full rebuild also clears the queued search frontier of the previous, discarded shape.
SynchedEntityData only skips a set() when the new value equals the old one. RoomShape had identity equality, so every rebuild that produced the same room marked the shape dirty and re-sent it to every tracking player. Compare volume, closed flag and boxes.
The search called getBlockState/getBlockEntity on every candidate position, which loads or generates chunks synchronously on the server thread when a room touches the edge of the loaded area. Unloaded positions now count as solid and are skipped.
dhm-msd
marked this pull request as ready for review
October 19, 2026 20:20
RealAntEngineer
merged commit Oct 19, 2026
0cad4fe
into
RealAntEngineer:1.21.1-release
1 check passed
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.
Summary
Four small performance changes (one commit each) for the oxygen room system. None changes what counts as sealed, except for rooms touching unloaded chunks (item 4). The only visible difference is that a rebuild can run up to 5 ticks after the block change.
Changes
CSEventHandler.onBlockPlaced): runs on the logical server only (rooms are server logic and the client gets the shape through entity data), uses one entity query around the block instead of up to seven, and exits early when no room is nearby. It runs for every block update in every dimension, so this matters.RoomShapevalue equality:SynchedEntityDataskips aset()only when the new value equals the old one, andRoomShapehad identity equality, so a rebuild that produced the same room re-sent it to every tracking player.Notes