Fix flat bedrock (#6255)

This commit is contained in:
Jake Potrebic 2021-07-23 14:18:10 -07:00 committed by GitHub
parent 170382fe35
commit b173db6231
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,26 +132,15 @@ index ea3279113358b41281ee2e92f2371a0f1e36b472..575f0bcb4db4bd58c949acc3b6a15bbe
protochunk.setBiomes(biomestorage);
object = protochunk;
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
index 4e7e2a3d9135765701c9a74bf6c155539ebb969e..43efd756dec0dddcbcb18bcc2c48972f236ffda9 100644
index 4e7e2a3d9135765701c9a74bf6c155539ebb969e..b906895e1db3f0b5654694796cd87bfe4cdd09c7 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
@@ -270,8 +270,8 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
int j = chunk.getPos().getMinBlockZ();
NoiseGeneratorSettings noiseGeneratorSettings = this.settings.get();
int k = noiseGeneratorSettings.noiseSettings().minY();
- int l = k + noiseGeneratorSettings.getBedrockFloorPosition();
- int m = this.height - 1 + k - noiseGeneratorSettings.getBedrockRoofPosition();
+ int l = k + noiseGeneratorSettings.getBedrockFloorPosition(); final int floorHeight = k; // Paper
+ int m = this.height - 1 + k - noiseGeneratorSettings.getBedrockRoofPosition(); final int roofHeight = l; // Paper
int n = 5;
int o = chunk.getMinBuildHeight();
int p = chunk.getMaxBuildHeight();
@@ -281,7 +281,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
for(BlockPos blockPos : BlockPos.betweenClosed(i, 0, j, i + 15, 0, j + 15)) {
if (bl) {
for(int q = 0; q < 5; ++q) {
- if (q <= random.nextInt(5)) {
+ if (q <= (chunk.generateFlatBedrock() ? roofHeight : random.nextInt(5))) { // Paper - Configurable flat bedrock roof
+ if (q <= (chunk.generateFlatBedrock() ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock roof
chunk.setBlockState(mutableBlockPos.set(blockPos.getX(), m - q, blockPos.getZ()), Blocks.BEDROCK.defaultBlockState(), false);
}
}
@ -160,7 +149,7 @@ index 4e7e2a3d9135765701c9a74bf6c155539ebb969e..43efd756dec0dddcbcb18bcc2c48972f
if (bl2) {
for(int r = 4; r >= 0; --r) {
- if (r <= random.nextInt(5)) {
+ if (r <= (chunk.generateFlatBedrock() ? roofHeight : random.nextInt(5))) { // Paper - Configurable flat bedrock floor
+ if (r <= (chunk.generateFlatBedrock() ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock floor
chunk.setBlockState(mutableBlockPos.set(blockPos.getX(), l + r, blockPos.getZ()), Blocks.BEDROCK.defaultBlockState(), false);
}
}