Ease the night vision pulse with the partial tick
The last 10 seconds of Night Vision pulse in brightness. Vanilla reads the pulse at (duration - partial tick), so it eases between ticks. Horizon used the whole tick count, so the brightness stepped once per tick.
This commit is contained in:
@@ -10990,7 +10990,7 @@ impl Game<'_> {
|
||||
}),
|
||||
ticks: self.ticks,
|
||||
darkness: self.darkness_lighting(alpha as f32),
|
||||
night_vision: self.night_vision_intensity(),
|
||||
night_vision: self.night_vision_intensity(alpha as f32),
|
||||
block_flicker: self.fog.block_light_flicker,
|
||||
boss_darken: self
|
||||
.boss_overlay
|
||||
|
||||
@@ -1194,14 +1194,14 @@ impl Game<'_> {
|
||||
|
||||
/// `LightmapRenderStateExtractor`: the night vision effect's intensity
|
||||
/// (`GameRenderer.nightVisionScale`), or conduit power's water vision.
|
||||
pub(super) fn night_vision_intensity(&self) -> f32 {
|
||||
pub(super) fn night_vision_intensity(&self, partial: f32) -> f32 {
|
||||
use horizon_client::fog::FogType;
|
||||
if let Some(e) = self.potions.effects.get("night_vision") {
|
||||
// MobEffectInstance.endsWithin(200); -1 is infinite.
|
||||
return if e.duration < 0 || e.duration > 200 {
|
||||
1.0
|
||||
} else {
|
||||
0.7 + (e.duration as f32 * std::f32::consts::PI * 0.2).sin() * 0.3
|
||||
0.7 + ((e.duration as f32 - partial) * std::f32::consts::PI * 0.2).sin() * 0.3
|
||||
};
|
||||
}
|
||||
if self.potions.effects.get("conduit_power").is_some()
|
||||
|
||||
Reference in New Issue
Block a user