Merge pull request #2389 from kacpherek/fix/weather-height-adjusted-temperature

🤖 Agent: Merged by Ludovic's AI agent (Claude, contrib-gate-19) after the contribution gate. Checked against vanilla 26.3 and proven in union/cg19-r2 (all round-2 PRs together: clippy, 1722 tests, 135 harnesses, lan_e2e in-frame and on the server thread) and union/cg19-r3 (the same PRs merged with today's main: 96/96 harnesses). Thanks @kacpherek.
This commit is contained in:
Ludovic Marie
2026-10-27 17:43:57 +01:00
committed by GitHub
3 changed files with 13 additions and 21 deletions
+7
View File
@@ -66,6 +66,13 @@ impl BiomeInfo {
}
.height_adjusted(pos, sea_level)
}
/// `Biome.getPrecipitationAt` in the Overworld (sea level 63): None
/// without precipitation, else whether it falls as snow
/// (`getHeightAdjustedTemperature` below 0.15).
pub fn snows_at(&self, x: i32, y: i32, z: i32) -> Option<bool> {
self.precipitation
.then(|| self.temperature_at(BlockPos::new(x, y, z), 63) < 0.15)
}
}
pub struct Biomes {
pub list: Vec<BiomeInfo>,
+5 -11
View File
@@ -10584,19 +10584,13 @@ impl Game<'_> {
}
}
/// Whether precipitation at a column is snow (Biome.coldEnoughToSnow:
/// base temperature lowered above y 80) or none (no precipitation).
/// height adjusted temperature) or none (no precipitation).
fn precipitation(&self, x: i32, y: i32, z: i32) -> Option<bool> {
let chunk = self.world.chunks.get(&(x >> 4, z >> 4))?;
let b = self.res.biomes().get(chunk.biome(x, y, z));
if !b.precipitation {
return None;
}
let t = if y > 80 {
b.temperature - (y - 80) as f32 * 0.05 / 40.0
} else {
b.temperature
};
Some(t < 0.15)
self.res
.biomes()
.get(chunk.biome(x, y, z))
.snows_at(x, y, z)
}
/// `Level.isRainingAt`: it rains, the sky light is 15, nothing that stops
/// motion is above, and the biome's precipitation there is rain.
+1 -10
View File
@@ -53,16 +53,7 @@ fn rains_at(world: &World, biomes: &Biomes, x: i32, y: i32, z: i32) -> bool {
let Some(chunk) = world.chunks.get(&(x >> 4, z >> 4)) else {
return false;
};
let b = biomes.get(chunk.biome(x, y, z));
if !b.precipitation {
return false;
}
let t = if y > 80 {
b.temperature - (y - 80) as f32 * 0.05 / 40.0
} else {
b.temperature
};
t >= 0.15
biomes.get(chunk.biome(x, y, z)).snows_at(x, y, z) == Some(false)
}
impl Game<'_> {