Custom Tree Structures taking over each other

Started by brigantes on

Topic category: Help with modding (Java Edition)

Last seen on 19:23, 15. Apr 2024
Joined Sep 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Custom Tree Structures taking over each other

I’m creating a mod themed around trees and I’m stuck creating the first forest biome which has 3 different tree types in it. I’ve tweaked it so that the trees will spawn properly on the ground however I still find that some spawn in directly next to another and the leaves replace logs of the other tree. This happens when they grow as saplings too.

Is there any way I can at least stop them from replacing the logs of other trees or spawning a block parallel from each other?

Last seen on 20:08, 17. Apr 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, and I've had an unholy…
Tue, 09/19/2023 - 22:24

Yes, and I've had an unholy amount of experience with this particular issue. You'll need to make a specific generation condition for your trees, which specifies something along these lines:

  • There shouldn't be water above the selected location.
  • At least some of the surrounding blocks should be solid.
  • There should be air adjacent to/around the trunk. (You could also check for sky access to prevent tree canopies from colliding, but leaves don't count as solid blocks, so air is generally better.) 

Make a procedure that returns true if your desired conditions are met, and false otherwise. The more specific you make your condition, the better it should work, but the higher you'll have to turn up the generation chance to get a decent amount of trees. Generation conditions can also have lots of unintended consequences- if you make something require a lot of flat terrain, for example, you won't get a decent amount on hills. 

I recommend using the 'check for block in 6*6*6 box' procedure template, which you can also configure to just check the world-surface, (remove the y component), if you're doing something like trees, as this is much less performance intensive.

 

Last seen on 19:23, 15. Apr 2024
Joined Sep 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have some procedures set…
Thu, 09/21/2023 - 12:48

I have some procedures set in place already for it to detect the area around it before letting the structure spawn, I'll include a screenshot of what I'm using below. This also helps with stopping them from floating. They don't spawn in or over water as I've set the generation to match that of a vanilla forest.

https://imgur.com/vhyPDTT - This is my procedure I use, I've taken a bit from A YT tutorial about trees, albeit an outdated one. The bit at the bottom was supposed to stop the structure from hovering over plant blocks but it doesn't really work.

If there is a simpler way/an example about doing this then help would be much appreciated.