Skip to content

Commit

Permalink
Sound update
Browse files Browse the repository at this point in the history
  • Loading branch information
Dolu1990 committed May 30, 2014
1 parent 94525f3 commit 919a155
Show file tree
Hide file tree
Showing 16 changed files with 185 additions and 161 deletions.
2 changes: 1 addition & 1 deletion mods/eln/Eln.java
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ void registerBattery(int id) {
double stdU = LVU;
double stdP = LVP / 4;
double stdHalfLife = Utils.minecraftDay * 2;
double stdEfficiency = 1.0 - 4.0 / 50.0;
double stdEfficiency = 1.0 - 2.0 / 50.0;
double condoEfficiency = 1.0 - 2.0 / 50.0;

batteryVoltageFunctionTable = voltageFunction;
Expand Down
13 changes: 3 additions & 10 deletions mods/eln/PacketHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import mods.eln.node.NodeBlockEntity;
import mods.eln.node.NodeManager;
import mods.eln.sound.SoundClient;
import mods.eln.sound.SoundParam;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.player.EntityPlayer;
Expand Down Expand Up @@ -120,16 +121,8 @@ void packetPlaySound(DataInputStream stream, NetworkManager manager,
if (stream.readByte() != clientPlayer.dimension)
return;

SoundClient.play(
clientPlayer.worldObj,
stream.readInt() / 8.0,
stream.readInt() / 8.0,
stream.readInt() / 8.0,
stream.readUTF(),
stream.readFloat(),
stream.readFloat(),
stream.readFloat(),
stream.readFloat());

SoundClient.play(SoundParam.fromStream(stream,clientPlayer.worldObj));

} catch (IOException e) {
// TODO Auto-generated catch block
Expand Down
4 changes: 3 additions & 1 deletion mods/eln/electricalalarm/ElectricalAlarmSlowProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import mods.eln.Eln;
import mods.eln.misc.Coordonate;
import mods.eln.sim.IProcess;
import mods.eln.sound.SoundParam;
import mods.eln.sound.SoundServer;

public class ElectricalAlarmSlowProcess implements IProcess {

Expand All @@ -27,7 +29,7 @@ public void process(double time) {
if(soundTimeTimeout == 0) {
float speed = 1f;
Coordonate coord = element.sixNode.coordonate;
coord.world().playSoundEffect(coord.x, coord.y, coord.z, element.descriptor.soundName, element.descriptor.soundLevel, speed);
SoundServer.play(new SoundParam(element.descriptor.soundName,coord).setVolume(1F, 1.0F).longRange());
soundTimeTimeout = element.descriptor.soundTime;
}
}
Expand Down
4 changes: 3 additions & 1 deletion mods/eln/electricalbreaker/ElectricalBreakerElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import mods.eln.sim.ITemperatureWatchdogDescriptor;
import mods.eln.sim.IVoltageWatchdogDescriptor;
import mods.eln.sim.ThermalLoad;
import mods.eln.sound.SoundParam;
import mods.eln.sound.SoundServer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
Expand Down Expand Up @@ -145,7 +147,7 @@ public void networkSerialize(DataOutputStream stream) {

public void setSwitchState(boolean state) {
if(state == switchState) return;
playSoundEffect("random.click", 0.3F, 0.6F);
SoundServer.play(new SoundParam("random.click",this.getCoordonate()).setVolume(0.3F, 0.6f).smallRange());
switchState = state;
refreshSwitchResistor();
needPublish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import mods.eln.sim.ITemperatureWatchdogDescriptor;
import mods.eln.sim.IVoltageWatchdogDescriptor;
import mods.eln.sim.ThermalLoad;
import mods.eln.sound.SoundParam;
import mods.eln.sound.SoundServer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
Expand Down Expand Up @@ -145,7 +147,7 @@ public boolean onBlockActivated(EntityPlayer entityPlayer, Direction side, float
}
else if(!Utils.playerHasMeter(entityPlayer) && descriptor.onOffOnly) {
outputGateProcess.state(!outputGateProcess.getOutputOnOff());
playSoundEffect("random.click", 0.3F, 0.6F);
SoundServer.play(new SoundParam("random.click",this.getCoordonate()).setVolume(0.3F, 0.6F).smallRange());
needPublish();
return true;
}
Expand Down
1 change: 1 addition & 0 deletions mods/eln/electricalrelay/ElectricalRelayDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
}

void draw(float factor) {
//UtilsClient.disableBlend();
UtilsClient.disableCulling();
GL11.glScalef(0.5f, 0.5f, 0.5f);
if(main != null) main.draw();
Expand Down
4 changes: 3 additions & 1 deletion mods/eln/electricalrelay/ElectricalRelayElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import mods.eln.sim.ITemperatureWatchdogDescriptor;
import mods.eln.sim.IVoltageWatchdogDescriptor;
import mods.eln.sim.ThermalLoad;
import mods.eln.sound.SoundParam;
import mods.eln.sound.SoundServer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
Expand Down Expand Up @@ -134,7 +136,7 @@ public void setSwitchState(boolean state) {
if(state == switchState) return;
switchState = state;
refreshSwitchResistor();
playSoundEffect("random.click", 0.1F, 2.0F);
SoundServer.play(new SoundParam("random.click",this.getCoordonate()).setVolume(0.1F, 2.0F).smallRange());
needPublish();
}

Expand Down
3 changes: 2 additions & 1 deletion mods/eln/electricalswitch/ElectricalSwitchElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import mods.eln.sim.ITemperatureWatchdogDescriptor;
import mods.eln.sim.IVoltageWatchdogDescriptor;
import mods.eln.sim.ThermalLoad;
import mods.eln.sound.SoundParam;
import mods.eln.sound.SoundServer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
Expand Down Expand Up @@ -174,7 +175,7 @@ else if(Eln.multiMeterElement.checkSameItemStack(entityPlayer.getCurrentEquipped
else {
setSwitchState(! switchState);
//playSoundEffect("random.click", 0.3F, 0.6F);
SoundServer.playFromCoord(getCoordonate(),"random.click", 0.3F, 0.6F, 1, 7);
SoundServer.play(new SoundParam("random.click",this.getCoordonate()).setVolume(0.3F, 0.6f).smallRange());
return true;
}
//front = LRDU.fromInt((front.toInt()+1)&3);
Expand Down
4 changes: 3 additions & 1 deletion mods/eln/misc/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,9 @@ public static float traceRay(World w, double posX, double posY, double posZ, dou

Block block = Blocks.air;
if (w.blockExists(xInt + posXint, yInt + posYint, zInt + posZint))
w.getBlock(xInt + posXint, yInt + posYint, zInt + posZint);
block = w.getBlock(xInt + posXint, yInt + posYint, zInt + posZint);



float dToStack;
if (d + dBest < rangeMax)
Expand Down
Loading

0 comments on commit 919a155

Please sign in to comment.