Started by
brigantes
on
Topic category: Help with Minecraft modding (Java Edition)
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?
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:
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.
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.