fix tree determinism issues

This commit is contained in:
dfsek 2021-01-14 20:48:07 -07:00
parent 764344b4ef
commit 87f7af1e1b
2 changed files with 6 additions and 2 deletions

View File

@ -24,7 +24,7 @@ public class TreeLayer extends PlaceableLayer<Tree> {
for(int ignored : level) { for(int ignored : level) {
current = current.getRelative(BlockFace.DOWN); current = current.getRelative(BlockFace.DOWN);
if(item.getSpawnable().contains(current.getType())) { if(item.getSpawnable().contains(current.getType())) {
item.plant(current.getLocation().add(0, 1, 0), PopulationUtil.getRandom(chunk)); item.plant(current.getLocation().add(0, 1, 0), PopulationUtil.getRandom(chunk, coords.hashCode()));
} }
} }
} }

View File

@ -6,6 +6,10 @@ import com.dfsek.terra.api.util.FastRandom;
public final class PopulationUtil { public final class PopulationUtil {
public static FastRandom getRandom(Chunk c) { public static FastRandom getRandom(Chunk c) {
return new FastRandom(MathUtil.getCarverChunkSeed(c.getX(), c.getZ(), c.getWorld().getSeed())); return getRandom(c, 0);
}
public static FastRandom getRandom(Chunk c, long salt) {
return new FastRandom(MathUtil.getCarverChunkSeed(c.getX(), c.getZ(), c.getWorld().getSeed() + salt));
} }
} }