From c38939f3346fac3ea25f4865714500f046f189bf Mon Sep 17 00:00:00 2001 From: dfsek Date: Fri, 2 Oct 2020 02:56:44 -0700 Subject: [PATCH] Fix tree spawning issue. --- pom.xml | 2 +- .../java/com/dfsek/terra/population/TreePopulator.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 88bc663f4..b658d0486 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,7 @@ org.polydev gaea - 1.10.82 + 1.10.83 org.apache.commons diff --git a/src/main/java/com/dfsek/terra/population/TreePopulator.java b/src/main/java/com/dfsek/terra/population/TreePopulator.java index 0747dd162..2741909c1 100644 --- a/src/main/java/com/dfsek/terra/population/TreePopulator.java +++ b/src/main/java/com/dfsek/terra/population/TreePopulator.java @@ -33,8 +33,12 @@ public class TreePopulator extends GaeaBlockPopulator { int att = 0; for(int i = 0; i < b.getDecorator().getTreeDensity() && att < max; ) { att++; - int y = WorldUtil.getHighestValidSpawnAt(chunk, x, z); - if(y <= 0) continue; + int y = 255; + while(y > 1) { + if(chunk.getBlock(x, y, z).getType().isAir() && chunk.getBlock(x, y-1, z).getType().isSolid()) break; + y--; + } + if(y == 0) continue; origin = chunk.getBlock(x, y, z).getLocation().add(0, 1, 0); b = grid.getBiome(origin, GenerationPhase.POPULATE); try {