Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark Oak doesn't always start growing #68

Open
Langly- opened this issue Jan 25, 2016 · 9 comments
Open

Dark Oak doesn't always start growing #68

Langly- opened this issue Jan 25, 2016 · 9 comments
Labels

Comments

@Langly-
Copy link

Langly- commented Jan 25, 2016

Dark oak can sit and never grow until refreshed with a stick, it's timer will show it never started. It seems if the northwest sapling isn't the last planted it will never grow unless hand updated. The Northwest sapling seems to be the control sapling. The other 2x2 trees can still grow in 1x1 form, dark oak can not. I think it might not be starting because a single sapling on it's own is considered ungrowable. Once the 2x2 is formed it becomes growable, but if the northwest sapling wasn't the last it doesn't update from not being growable, as long as it is the last sapling it always works, sometimes it works if just the north or west side is done last, but not that corner. More testing is needed to peg it exactly, but it's being quite odd.

@WildWeazel
Copy link

I'm not sure if 2x2 trees were ever persisted correctly. It's probably checking, when each sapling is planted/updated, whether that one is a valid NW corner before storing it.

@WildWeazel WildWeazel added the bug label Jan 25, 2016
@WildWeazel
Copy link

Yeah, this seems to be the culprit: https://github.com/Civcraft/RealisticBiomes/blob/master/src/com/untamedears/realisticbiomes/utils/Trees.java#L120
It should check the 3 other blocks for each of 4 possible arrangements.

E && SE && S
OR
W && SW && S
OR
N && NE && E
OR
W && NW && W

and then add the NW-most of the four, if they match.

@ProgrammerDan
Copy link

safer test would be:

Scan diagonals NE,NW,SW,SE for sapling of same type. If found, check for "inbetween" along the diagonal path:

  • NE found: check N and E
  • NW found: check N and W
  • SE found: check S and E
  • SW found: check S and W

and done.

@benjajaja
Copy link

@Langly- is right, the northwestern sapling is the "root" for giant trees as in vanilla: http://minecraft.gamepedia.com/Tree

So the logic of RB is built on that assumption, which means that Trees.canGrowLArge should not be changed. The problem is that a NW sapling get added to the list (and db) with the growth rate at the time of placement - so if the rest of the 2x2 array isn't present, it gets added with the growth of a single sapling. When the rest of the sapplings are added, the existing NW will not be updated. The scenario described supports this.

The minimal approach would be to check, in BlockPlaceEvent, if a sapling being placed completes a 2x2 array, then update the NWmost sapling of that array.

@benjajaja
Copy link

BTW, reloading a chunk should also have the same effect as clicking the NW sapling with a stick, currently.

@ProgrammerDan
Copy link

Thanks for the expert knowledge dump. Worth noting that the algorithm I framed would be also be optimal for any check injected in BlockPlaceEvent. It has worst-case 7 tests, best case 3. (edit: corrected best case time)

@Langly-
Copy link
Author

Langly- commented Jan 25, 2016

"BTW, reloading a chunk should also have the same effect as clicking the NW sapling with a stick, currently."

That has been working IF the clock was already running, it updates the clock, but it doesn't seem to actually start it if it thought it couldn't run.

I found many Dan had planted the night before, and even when I loaded them the timer still wasn't running on them.

@benjajaja
Copy link

Yes, now that you say it, the sapling will probably never get added to the list (and db) if the growth rate was zero. It might get re-checked for 2x2 growth times, but only if there was any chance for the sapling to grow as a simple tree, which is not the case for dark oak.

@benjajaja
Copy link

@ProgrammerDan your algo would be great for testing if a newly planted sappling completes a 2x2 array, that is true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants