mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Add audio to the Fusion Reactor, with spool up/down
This commit is contained in:
parent
13afe67eb3
commit
17b4c52707
@ -316,6 +316,8 @@ public class TileEntityChungus extends TileEntityLoadedBase implements IFluidAcc
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
|
||||
if(audio != null) {
|
||||
audio.stopSound();
|
||||
audio = null;
|
||||
|
||||
@ -24,6 +24,7 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
@ -63,6 +64,10 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser
|
||||
public float lastRotor;
|
||||
public boolean isOn;
|
||||
|
||||
private float rotorSpeed = 0F;
|
||||
|
||||
private AudioWrapper audio;
|
||||
|
||||
public TileEntityITER() {
|
||||
super(5);
|
||||
tanks = new FluidTank[2];
|
||||
@ -181,16 +186,38 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser
|
||||
/// END Notif packets ///
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
this.lastRotor = this.rotor;
|
||||
this.rotor += this.rotorSpeed;
|
||||
|
||||
if(this.rotor >= 360) {
|
||||
this.rotor -= 360;
|
||||
this.lastRotor -= 360;
|
||||
}
|
||||
|
||||
if(this.isOn && this.power >= this.powerReq) {
|
||||
if(this.isOn && this.power >= powerReq) {
|
||||
this.rotorSpeed = Math.max(0F, Math.min(15F, this.rotorSpeed + 0.05F));
|
||||
|
||||
if(audio == null) {
|
||||
audio = MainRegistry.proxy.getLoopedSound("hbm:block.fusionReactorRunning", xCoord, yCoord, zCoord, 1.0F, 30F, 1.0F);
|
||||
audio.startSound();
|
||||
}
|
||||
|
||||
float rotorSpeed = this.rotorSpeed / 15F;
|
||||
audio.updateVolume(getVolume(0.5f * rotorSpeed));
|
||||
audio.updatePitch(0.25F + 0.75F * rotorSpeed);
|
||||
} else {
|
||||
this.rotorSpeed = Math.max(0F, Math.min(15F, this.rotorSpeed - 0.1F));
|
||||
|
||||
this.rotor += 15F;
|
||||
|
||||
if(this.rotor >= 360) {
|
||||
this.rotor -= 360;
|
||||
this.lastRotor -= 360;
|
||||
if(audio != null) {
|
||||
if(this.rotorSpeed > 0) {
|
||||
float rotorSpeed = this.rotorSpeed / 15F;
|
||||
audio.updateVolume(getVolume(0.5f * rotorSpeed));
|
||||
audio.updatePitch(0.25F + 0.75F * rotorSpeed);
|
||||
} else {
|
||||
audio.stopSound();
|
||||
audio = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -477,6 +504,26 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyUser
|
||||
return 0;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
@ -324,6 +324,8 @@ public class TileEntityMachineLargeTurbine extends TileEntityMachineBase impleme
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
|
||||
if(audio != null) {
|
||||
audio.stopSound();
|
||||
audio = null;
|
||||
|
||||
@ -61,6 +61,7 @@
|
||||
"block.hornFarSingle": {"category": "block", "sounds": [{"name": "block/hornFarSingle", "stream": false}]},
|
||||
"block.hornFarDual": {"category": "block", "sounds": [{"name": "block/hornFarDual", "stream": false}]},
|
||||
"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}]},
|
||||
|
||||
"door.TransitionSealOpen": {"category": "block", "sounds": [{"name": "block/door/transition_seal_open", "stream": true}]},
|
||||
|
||||
BIN
src/main/resources/assets/hbm/sounds/block/fusionReactorSpin.ogg
Normal file
BIN
src/main/resources/assets/hbm/sounds/block/fusionReactorSpin.ogg
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user