mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
what did i do to deserve this
This commit is contained in:
parent
c9872349fe
commit
47be4e97b6
@ -41,6 +41,8 @@ public class SoundTE implements ISound {
|
|||||||
private float volume;
|
private float volume;
|
||||||
private float pitch;
|
private float pitch;
|
||||||
|
|
||||||
|
private boolean isSoundOn = false;
|
||||||
|
|
||||||
public SoundTE(String sound, ISoundSourceTE source) {
|
public SoundTE(String sound, ISoundSourceTE source) {
|
||||||
this.sound = new ResourceLocation(sound);
|
this.sound = new ResourceLocation(sound);
|
||||||
this.source = source;
|
this.source = source;
|
||||||
@ -98,13 +100,20 @@ public class SoundTE implements ISound {
|
|||||||
|
|
||||||
SoundHandler handler = Minecraft.getMinecraft().getSoundHandler();
|
SoundHandler handler = Minecraft.getMinecraft().getSoundHandler();
|
||||||
|
|
||||||
if(!this.source.isPlaying() && handler.isSoundPlaying(this)) {
|
if(isSoundOn && !this.source.isPlaying()) {
|
||||||
handler.stopSound(this);
|
handler.stopSound(this);
|
||||||
|
isSoundOn = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!handler.isSoundPlaying(this)) {
|
//TODO: drown this class, the minecraft sound handler and the entire fucking game in holy water
|
||||||
handler.playSound(this);
|
//no, it won't fix anything but at least the pain will be over
|
||||||
|
|
||||||
|
if(!isSoundOn && this.source.isPlaying()) {
|
||||||
|
try {
|
||||||
|
handler.playSound(this);
|
||||||
|
} catch(IllegalArgumentException ex) { }
|
||||||
|
isSoundOn = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.volume = this.source.getVolume();
|
this.volume = this.source.getVolume();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user