Skip to content

Commit 7317809

Browse files
committed
fix cloud heights on non extended worlds
1 parent 263d134 commit 7317809

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/main/java/teamport/aether/world/chunk/ChunkDecoratorAether.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void decorate(Chunk chunk) {
6666
int worldZ = chunk.zPosition * 16;
6767
Random rand = deriveRandomFromWorld(chunk, this.world.getRandomSeed());
6868

69-
decorateWithClouds(rand, worldX, worldZ);
69+
decorateWithClouds(rand, minY, maxY, worldX, worldZ);
7070

7171
if (world.getWorldType() == AetherWorldTypes.AETHER_EXTENDED) {
7272
decorateWithFlatClouds(chunk);
@@ -316,20 +316,26 @@ public void decorateWithLakesAndTrees(Random rand, int minY, int maxY, int x, in
316316
public static final WorldFeatureAetherClouds AERCLOUD_GOLD = new WorldFeatureAetherClouds(AetherBlocks.AERCLOUD_GOLD.id(), 4);
317317
public static final WorldFeatureAetherCloudsFlat AERCLOUD_FLAT = new WorldFeatureAetherCloudsFlat(AetherBlocks.AERCLOUD_WHITE.id(), 48);
318318

319-
public void decorateWithClouds(Random rand, int worldX, int worldZ) {
319+
public void decorateWithClouds(Random rand, int minY, int maxY, int worldX, int worldZ) {
320+
int rangeY = maxY + 1 - minY;
321+
float heightModifier = rangeY / 128.0F;
320322
int yPosition;
323+
321324
if (rand.nextInt(12) == 0) {
322-
yPosition = rand.nextInt(32) + 224;
325+
int base = rand.nextInt(16) + 112;
326+
yPosition = minY + Math.round(base * heightModifier);
323327
AERCLOUD_GOLD.place(this.world, rand, worldX + 8, yPosition, worldZ + 8);
324328
}
325329

326330
if (rand.nextInt(12) == 0) {
327-
yPosition = rand.nextInt(64) + 128;
331+
int base = rand.nextInt(32) + 64;
332+
yPosition = minY + Math.round(base * heightModifier);
328333
AERCLOUD_BLUE.place(this.world, rand, worldX + 8, yPosition, worldZ + 8);
329334
}
330335

331336
if (rand.nextInt(6) == 0) {
332-
yPosition = rand.nextInt(192) + 32;
337+
int base = rand.nextInt(96) + 16;
338+
yPosition = minY + Math.round(base * heightModifier);
333339
AERCLOUD_WHITE.place(this.world, rand, worldX + 8, yPosition, worldZ + 8);
334340
}
335341

0 commit comments

Comments
 (0)