Common Issues For Custom Trees (Guide)

Started by NorthWestTrees on

Topic category: User side tutorials

Common Issues For Custom Trees (Guide)
Tue, 07/11/2023 - 12:27 (edited)

Introduction

One of the most common questions I get is why leaves decay when users make custom trees.

Though there can be a few reasons, I will review the basics in this tutorial.

Trees replace terrain

This can happen when spawning any structure, you can replace air with structure voids to allow other blocks priority where air would be in your structure.

fill 100 64 100 110 70 110 minecraft:structure_void replace minecraft:air

Trees Float

This can happen, it's how Minecraft structures work.

You can use the script that I made for additional generation conditions to help generate trees only if they are on the ground.

The script also offers more realistic tree generation based on terrain steepness.

The download for the script can be found here

And a tutorial for it can be found here

Minecraft:Leaves Tag

If your leaves are not under the tag minecraft:leaves, this will lead to decaying.

Also, make sure you replace your leaves with the same leaves using the fill command to update the persistent variable for your leaves.

fill <from> <to> <block> replace <replace block>

fill 100 64 100 110 70 110 tale_of_biomes:piruff_leaves replace piruff_leaves

  • If the persistent variable is true then leaves will not decay.
  • If the persistent variable is false then leaves will decay.

Example of leaves tag and persistent variable

MinecraftLogs Tag

If your logs are not part of the tag minecraft:logs, this will lead to leaves also decaying. 

Log tags

How Leaves Work

Leaves work by testing how far away the leaves are from the log block, however, there are some underlying conditions for this to be considered connected.

  • Leaves must be in the range of the log block. (6 blocks for Java and 4 blocks for bedrock)
  • Leaves face meaning north, east, south, west, up, or down faces must be connected to a log or a leaf that eventually connects to a log.
  • Using edges of the block does not count towards leaves being connected to logs or leaves that are connected to logs.

It is important to note that all Minecraft trees use this mechanic, if your looking for something that does support edges then you will need to make your own system using procedures.

Example 1

Green is connected to the logs but the red leaves are not.

Example 1

Example 2

Green is connected to the logs but the red leaves are not.

Example 2

Example 3

Any leaves not connected to logs or other leaves are not valid.

Example 3

Example 4

The blue face is connected to the logs, the green face is connected to the block adjacent to the logs, this is a valid placement.

Example 4

Conclusion

When making a tree, keep your design in mind, things like palm trees will be harder to make given the distance of the leaves and the general shape of how palm trees look. Make sure you replace the leaves using the command stated above

Edited by NorthWestTrees on Tue, 07/11/2023 - 12:27