Lakes changes
This commit is contained in:
parent
6e71d8785e
commit
25c798b27d
4 changed files with 53 additions and 31 deletions
|
@ -33,7 +33,7 @@ public class EndStructures {
|
|||
public static final StructurePieceType NBT_PIECE = register("nbt_piece", NBTPiece::new);
|
||||
|
||||
public static final EndStructureFeature GIANT_MOSSY_GLOWSHROOM = new EndStructureFeature("giant_mossy_glowshroom", new StructureGiantMossyGlowshroom(), Feature.SURFACE_STRUCTURES, 16, 8);
|
||||
public static final EndStructureFeature MEGALAKE = new EndStructureFeature("megalake", new StructureMegaLake(), Feature.RAW_GENERATION, 4, 1);
|
||||
public static final EndStructureFeature MEGALAKE = new EndStructureFeature("megalake", new StructureMegaLake(), Feature.RAW_GENERATION, 8, 2);
|
||||
public static final EndStructureFeature MOUNTAIN = new EndStructureFeature("mountain", new StructureMountain(), Feature.RAW_GENERATION, 3, 2);
|
||||
public static final EndStructureFeature PAINTED_MOUNTAIN = new EndStructureFeature("painted_mountain", new StructurePaintedMountain(), Feature.RAW_GENERATION, 3, 2);
|
||||
public static final EndStructureFeature ETERNAL_PORTAL = new EndStructureFeature("eternal_portal", new StructureEternalPortal(), Feature.SURFACE_STRUCTURES, 16, 6);
|
||||
|
|
|
@ -22,7 +22,7 @@ public abstract class StructureFeatureBase extends StructureFeature<DefaultFeatu
|
|||
}
|
||||
|
||||
protected boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long worldSeed, ChunkRandom chunkRandom, int chunkX, int chunkZ, Biome biome, ChunkPos chunkPos, DefaultFeatureConfig featureConfig) {
|
||||
return getGenerationHeight(chunkX, chunkZ, chunkGenerator) >= 50;
|
||||
return getGenerationHeight(chunkX, chunkZ, chunkGenerator) >= 20;
|
||||
}
|
||||
|
||||
private static int getGenerationHeight(int chunkX, int chunkZ, ChunkGenerator chunkGenerator) {
|
||||
|
|
|
@ -30,8 +30,8 @@ public class StructureMegaLake extends StructureFeatureBase {
|
|||
int z = (chunkZ << 4) | MHelper.randRange(4, 12, random);
|
||||
int y = chunkGenerator.getHeight(x, z, Type.WORLD_SURFACE_WG);
|
||||
if (y > 5) {
|
||||
float radius = MHelper.randRange(50, 100, random);
|
||||
float depth = MHelper.randRange(10, 16, random);
|
||||
float radius = MHelper.randRange(50, 150, random);
|
||||
float depth = MHelper.randRange(6, 10, random);
|
||||
LakePiece piece = new LakePiece(new BlockPos(x, y - 3, z), radius, depth, random, biome);
|
||||
this.children.add(piece);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class LakePiece extends BasePiece {
|
|||
dist = 1 - dist / r2;
|
||||
int maxY = map.get(x, z);
|
||||
if (MathHelper.abs(maxY - center.getY()) < 8) {
|
||||
float minY = dist * depth * getHeightClamp(world, 8, px, pz);
|
||||
float minY = (float) Math.sqrt(dist) * depth * getHeightClamp(world, 8, px, pz);
|
||||
if (minY > 0) {
|
||||
minY *= (float) noise1.eval(px * 0.05, pz * 0.05) * 0.3F + 0.7F;
|
||||
minY *= (float) noise1.eval(px * 0.1, pz * 0.1) * 0.1F + 0.8F;
|
||||
|
@ -121,33 +121,35 @@ public class LakePiece extends BasePiece {
|
|||
pos.setY(maxY ++);
|
||||
}
|
||||
|
||||
if (maxY <= center.getY() + 1) {
|
||||
maxY = MathHelper.clamp(maxY + 4, 0, center.getY());
|
||||
BlockState surf = random.nextBoolean() ? EndBlocks.ENDSTONE_DUST.getDefaultState() : world.getBiome(pos.add(sx, 0, sz)).getGenerationSettings().getSurfaceConfig().getTopMaterial();
|
||||
BlockState under = world.getBiome(pos.add(sx, 0, sz)).getGenerationSettings().getSurfaceConfig().getUnderMaterial();
|
||||
for (int y = maxY; y >= minY; y--) {
|
||||
pos.setY(y);
|
||||
BlockState state = chunk.getBlockState(pos);
|
||||
if (state.getMaterial().isReplaceable() || state.isIn(EndTags.GEN_TERRAIN)) {
|
||||
chunk.setBlockState(pos, y > center.getY() ? AIR : y == maxY ? surf : under, false);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
if (!waterIsNear(world, pos.getX() + sx, center.getY(), pos.getZ() + sz, 2)) {
|
||||
if (maxY <= center.getY() + 1) {
|
||||
maxY = MathHelper.clamp(maxY + 4, 0, center.getY());
|
||||
BlockState surf = random.nextBoolean() ? EndBlocks.ENDSTONE_DUST.getDefaultState() : world.getBiome(pos.add(sx, 0, sz)).getGenerationSettings().getSurfaceConfig().getTopMaterial();
|
||||
BlockState under = world.getBiome(pos.add(sx, 0, sz)).getGenerationSettings().getSurfaceConfig().getUnderMaterial();
|
||||
for (int y = maxY; y >= minY; y--) {
|
||||
pos.setY(y);
|
||||
BlockState state = chunk.getBlockState(pos);
|
||||
if (state.getMaterial().isReplaceable() || state.isIn(EndTags.GEN_TERRAIN)) {
|
||||
chunk.setBlockState(pos, y > center.getY() ? AIR : y == maxY ? surf : under, false);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int y = maxY; y >= minY; y--) {
|
||||
pos.setY(y);
|
||||
BlockState state = chunk.getBlockState(pos);
|
||||
if (state.getMaterial().isReplaceable() || state.isIn(EndTags.GEN_TERRAIN)) {
|
||||
if (maxY <= center.getY() + 1)
|
||||
chunk.setBlockState(pos, Blocks.REDSTONE_BLOCK.getDefaultState(), false);
|
||||
else
|
||||
chunk.setBlockState(pos, y > center.getY() ? AIR : WATER, false);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
else {
|
||||
for (int y = maxY; y >= minY; y--) {
|
||||
pos.setY(y);
|
||||
BlockState state = chunk.getBlockState(pos);
|
||||
if (state.getMaterial().isReplaceable() || state.isIn(EndTags.GEN_TERRAIN)) {
|
||||
if (maxY <= center.getY() + 1)
|
||||
chunk.setBlockState(pos, Blocks.REDSTONE_BLOCK.getDefaultState(), false);
|
||||
else
|
||||
chunk.setBlockState(pos, y > center.getY() ? AIR : WATER, false);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -181,6 +183,26 @@ public class LakePiece extends BasePiece {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean waterIsNear(StructureWorldAccess world, int x, int y, int z, int r) {
|
||||
int py = world.getChunk(x >> 4, z >> 4).sampleHeightmap(Type.WORLD_SURFACE, x & 15, z & 15) - 1;
|
||||
if (py > y) {
|
||||
Mutable m = new Mutable();
|
||||
m.setY(py);
|
||||
for (int i = -r; i <= r; i++) {
|
||||
int px = x + i;
|
||||
m.setX(px);
|
||||
for (int j = -r; j <= r; j++) {
|
||||
int pz = z + j;
|
||||
m.setZ(pz);
|
||||
if (!world.getFluidState(m).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private int getHeight(StructureWorldAccess world, BlockPos pos) {
|
||||
int p = ((pos.getX() & 2047) << 11) | (pos.getZ() & 2047);
|
||||
int h = heightmap.getOrDefault(p, Integer.MIN_VALUE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue