Add recycling containers (and ability to add entities during world generation)#675
Add recycling containers (and ability to add entities during world generation)#675louis-e merged 22 commits intolouis-e:mainfrom
Conversation
[to modified] Change what trees are generated based on tag content
Replaces map_or with is_some_and for abandoned tag check in generate_buildings for clarity. Also updates a doc comment to a regular comment in buildings_interior.rs for consistency.
[to modified] Buildings enhancements
There was a problem hiding this comment.
Pull request overview
This PR extends the world generation pipeline to support placing entities and block entities (with items) during generation, and uses that to add realistic recycling containers, along with several improvements to vegetation and building generation (including abandoned interiors and roof orientation control).
Changes:
- Add
WorldEditorhelpers for placing entities, chests, and generic block entities with items, using deterministic UUIDs, and ensure Java and Bedrock chunk writers correctly merge and persist both block entities and entities. - Generate recycling containers for
amenity=recyclingnodes: place barrels with loot driven by OSM recycling tags and, when appropriate, an item frame showing the accepted item category. - Improve environment and building generation: derive tree species from OSM tags, vary forest/landuse tree types accordingly, support abandoned-building interiors and lighting behavior, and add
roof:orientationhandling for more controllable roofs, along with new supporting block definitions and Bedrock mappings.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/world_editor/mod.rs | Adds entity and block-entity (with items) placement helpers, including deterministic UUIDs, for use by higher-level generators like amenities. |
| src/world_editor/java.rs | Updates Java chunk saving to merge both block_entities and entities compound lists by coordinate and to include chunk.other (including entities) into the Level wrapper. |
| src/world_editor/bedrock.rs | Extends the Bedrock writer to write Data3D as before and then separately write deduplicated block_entities and entities records into LevelDB using raw rusty-leveldb and custom key construction. |
| src/gui/js/maps/wkt.parser.js | Cleans up a merge conflict artifact in the merge method documentation, leaving a coherent description of polygon merging behavior. |
| src/element_processing/tree.rs | Introduces a TreeType enum and Tree::create_of_type, while keeping Tree::create as a deterministic wrapper, enabling callers to explicitly choose tree species. |
| src/element_processing/subprocessor/buildings_interior.rs | Adds abandoned-building interior layouts and extends the interior character-to-block mapping with cobwebs, oriented chiseled bookshelves, damaged anvils, and scaffolding; interiors now select abandoned vs normal patterns based on a flag. |
| src/element_processing/natural.rs | Enhances natural feature generation to choose tree species based on OSM tags (species, genus:wikidata, genus, leaf_type) for both single natural=tree nodes and wooded areas, and uses Tree::create_of_type where appropriate. |
| src/element_processing/landuse.rs | Similarly refines landuse-based forest generation to bias tree species from leaf_type, using TreeType and Tree::create_of_type when placing trees in landuse=forest and related areas. |
| src/element_processing/buildings.rs | Fixes building height calculation to use level offset (lev) correctly, detects abandoned buildings from tags, swaps glowstone for cobwebs as “lights” in those, passes the abandoned flag into interior generation, and adds roof:orientation support to control ridge direction. |
| src/element_processing/amenities.rs | Adds generation of recycling containers for amenity=recycling + recycling_type=container, building loot pools from recycling:* tags, filling barrel inventories, and optionally placing an item frame on a nearby side with a representative item. |
| src/block_definitions.rs | Introduces new block IDs and constants for barrels, cobwebs, oriented chiseled bookshelves, and chipped/damaged anvils, and wires their Java block names and default properties (for bookshelf facings). |
| src/bedrock_block_map.rs | Adds Bedrock conversion logic for barrels, mapping Java facing to Bedrock’s facing_direction and initializing an open_bit state alongside existing per-block conversion logic. |
| Cargo.toml | Extends the bedrock feature to include the new rusty-leveldb dependency needed for direct LevelDB writes of entities and block entities. |
| Cargo.lock | Updates lockfile to include rusty-leveldb among the project dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi there, sorry - I somehow didn't see this PR. Looks good to me, and I made a few tiny changes to address the Copilot code review. Thanks a lot for your effort, looks good in Minecraft! |
|
retrigger-benchmark |
|
⏱️ Benchmark run finished in 0m 24s 📈 Compared against baseline: 30s ✅ This PR improves generation time. 📅 Last benchmark: 2026-01-27 17:23:04 UTC You can retrigger the benchmark by commenting |
This PR adds the possibility to set entities during world generation and uses this ability to generate recycling containers.
Any recycling container where only one thing can be thrown away will show the item on an item frame:

And this is what e.g. a recycling container for glass bottles looks like:
