mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-23 08:38:51 +00:00
improve fabric/forge getHeight impl
This commit is contained in:
@@ -70,7 +70,7 @@ public class TerraWorld {
|
|||||||
double noise = sampler.sample(fdX, y, fdZ);
|
double noise = sampler.sample(fdX, y, fdZ);
|
||||||
if(noise > 0) {
|
if(noise > 0) {
|
||||||
int level = 0;
|
int level = 0;
|
||||||
for(int yi = world.getMaxHeight(); yi > y; yi--) {
|
for(int yi = world.getMaxHeight()-1; yi > y; yi--) {
|
||||||
if(sampler.sample(fdX, yi, fdZ) > 0) level++;
|
if(sampler.sample(fdX, yi, fdZ) > 0) level++;
|
||||||
else level = 0;
|
else level = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements Gener
|
|||||||
public int getHeight(int x, int z, Heightmap.Type heightmapType) {
|
public int getHeight(int x, int z, Heightmap.Type heightmapType) {
|
||||||
TerraWorld world = TerraFabricPlugin.getInstance().getWorld(dimensionType);
|
TerraWorld world = TerraFabricPlugin.getInstance().getWorld(dimensionType);
|
||||||
int height = world.getWorld().getMaxHeight();
|
int height = world.getWorld().getMaxHeight();
|
||||||
while(height >= 0 && !heightmapType.getBlockPredicate().test(((FabricBlockData) world.getUngeneratedBlock(x, height - 1, z)).getHandle())) {
|
while(height >= 0 && !heightmapType.getBlockPredicate().test(((FabricBlockData) world.getUngeneratedBlock(x, height-1, z)).getHandle())) {
|
||||||
height--;
|
height--;
|
||||||
}
|
}
|
||||||
return height;
|
return height;
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ public class ForgeChunkGeneratorWrapper extends ChunkGenerator implements Genera
|
|||||||
public int getBaseHeight(int x, int z, Heightmap.@NotNull Type type) {
|
public int getBaseHeight(int x, int z, Heightmap.@NotNull Type type) {
|
||||||
TerraWorld world = TerraForgePlugin.getInstance().getWorld(dimensionType);
|
TerraWorld world = TerraForgePlugin.getInstance().getWorld(dimensionType);
|
||||||
int height = world.getWorld().getMaxHeight();
|
int height = world.getWorld().getMaxHeight();
|
||||||
while(height >= 0 && !type.isOpaque().test(((ForgeBlockData) world.getUngeneratedBlock(x, height - 1, z)).getHandle())) {
|
while(height >= 0 && !type.isOpaque().test(((ForgeBlockData) world.getUngeneratedBlock(x, height-1, z)).getHandle())) {
|
||||||
height--;
|
height--;
|
||||||
}
|
}
|
||||||
return height;
|
return height;
|
||||||
|
|||||||
Reference in New Issue
Block a user