saplings are allowed to grow trees despite not having free space above #602

Closed
opened 2019-12-01 17:59:04 +01:00 by 40W · 7 comments

saplings will grow to trees even if not enought free space is available above them and where the trunk grows any pre-existing block is replaced with its wood

saplings will grow to trees even if not enought free space is available above them and where the trunk grows any pre-existing block is replaced with its wood
Wuzzy added the
needs research
label 2019-12-09 07:59:45 +01:00

I looked into the code and it appears that the trees are placed as schematics. I looked into the format for schematic and see that there is a bit for each node which means that it will force placement. I assume the reason tree trunks replace blocks is because this bit is set to one for tree trucks.

I see three ways to solve it:

  1. Change the schematic so tree trucks don't replace blocks

This solves the problem where trees remove block in the world. I think that would mean that the tree will grow through blocks instead. I'm not 100% familiar with schamtics though so I dont fully know if this is the case.

  1. Do a check in Lua if the space above the sapling is high enough for the tree to grow and the schematic to fit

I think this would make more sense because then sapling never grows up if it does not have the space. Then I can use sapling for decoration in house again.

  1. Do the entire tree generation in Lua

This might make it possible to generate trees which grow up until it hits a wall.

I don't know how minecraft deals with this.

I looked into the code and it appears that the trees are placed as schematics. I looked into the format for schematic and see that there is a bit for each node which means that it will force placement. I assume the reason tree trunks replace blocks is because this bit is set to one for tree trucks. I see three ways to solve it: 1. Change the schematic so tree trucks don't replace blocks This solves the problem where trees remove block in the world. I think that would mean that the tree will grow through blocks instead. I'm not 100% familiar with schamtics though so I dont fully know if this is the case. 2. Do a check in Lua if the space above the sapling is high enough for the tree to grow and the schematic to fit I think this would make more sense because then sapling never grows up if it does not have the space. Then I can use sapling for decoration in house again. 3. Do the entire tree generation in Lua This might make it possible to generate trees which grow up until it hits a wall. I don't know how minecraft deals with this.

Looks like saplings do not grow at all in Minecraft if there is no space above them

https://minecraft.gamepedia.com/Sapling

  • Oak needs at least 5 spaces above (3×3 column) to grow normally. If a block is present in the growth space (but not directly above the sapling), the tree still grows, but is forced to grow a large variant.

  • Birch needs at least 6 spaces above (3×3 column).

  • Spruce needs at least 7 spaces above (5×5 column) when placing a single sapling.

    • Giant spruce needs at least 14 spaces above (6x6 column) when planted as 4 saplings in a 2×2 square. Also requires the 4x4 area centered on the saplings at the same level to be empty.
  • Jungle needs at least 5 spaces above (3×3 column) when placing a single sapling.

    • Giant jungle needs at least 11 spaces above (6x6 column) when planted as 4 saplings in a 2×2 square. Also requires the 4x4 area centered on the saplings at the same level to be empty.
  • Acacia needs at least 6 spaces above (5×5 column).

  • Dark oak needs at least 7 spaces above (4×4 column) and must be planted as 4 saplings in a 2×2 square.

Maybe these checks can be added to Lua?

Looks like saplings do not grow at all in Minecraft if there is no space above them https://minecraft.gamepedia.com/Sapling > - Oak needs at least 5 spaces above (3×3 column) to grow normally. If a block is present in the growth space (but not directly above the sapling), the tree still grows, but is forced to grow a large variant. > > - Birch needs at least 6 spaces above (3×3 column). > > - Spruce needs at least 7 spaces above (5×5 column) when placing a single sapling. > > - Giant spruce needs at least 14 spaces above (6x6 column) when planted as 4 saplings in a 2×2 square. Also requires the 4x4 area centered on the saplings at the same level to be empty. > > - Jungle needs at least 5 spaces above (3×3 column) when placing a single sapling. > > - Giant jungle needs at least 11 spaces above (6x6 column) when planted as 4 saplings in a 2×2 square. Also requires the 4x4 area centered on the saplings at the same level to be empty. > > - Acacia needs at least 6 spaces above (5×5 column). > > - Dark oak needs at least 7 spaces above (4×4 column) and must be planted as 4 saplings in a 2×2 square. Maybe these checks can be added to Lua?

Do note that Minecraft trees ignore, but will not replace dirt, which is the most common block to expect to cause problems in tree growth. There would need to be an option to only replace certain kinds of blocks (in this case, logs and leaves).

Do note that Minecraft trees ignore, *but will not replace* dirt, which is the most common block to expect to cause problems in tree growth. There would need to be an option to only replace certain kinds of blocks (in this case, logs and leaves).
Wuzzy added
bug
nodes
#P3: elevated
and removed
needs research
labels 2020-05-16 20:22:38 +02:00
Member

Setting elevated priority because this can be used to destroy bedrock.

Setting elevated priority because this can be used to destroy bedrock.
Contributor

I have created a fix for this. It is on this branch:

https://git.minetest.land/ryvnf/MineClone2/src/branch/treecheck

It will check a volume around the tree for blocks which would prevent the tree from growing. The values are not the same as the ones listed in the Minecraft wiki because the trees appear to have different sizes in MineClone 2. I measured the maximum size of each tree and set the values so that tree branches/trunks should not generate outside of the checked volume. The leaves do not overwrite other nodes so it is possible for some leaves to generate outside of the checked volume.

Torches, plants, wood, trees, leaves and dirt do not affect tree growth.

Jungle and spruce saplings in 2x2 formations will grow into normal trees if there is no room for a huge tree. Balloon oak trees have separate checks than normal oaks trees (because they are much larger). If there is no room for a ballon oak tree to grow, but still room for a normal oak tree to grow, a normal oak tree is grown.

I have created a fix for this. It is on this branch: https://git.minetest.land/ryvnf/MineClone2/src/branch/treecheck It will check a volume around the tree for blocks which would prevent the tree from growing. The values are not the same as the ones listed in the Minecraft wiki because the trees appear to have different sizes in MineClone 2. I measured the maximum size of each tree and set the values so that tree branches/trunks should not generate outside of the checked volume. The leaves do not overwrite other nodes so it is possible for some leaves to generate outside of the checked volume. Torches, plants, wood, trees, leaves and dirt do not affect tree growth. Jungle and spruce saplings in 2x2 formations will grow into normal trees if there is no room for a huge tree. Balloon oak trees have separate checks than normal oaks trees (because they are much larger). If there is no room for a ballon oak tree to grow, but still room for a normal oak tree to grow, a normal oak tree is grown.
Wuzzy added the
contribution inside
label 2020-05-23 22:51:30 +02:00
Contributor

I have merged the fix to the master branch.

I have merged the fix to the master branch.
Member

Awesome!

I your commit I noticed some variables and function names that should be local but were declared global. Please, in future make sure to use the keyword local whenever possible, use global variables very sparingly.

Awesome! I your commit I noticed some variables and function names that should be local but were declared global. Please, in future make sure to use the keyword `local` whenever possible, use global variables very sparingly.
ryvnf closed this issue 2020-07-26 19:13:45 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: VoxeLibre/VoxeLibre#602
No description provided.