Added audio to Hephaestus (this machine is cool as fuck how did I not know about it before)

This commit is contained in:
George Paton 2024-01-23 19:26:48 +11:00
parent 17b4c52707
commit 07610a603d
3 changed files with 35 additions and 0 deletions

View File

@ -8,6 +8,8 @@ import com.hbm.inventory.fluid.trait.FT_Heatable;
import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingStep;
import com.hbm.inventory.fluid.trait.FT_Heatable.HeatingType;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.sound.AudioWrapper;
import com.hbm.tileentity.INBTPacketReceiver;
import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.util.fauxpointtwelve.DirPos;
@ -37,6 +39,8 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements
private int[] heat = new int[10];
private long fissureScanTime;
private AudioWrapper audio;
@Override
public void updateEntity() {
@ -91,6 +95,16 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements
double z = worldObj.rand.nextGaussian() * 2;
worldObj.spawnParticle("cloud", xCoord + 0.5 + x, yCoord + 6 + y, zCoord + 0.5 + z, 0, 0, 0);
}
if(audio == null) {
audio = MainRegistry.proxy.getLoopedSound("hbm:block.hephaestusRunning", xCoord, yCoord + 5F, zCoord, 0.75F, 10F, 1.0F);
audio.startSound();
}
} else {
if(audio != null) {
audio.stopSound();
audio = null;
}
}
if(this.rot >= 360F) {
@ -234,6 +248,26 @@ public class TileEntityMachineHephaestus extends TileEntityLoadedBase implements
return dir != ForgeDirection.UNKNOWN && dir != ForgeDirection.UP && dir != ForgeDirection.DOWN;
}
@Override
public void onChunkUnload() {
super.onChunkUnload();
if(audio != null) {
audio.stopSound();
audio = null;
}
}
@Override
public void invalidate() {
super.invalidate();
if(audio != null) {
audio.stopSound();
audio = null;
}
}
AxisAlignedBB bb = null;
@Override

View File

@ -63,6 +63,7 @@
"block.reactorLoop": {"category": "block", "sounds": [{"name": "block/reactorLoop", "stream": false}]},
"block.fusionReactorRunning": {"category": "block", "sounds": [{"name": "block/fusionReactorSpin", "stream": false}]},
"block.fel": {"category": "block", "sounds": [{"name": "block/fel", "stream": false}]},
"block.hephaestusRunning": {"category": "block", "sounds": [{"name": "block/hephaestusRunning", "stream": false}]},
"door.TransitionSealOpen": {"category": "block", "sounds": [{"name": "block/door/transition_seal_open", "stream": true}]},
"door.wghStart": {"category": "block", "sounds": [{"name": "block/door/wgh_start", "stream": true}]},