Skip to content

Add recycling containers (and ability to add entities during world generation)#675

Merged
louis-e merged 22 commits intolouis-e:mainfrom
wielandb:entities
Jan 27, 2026
Merged

Add recycling containers (and ability to add entities during world generation)#675
louis-e merged 22 commits intolouis-e:mainfrom
wielandb:entities

Conversation

@wielandb
Copy link
Contributor

@wielandb wielandb commented Dec 13, 2025

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:
2025-12-15_17 36 17

And this is what e.g. a recycling container for glass bottles looks like:
2025-12-15_17 36 23

@wielandb wielandb changed the title Add ability to add entities during world generation Add recycling containers (and ability to add entities during world generation) Dec 15, 2025
@wielandb wielandb marked this pull request as ready for review December 15, 2025 16:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 WorldEditor helpers 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=recycling nodes: 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:orientation handling 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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@louis-e
Copy link
Owner

louis-e commented Jan 27, 2026

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!

@louis-e
Copy link
Owner

louis-e commented Jan 27, 2026

retrigger-benchmark

@github-actions
Copy link

⏱️ Benchmark run finished in 0m 24s
🧠 Peak memory usage: 941 MB

📈 Compared against baseline: 30s
🧮 Delta: -6s
🔢 Commit: f473e98

✅ This PR improves generation time.

📅 Last benchmark: 2026-01-27 17:23:04 UTC

You can retrigger the benchmark by commenting retrigger-benchmark.

@louis-e louis-e merged commit f1dc3b8 into louis-e:main Jan 27, 2026
8 checks passed
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.

3 participants