Average depth getter
This commit is contained in:
parent
e4d534d1c6
commit
5460ccba2b
1 changed files with 16 additions and 15 deletions
|
@ -11,7 +11,9 @@ import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.level.biome.BiomeSource;
|
import net.minecraft.world.level.biome.BiomeSource;
|
||||||
|
import ru.bclib.api.biomes.BiomeAPI;
|
||||||
import ru.bclib.util.MHelper;
|
import ru.bclib.util.MHelper;
|
||||||
|
import ru.bclib.world.biomes.BCLBiome;
|
||||||
import ru.betterend.noise.OpenSimplexNoise;
|
import ru.betterend.noise.OpenSimplexNoise;
|
||||||
|
|
||||||
public class TerrainGenerator {
|
public class TerrainGenerator {
|
||||||
|
@ -83,23 +85,22 @@ public class TerrainGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float getAverageDepth(BiomeSource biomeSource, int x, int z) {
|
private static float getAverageDepth(BiomeSource biomeSource, int x, int z) {
|
||||||
//TODO: 1.18 find alternative
|
if (getBiome(biomeSource, x, z).getTerrainHeight() < 0.1F) {
|
||||||
// if (getBiome(biomeSource, x, z).getDepth() < 0.1F) {
|
return 0F;
|
||||||
// return 0F;
|
}
|
||||||
// }
|
float depth = 0F;
|
||||||
// float depth = 0F;
|
for (int i = 0; i < OFFS.length; i++) {
|
||||||
// for (int i = 0; i < OFFS.length; i++) {
|
int px = x + OFFS[i].x;
|
||||||
// int px = x + OFFS[i].x;
|
int pz = z + OFFS[i].y;
|
||||||
// int pz = z + OFFS[i].y;
|
depth += getBiome(biomeSource, px, pz).getTerrainHeight() * COEF[i];
|
||||||
// depth += getBiome(biomeSource, px, pz).getDepth() * COEF[i];
|
}
|
||||||
// }
|
return depth;
|
||||||
// return depth;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private static Biome getBiome(BiomeSource biomeSource, int x, int z) {
|
private static BCLBiome getBiome(BiomeSource biomeSource, int x, int z) {
|
||||||
// return biomeSource.getNoiseBiome(x, 0, z);
|
// TODO replace null sampler
|
||||||
// }
|
return BiomeAPI.getBiome(biomeSource.getNoiseBiome(x, 0, z, null));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if this is land
|
* Check if this is land
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue