diff --git a/src/main/java/crazypants/enderio/config/Config.java b/src/main/java/crazypants/enderio/config/Config.java index c05e5247..56c5aa49 100644 --- a/src/main/java/crazypants/enderio/config/Config.java +++ b/src/main/java/crazypants/enderio/config/Config.java @@ -173,6 +173,7 @@ public final class Config { public static int darkSteelSoundLocatorCost = 10; public static int darkSteelSoundLocatorRange = 40; + public static int darkSteelSoundLocatorLifespan = 40; public static int hootchPowerPerCycle = 6; public static int hootchPowerTotalBurnTime = 6000; @@ -460,6 +461,8 @@ public final class Config { "Number of levels required for the 'Sound Locator' upgrade.").getInt(darkSteelSoundLocatorCost); darkSteelSoundLocatorRange = config.get(sectionDarkSteel.name, "darkSteelSoundLocatorRange", darkSteelSoundLocatorRange, "Range of the 'Sound Locator' upgrade.").getInt(darkSteelSoundLocatorRange); + darkSteelSoundLocatorLifespan = config.get(sectionDarkSteel.name, "darkSteelSoundLocatorLifespan", darkSteelSoundLocatorLifespan, + "Number of ticks the 'Sound Locator' icons are displayed for.").getInt(darkSteelSoundLocatorLifespan); darkSteelSwordSkullLootingModifier = (float) config.get(sectionDarkSteel.name, "darkSteelSwordSkullLootingModifier", darkSteelSwordSkullLootingModifier, "The chance per looting level that a skull will be dropped when using a powered dark steel sword (0 = no chance, 1 = 100% chance)").getDouble( diff --git a/src/main/java/crazypants/enderio/item/darksteel/SoundDetector.java b/src/main/java/crazypants/enderio/item/darksteel/SoundDetector.java index 50c46a78..79f85fc5 100644 --- a/src/main/java/crazypants/enderio/item/darksteel/SoundDetector.java +++ b/src/main/java/crazypants/enderio/item/darksteel/SoundDetector.java @@ -60,19 +60,15 @@ public class SoundDetector { @SubscribeEvent public void onSound(PlaySoundAtEntityEvent evt) { - if(enabled && evt.entity != null && evt.entity != Minecraft.getMinecraft().thePlayer) { - synchronized (soundQueue) { - soundQueue.add(new SoundSource(evt.entity, evt.volume)); - } + if(enabled && evt.entity != null && evt.entity != Minecraft.getMinecraft().thePlayer) { + soundQueue.add(new SoundSource(evt.entity, evt.volume)); } } @SubscribeEvent public void onSound(PlaySoundSourceEvent evt) { if(enabled) { - synchronized (soundQueue) { - soundQueue.add(new SoundSource(evt.sound.getXPosF(),evt.sound.getYPosF(),evt.sound.getZPosF(), evt.sound.getVolume())); - } + soundQueue.add(new SoundSource(evt.sound.getXPosF(),evt.sound.getYPosF(),evt.sound.getZPosF(), evt.sound.getVolume())); } } @@ -80,18 +76,14 @@ public class SoundDetector { @SubscribeEvent public void onClientTick(TickEvent.ClientTickEvent event) { - if(!enabled) { + if(!enabled || mc.thePlayer == null || mc.thePlayer.worldObj == null) { return; } - - synchronized (soundQueue) { - sounds.addAll(soundQueue); - soundQueue.clear(); - } - if(mc.thePlayer == null || mc.thePlayer.worldObj == null) { - return; - } + List tmp = soundQueue; + soundQueue = sounds; + sounds = tmp; + Vector3d eye = Util.getEyePositionEio(mc.thePlayer); for(SoundSource ss : sounds) { if(ss.pos.distanceSquared(eye) <= maxRangeSq) {