Fucking murder the sound loop, this way it'll call .stop() every update until it is disposed

This commit is contained in:
George Paton 2024-02-07 13:48:18 +11:00
parent 443e154e57
commit 2c6fa42bf0

View File

@ -246,7 +246,10 @@ public class TileEntityDoorGeneric extends TileEntityLockableBase implements IAn
DoorDecl doorType = getDoorType();
if(this.state == 0 && state == 3){ // Door transitioning to open
if(audio != null) audio.stopSound();
if(audio != null) {
audio.stopSound();
audio.setKeepAlive(0);
}
if(doorType.getOpenSoundLoop() != null){
audio = MainRegistry.proxy.getLoopedSound(doorType.getOpenSoundLoop(), xCoord, yCoord, zCoord, doorType.getSoundVolume(), 10F, 1F);
@ -266,7 +269,10 @@ public class TileEntityDoorGeneric extends TileEntityLockableBase implements IAn
}
if(this.state == 1 && state == 2){ // Door transitioning to closed
if(audio != null) audio.stopSound();
if(audio != null) {
audio.stopSound();
audio.setKeepAlive(0);
}
if(doorType.getCloseSoundLoop() != null){
audio = MainRegistry.proxy.getLoopedSound(doorType.getCloseSoundLoop(), xCoord, yCoord, zCoord, doorType.getSoundVolume(), 10F, 1F);
@ -288,10 +294,12 @@ public class TileEntityDoorGeneric extends TileEntityLockableBase implements IAn
if(state == 1 || state == 0){ // Door finished any transition
if(audio != null){
audio.stopSound();
audio.setKeepAlive(0);
audio = null;
}
if(audio2 != null){
audio2.stopSound();
audio.setKeepAlive(0);
audio2 = null;
}
}