Skip to content

server/block: grow trees from saplings - #1447

Open
schphe wants to merge 1 commit into
df-mc:masterfrom
oriumgames:feat/saplings
Open

server/block: grow trees from saplings#1447
schphe wants to merge 1 commit into
df-mc:masterfrom
oriumgames:feat/saplings

Conversation

@schphe

@schphe schphe commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Oak, birch, jungle, spruce, acacia, dark oak, pale oak, cherry, mega spruce, mega jungle (2x2).

Reverse engineered from BDS 1.26.43.1. Field names match the *_tree_feature.json keys in behavior_packs/vanilla_*/features; geometry and RNG order come from the decompiled placers:

SimpleTreeTrunk::place 0xca69060, SimpleTreeCanopy::place 0xca68650, SpruceTreeCanopy::place 0xca69680, RoofedTreeCanopy::place 0xca67c80, AcaciaTreeTrunk::place 0xcab6f10, AcaciaTreeCanopy::place 0xcab6900, MegaTreeTrunk::place 0xca64a10, MegaTreeCanopy::place 0xca64880, MegaPineTreeCanopy::place 0xca64430, CherryTreeTrunk::place 0xca5c0b0, CherryTreeCanopy::place 0xca5b620.

Matching Bedrock:

  • Volume tested once up front. After that any blocked position is skipped, so a tree that hits something part way up is left half grown.
  • Trunks convert the ground under their whole footprint: podzol for mega spruce, dirt otherwise.
  • Mega spruce spreads a podzol base_cluster; jungle hangs vines off trunk and canopy.

Leaf decay, from LeavesBlock::randomTick 0xbdb3fd0 a 4-pass distance relaxation over a radius-4 cube, seeding logs 0, leaves -2, everything else -1:

  • findLog searched depth first over a shared visited set. A cell reached by a long path was marked and rejected on the depth limit, blocking the short path through it. Leaves decayed with the trunk intact. Now breadth first.
  • Limit was 6 (the Java value); Bedrock runs 4 passes.
  • Stripped logs were excluded and Wood ignored; both count.

@schphe

schphe commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

notice: based on #1238

@THEBOSS9345

Copy link
Copy Markdown
Contributor

I think you should also add an event handler for when a sapling grows, so the event can be cancelled to prevent the growth or allow you to see where the sapling is going to grow.

@TrippleAWap

Copy link
Copy Markdown
Contributor

I think you should also add an event handler for when a sapling grows, so the event can be cancelled to prevent the growth or allow you to see where the sapling is going to grow.

I believe this is the wrong approach, if anything we should introduce a handler for RandomTick.

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