diff --git a/src/main/java/com/hbm/packet/LoopedSoundPacket.java b/src/main/java/com/hbm/packet/LoopedSoundPacket.java index 44d9339bf..fc19692b3 100644 --- a/src/main/java/com/hbm/packet/LoopedSoundPacket.java +++ b/src/main/java/com/hbm/packet/LoopedSoundPacket.java @@ -1,17 +1,8 @@ package com.hbm.packet; import com.hbm.interfaces.Spaghetti; -import com.hbm.sound.SoundLoopAssembler; -import com.hbm.sound.SoundLoopBroadcaster; -import com.hbm.sound.SoundLoopCentrifuge; -import com.hbm.sound.SoundLoopMiner; -import com.hbm.sound.SoundLoopTurbofan; -import com.hbm.tileentity.machine.TileEntityBroadcaster; -import com.hbm.tileentity.machine.TileEntityMachineAssembler; -import com.hbm.tileentity.machine.TileEntityMachineCentrifuge; -import com.hbm.tileentity.machine.TileEntityMachineGasCent; -import com.hbm.tileentity.machine.TileEntityMachineMiningDrill; -import com.hbm.tileentity.machine.TileEntityMachineTurbofan; +import com.hbm.sound.*; +import com.hbm.tileentity.machine.*; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; @@ -137,6 +128,17 @@ public class LoopedSoundPacket implements IMessage { if(flag && te.getWorldObj().isRemote && ((TileEntityMachineGasCent)te).isProgressing) Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopCentrifuge(new ResourceLocation("hbm:block.centrifugeOperate"), te)); } + + if (te != null && te instanceof TileEntityFEL) { + boolean flag = true; + for(int i = 0; i < SoundLoopFel.list.size(); i++) { + if (SoundLoopFel.list.get(i).getTE() == te && !SoundLoopFel.list.get(i).isDonePlaying()) + flag = false; + } + + if(flag && te.getWorldObj().isRemote && ((TileEntityFEL)te).isOn) + Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopFel(new ResourceLocation("hbm:block.fel"), (TileEntityFEL) te)); + } return null; } } diff --git a/src/main/java/com/hbm/sound/SoundLoopFel.java b/src/main/java/com/hbm/sound/SoundLoopFel.java new file mode 100644 index 000000000..b12026ed2 --- /dev/null +++ b/src/main/java/com/hbm/sound/SoundLoopFel.java @@ -0,0 +1,37 @@ +package com.hbm.sound; + +import com.hbm.tileentity.machine.TileEntityFEL; +import net.minecraft.client.audio.MovingSound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; + +import java.util.ArrayList; +import java.util.List; + +public class SoundLoopFel extends SoundLoopMachine { + + public static List list = new ArrayList<>(); + + private TileEntityFEL plant; + + public SoundLoopFel(ResourceLocation path, TileEntityFEL te) { + super(path, te); + list.add(this); + plant = te; + } + + @Override + public void update() { + super.update(); + + if(this.volume != 3) + volume = 3; + + if(!plant.isOn) + this.donePlaying = true; + } + + public TileEntity getTE() { + return te; + } +} diff --git a/src/main/resources/assets/hbm/sounds/block/fel.ogg b/src/main/resources/assets/hbm/sounds/block/fel.ogg new file mode 100644 index 000000000..f5927a707 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/block/fel.ogg differ