Stub command and visual compile blockers
Some checks failed
Build / build (push) Failing after 6m6s

This commit is contained in:
MrSphay
2026-05-04 14:08:43 +02:00
parent f271129450
commit d22b64c729
11 changed files with 71 additions and 226 deletions

View File

@@ -1,6 +1,3 @@
/*
* Decompiled with CFR 0.152.
*/
package com.vinlanx.explosionoverhaul.client;
import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance;
@@ -9,50 +6,43 @@ import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.RandomSource;
public class FadingMusicInstance
extends AbstractTickableSoundInstance {
public class FadingMusicInstance extends AbstractTickableSoundInstance {
private float targetVolume = 1.0f;
private float fadeSpeed = 0.0f;
private boolean shouldStop = false;
public FadingMusicInstance(SoundEvent sound, float volume, SoundSource source) {
super(sound, source, RandomSource.m_216327_());
this.f_119578_ = true;
this.f_119579_ = 0;
this.f_119573_ = volume;
this.f_119574_ = 1.0f;
this.f_119575_ = 0.0;
this.f_119576_ = 0.0;
this.f_119577_ = 0.0;
this.f_119582_ = true;
this.f_119580_ = SoundInstance.Attenuation.NONE;
super(sound, source, RandomSource.create());
this.looping = true;
this.delay = 0;
this.volume = volume;
this.pitch = 1.0f;
this.x = 0.0;
this.y = 0.0;
this.z = 0.0;
this.relative = true;
this.attenuation = SoundInstance.Attenuation.NONE;
this.targetVolume = volume;
}
public void m_7788_() {
if (Math.abs(this.f_119573_ - this.targetVolume) > 0.001f) {
if (this.fadeSpeed != 0.0f) {
this.f_119573_ += this.fadeSpeed;
if (this.fadeSpeed > 0.0f && this.f_119573_ >= this.targetVolume) {
this.f_119573_ = this.targetVolume;
} else if (this.fadeSpeed < 0.0f && this.f_119573_ <= this.targetVolume) {
this.f_119573_ = this.targetVolume;
}
this.f_119573_ = Math.max(0.0f, Math.min(1.0f, this.f_119573_));
} else {
this.f_119573_ = this.targetVolume;
@Override
public void tick() {
if (Math.abs(this.volume - this.targetVolume) > 0.001f) {
this.volume = this.fadeSpeed == 0.0f ? this.targetVolume : this.volume + this.fadeSpeed;
if ((this.fadeSpeed > 0.0f && this.volume >= this.targetVolume) || (this.fadeSpeed < 0.0f && this.volume <= this.targetVolume)) {
this.volume = this.targetVolume;
}
this.volume = Math.max(0.0f, Math.min(1.0f, this.volume));
}
if (this.shouldStop && this.f_119573_ <= 0.001f) {
this.m_119609_();
if (this.shouldStop && this.volume <= 0.001f) {
this.stop();
}
}
public void fadeTo(float targetVolume, float durationSeconds) {
this.targetVolume = Math.max(0.0f, Math.min(1.0f, targetVolume));
float totalTicks = durationSeconds * 20.0f;
float volumeDifference = this.targetVolume - this.f_119573_;
this.fadeSpeed = volumeDifference / totalTicks;
float totalTicks = Math.max(1.0f, durationSeconds * 20.0f);
this.fadeSpeed = (this.targetVolume - this.volume) / totalTicks;
}
public void fadeOutAndStop(float durationSeconds) {
@@ -61,10 +51,10 @@ extends AbstractTickableSoundInstance {
}
public float getCurrentVolume() {
return this.f_119573_;
return this.volume;
}
public boolean hasFinishedFading() {
return this.shouldStop && this.f_119573_ <= 0.001f;
return this.shouldStop && this.volume <= 0.001f;
}
}