mojira.dev
MC-258302

Oak branch growth inconsistent in negative y values

Usually you can limit a oak tree to not grow the "fancy oak tree" variation which has branches by placing a block 8 blocks above the sapling

however if the sapling is at -2 or lower it is still capable of growing this variation unless you place the block 7 blocks above the sapling. this inconsitency doesnt make sense and breaks a lot of tree farms if they are build in negative y heights

 i tested this in vanilla minecraft without any mods and included a test setup to reproduce it in the attached world download

Attachments

Comments 1

After some code digging I think I tracked down the line(s) where the issue happens. It's in FancyTrunkPlacer::placeTrunk and looks something like this (local variable names are unknown, so I came up with some guesses):

double branchBaseTemp = branchPos.getY() - Math.sqrt(distX * distX + distZ * distZ) * 0.381;
int branchBase = branchBaseTemp > branchCutoff ? branchCutoff : branchBaseTemp;

Here (int)branchBaseTemp rounds towards 0, which leads to branches generating 2 blocks above the sapling, instead of 3, so they are not prevented by the height limiter.

If you move the height limiter of the "positive" setup up one block you can see the difference:

[media]

theGlotzerify

(Unassigned)

Community Consensus

Platform

Normal

World generation

1.19.2

Retrieved