mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
certified fel sound
This commit is contained in:
parent
56e7d2d83c
commit
cc4105fc68
@ -128,17 +128,6 @@ public class LoopedSoundPacket implements IMessage {
|
|||||||
if(flag && te.getWorldObj().isRemote && ((TileEntityMachineGasCent)te).isProgressing)
|
if(flag && te.getWorldObj().isRemote && ((TileEntityMachineGasCent)te).isProgressing)
|
||||||
Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopCentrifuge(new ResourceLocation("hbm:block.centrifugeOperate"), te));
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
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<SoundLoopFel> 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -13,6 +13,7 @@ import com.hbm.items.machine.ItemFELCrystal;
|
|||||||
import com.hbm.items.machine.ItemFELCrystal.EnumWavelengths;
|
import com.hbm.items.machine.ItemFELCrystal.EnumWavelengths;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
|
import com.hbm.sound.AudioWrapper;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
import com.hbm.util.ContaminationUtil;
|
import com.hbm.util.ContaminationUtil;
|
||||||
@ -36,6 +37,7 @@ import net.minecraft.potion.Potion;
|
|||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
@ -49,6 +51,8 @@ public class TileEntityFEL extends TileEntityMachineBase implements IEnergyUser,
|
|||||||
public boolean missingValidSilex = true ;
|
public boolean missingValidSilex = true ;
|
||||||
public int distance;
|
public int distance;
|
||||||
public List<EntityLivingBase> entities = new ArrayList();
|
public List<EntityLivingBase> entities = new ArrayList();
|
||||||
|
private int audioDuration = 0;
|
||||||
|
private AudioWrapper audio;
|
||||||
|
|
||||||
|
|
||||||
public TileEntityFEL() {
|
public TileEntityFEL() {
|
||||||
@ -179,6 +183,34 @@ public class TileEntityFEL extends TileEntityMachineBase implements IEnergyUser,
|
|||||||
data.setBoolean("valid", missingValidSilex);
|
data.setBoolean("valid", missingValidSilex);
|
||||||
data.setInteger("distance", distance);
|
data.setInteger("distance", distance);
|
||||||
this.networkPack(data, 250);
|
this.networkPack(data, 250);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(isOn) {
|
||||||
|
audioDuration += 2;
|
||||||
|
} else {
|
||||||
|
audioDuration -= 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
audioDuration = MathHelper.clamp_int(audioDuration, 0, 60);
|
||||||
|
|
||||||
|
if(audioDuration > 10) {
|
||||||
|
|
||||||
|
if(audio == null) {
|
||||||
|
audio = createAudioLoop();
|
||||||
|
audio.startSound();
|
||||||
|
} else if(!audio.isPlaying()) {
|
||||||
|
audio = rebootAudio(audio);
|
||||||
|
}
|
||||||
|
|
||||||
|
audio.updatePitch((audioDuration - 10) / 100F + 0.5F);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(audio != null) {
|
||||||
|
audio.stopSound();
|
||||||
|
audio = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +266,12 @@ public class TileEntityFEL extends TileEntityMachineBase implements IEnergyUser,
|
|||||||
nbt.setBoolean("valid", missingValidSilex);
|
nbt.setBoolean("valid", missingValidSilex);
|
||||||
nbt.setInteger("distance", distance);
|
nbt.setInteger("distance", distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AudioWrapper createAudioLoop() {
|
||||||
|
return MainRegistry.proxy.getLoopedSound("hbm:block.fel", xCoord, yCoord, zCoord, 2.0F, 10F, 2.0F);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getRenderBoundingBox() {
|
public AxisAlignedBB getRenderBoundingBox() {
|
||||||
return INFINITE_EXTENT_AABB;
|
return INFINITE_EXTENT_AABB;
|
||||||
|
|||||||
@ -59,6 +59,7 @@
|
|||||||
"block.hornFarSingle": {"category": "block", "sounds": [{"name": "block/hornFarSingle", "stream": false}]},
|
"block.hornFarSingle": {"category": "block", "sounds": [{"name": "block/hornFarSingle", "stream": false}]},
|
||||||
"block.hornFarDual": {"category": "block", "sounds": [{"name": "block/hornFarDual", "stream": false}]},
|
"block.hornFarDual": {"category": "block", "sounds": [{"name": "block/hornFarDual", "stream": false}]},
|
||||||
"block.reactorLoop": {"category": "block", "sounds": [{"name": "block/reactorLoop", "stream": false}]},
|
"block.reactorLoop": {"category": "block", "sounds": [{"name": "block/reactorLoop", "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}]},
|
"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}]},
|
"door.wghStart": {"category": "block", "sounds": [{"name": "block/door/wgh_start", "stream": true}]},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user