Skip to content

Store blueprint air (or water) as a fill block instead of per block - #3117

Merged
tastybento merged 1 commit into
developfrom
feature/blueprint-fill
Nov 16, 2026
Merged

tastybento merged 1 commit into
developfrom
feature/blueprint-fill

Conversation

@tastybento

@tastybento tastybento commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Copying a blueprint with air stores every air block individually, so a 50×50×50 copy holds ~125k BlueprintBlocks, nearly all minecraft:air. Every loaded blueprint keeps those in memory for the life of the server.

Now, when a blueprint's blocks define every position of their box, the most common plain block is stored once as the blueprint's fill (with fillMin/fillMax box corners) and removed from blocks. On paste, every box position without an explicit block gets the fill. The pasted result is identical.

  • Air or water, automatically. The fill is whichever plain block is most common, so ocean/sink builds get water as the fill with no new command argument.
  • Only full boxes are compacted. A copy without air leaves gaps that mean "leave the world alone", so it can't use a fill. The same goes for air nowater. Those are stored exactly as before; the coverage check handles this, no special-casing.
  • Blocks with state are never the fill (inventory, sign text/glow, spawners, banners, ItemsAdder). The fill keeps the most common biome; blocks in other biomes stay explicit.
  • Attached blocks: their air placeholder in blocks is covered by the fill (or stays explicit if the fill is water).
  • Faster pastes: fill positions where the world already has the fill block (air in a void world) are skipped, when the chunk is loaded. Checks are bounded at 8× paste speed per tick.
  • Copy size fix: xSize/ySize/zSize were one short per axis (box width rather than block count). Only used for the "no bedrock" centre fallback; particles are unaffected.
  • Entity height fix (found while testing, pre-existing): entities were stored by block with no height within it, so a boat floating on water pasted sunk into the water block. configureEntity tried to apply an offset with e.getLocation().add(...), which is a no-op on a copy. Ordinary entities now record their in-block height and spawn at it via BlueprintEntity#getSpawnLocation (@since 3.23.8). Old blueprints have height 0 and paste as before; display and hanging entities are unchanged.

Compatibility

  • Existing blueprints paste exactly as before. No fill field means no fill.
  • Existing full-box blueprints (copied with air) are compacted in memory on load, and written compact on their next save (e.g. /bbox save, icon change).
  • A compact blueprint loaded by an older BentoBox would paste without its air/water fill (unknown fields are ignored). Only old blueprints on new BentoBox needs to be supported, so this is accepted.
  • API is additive: Blueprint#getFill/setFill/getFillMin/setFillMin/getFillMax/setFillMax and BlueprintFill#compact, all @since 3.23.8. getBlocks() Javadoc now notes it doesn't list fill positions.

Tests

  • BlueprintFillTest: compaction picks air or water, the expanded paste equals the original, gaps/already-compact/no-repeats aren't compacted, stateful blocks are never fill, per-biome handling.
  • BlueprintPasterTest: fill + blocks are both pasted; fill already in place is skipped; unloaded chunks are pasted without a block lookup.
  • BlueprintClipboardManagerTest: an old full-air blueprint compacts on load and round-trips through save/load; a gappy blueprint is untouched.
  • BlueprintClipboardTest: an air copy ends compacted with inclusive sizes.

Full suite: 3651 tests, 0 failures. Tested on a 26.3 server with AcidIsland: an air copy over the acid sea compacted with water as the fill.

🤖 Generated with Claude Code

A blueprint copied with air stores every block in its box, nearly all of
them plain air. Now, when a blueprint's blocks define every position of
their box, the most common plain block (air, or water for ocean builds) is
stored once as the blueprint's fill, with the box corners, and removed
from the block map. Pasting places the fill at every box position that has
no explicit block, so the result is identical.

- Compaction only happens when the box is fully defined, so blueprints
  copied without air (where a gap means "leave the world alone"), or with
  air + nowater, are unchanged.
- Blocks with any state (inventory, sign text, spawner, banner, ItemsAdder)
  are never the fill; a fill keeps the most common biome and blocks in
  other biomes stay explicit.
- Existing blueprints paste exactly as before. Full-box ones are compacted
  in memory on load and saved compact on the next save.
- Pasting skips fill blocks the world already has (e.g. air in a void
  world) when the chunk is loaded, bounded per tick.
- Copy sizes now include both corner blocks (were one short per axis).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@tastybento
tastybento merged commit b3de10d into develop Nov 16, 2026
3 checks passed
@tastybento
tastybento deleted the feature/blueprint-fill branch November 16, 2026 01:44
tastybento added a commit that referenced this pull request Nov 16, 2026
- Add `fill`, `fillMin` and `fillMax` (new in 3.23.8, #3117). The Blueprint
  object has additionalProperties: false, so every compact blueprint
  failed validation.
- Gson writes an empty Vector-keyed map as `{}`, not `[]`. The schema only
  accepted arrays, so any blueprint with no attached blocks or no entities
  failed. 23 of the 35 blueprints in the game mode repos and on a test
  server failed the old schema; all 35 pass now. Non-empty objects are
  still rejected.
- Document entity `y` (height in the block, used since 3.23.8) and that
  sizes count both corner blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant