diff --git a/src/main/java/org/blockartistry/mod/DynSurround/client/ClientEffectHandler.java b/src/main/java/org/blockartistry/mod/DynSurround/client/ClientEffectHandler.java index e395334..0606d65 100644 --- a/src/main/java/org/blockartistry/mod/DynSurround/client/ClientEffectHandler.java +++ b/src/main/java/org/blockartistry/mod/DynSurround/client/ClientEffectHandler.java @@ -114,6 +114,7 @@ public void clientTick(final TickEvent.ClientTickEvent event) { } } + @SuppressWarnings("unused") private static boolean okToHook(final WorldProvider provider) { if (provider.hasNoSky) return false; @@ -136,9 +137,9 @@ public void onWorldLoad(final WorldEvent.Load e) { // Shim the provider so we can tap into the // sky and cloud stuff. - if (ModOptions.enableFancyCloudHandling && okToHook(e.world.provider)) { - e.world.provider = new WorldProviderShim(e.world, e.world.provider); - } +// if (ModOptions.enableFancyCloudHandling && okToHook(e.world.provider)) { +// e.world.provider = new WorldProviderShim(e.world, e.world.provider); +// } } } diff --git a/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/Footsteps.java b/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/Footsteps.java index 0491d62..e397e72 100644 --- a/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/Footsteps.java +++ b/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/Footsteps.java @@ -67,9 +67,11 @@ public class Footsteps implements IResourceManagerReloadListener, IClientEffectH // System private PFResourcePackDealer dealer = new PFResourcePackDealer(); private PFIsolator isolator; + private boolean isFirstTime = true; public Footsteps() { INSTANCE = this; + this.isolator = new PFIsolator(); } public void reloadEverything() { @@ -205,8 +207,10 @@ public void onResourceManagerReload(final IResourceManager var1) { @Override public void process(World world, EntityPlayer player) { - if (this.isolator == null) + if (this.isFirstTime) { + this.isFirstTime = false; reloadEverything(); + } this.isolator.onFrame(); player.nextStepDistance = Integer.MAX_VALUE; } diff --git a/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/engine/implem/AcousticsLibrary.java b/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/engine/implem/AcousticsLibrary.java index a52f577..0a28976 100644 --- a/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/engine/implem/AcousticsLibrary.java +++ b/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/engine/implem/AcousticsLibrary.java @@ -36,7 +36,6 @@ import org.blockartistry.mod.DynSurround.client.footsteps.engine.interfaces.IOptions; import org.blockartistry.mod.DynSurround.client.footsteps.engine.interfaces.ISoundPlayer; import org.blockartistry.mod.DynSurround.client.footsteps.game.system.Association; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -60,7 +59,7 @@ public void playAcoustic(final Object location, final Association acousticName, @Override public void playAcoustic(final Object location, final String acousticName, final EventType event, final IOptions inputOptions) { - if(StringUtils.isEmpty(acousticName)) { + if (StringUtils.isEmpty(acousticName)) { ModLog.debug("Attempt to play acoustic with no name"); return; } diff --git a/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/game/system/PFReaderH.java b/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/game/system/PFReaderH.java index 28c7e1f..028b8b0 100644 --- a/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/game/system/PFReaderH.java +++ b/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/game/system/PFReaderH.java @@ -30,6 +30,7 @@ import org.blockartistry.mod.DynSurround.client.footsteps.mcpackage.interfaces.IIsolator; import org.blockartistry.mod.DynSurround.client.footsteps.mcpackage.interfaces.IVariator; import org.blockartistry.mod.DynSurround.client.footsteps.mcpackage.interfaces.IVariatorSettable; +import org.blockartistry.mod.DynSurround.util.MyUtils; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -89,11 +90,11 @@ protected boolean stoppedImmobile(float reference) { final float diff = lastReference - reference; lastReference = reference; if (!isImmobile && diff == 0f) { - timeImmobile = System.currentTimeMillis(); + timeImmobile = MyUtils.currentTimeMillis(); isImmobile = true; } else if (isImmobile && diff != 0f) { isImmobile = false; - return System.currentTimeMillis() - timeImmobile > VAR.IMMOBILE_DURATION; + return MyUtils.currentTimeMillis() - timeImmobile > VAR.IMMOBILE_DURATION; } return false; @@ -259,10 +260,10 @@ protected EventType speedDisambiguator(final EntityPlayer ply, final EventType w } private void simulateBrushes(final EntityPlayer ply) { - if (brushesTime > System.currentTimeMillis()) + if (brushesTime > MyUtils.currentTimeMillis()) return; - brushesTime = System.currentTimeMillis() + 100; + brushesTime = MyUtils.currentTimeMillis() + 100; if ((ply.motionX == 0d && ply.motionZ == 0d) || ply.isSneaking()) return; diff --git a/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/mcpackage/implem/AcousticsManager.java b/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/mcpackage/implem/AcousticsManager.java index aa5e948..e4d52df 100644 --- a/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/mcpackage/implem/AcousticsManager.java +++ b/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/mcpackage/implem/AcousticsManager.java @@ -39,6 +39,7 @@ import org.blockartistry.mod.DynSurround.client.footsteps.game.system.Association; import org.blockartistry.mod.DynSurround.client.footsteps.mcpackage.interfaces.IDefaultStepPlayer; import org.blockartistry.mod.DynSurround.client.footsteps.mcpackage.interfaces.IIsolator; +import org.blockartistry.mod.DynSurround.util.MyUtils; import org.blockartistry.mod.DynSurround.util.XorShiftRandom; import cpw.mods.fml.relauncher.Side; @@ -59,7 +60,7 @@ public class AcousticsManager extends AcousticsLibrary implements ISoundPlayer, private static final Random RANDOM = new XorShiftRandom(); private static final boolean USING_LATENESS = true; private static final boolean USING_EARLYNESS = true; - private static final float LATENESS_THRESHOLD_DIVIDER = 1.5f; + private static final float LATENESS_THRESHOLD_DIVIDER = 1.2f; private static final double EARLYNESS_THRESHOLD_POW = 0.75d; private final List pending = new ArrayList(); @@ -100,7 +101,7 @@ public void playSound(final Object location, final String soundName, final float } pending.add( - new PendingSound(location, soundName, volume, pitch, null, System.currentTimeMillis() + delay, + new PendingSound(location, soundName, volume, pitch, null, MyUtils.currentTimeMillis() + delay, options.hasOption(Option.SKIPPABLE) ? -1 : (Long) options.getOption(Option.DELAY_MAX))); } else { actuallyPlaySound((Entity) location, soundName, volume, pitch); @@ -129,11 +130,11 @@ public Random getRNG() { @Override public void think() { - if (pending.isEmpty() || System.currentTimeMillis() < minimum) + if (pending.isEmpty() || MyUtils.currentTimeMillis() < minimum) return; long newMinimum = Long.MAX_VALUE; - long time = System.currentTimeMillis(); + long time = MyUtils.currentTimeMillis(); Iterator iter = pending.iterator(); while (iter.hasNext()) { diff --git a/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/mcpackage/implem/BasicBlockMap.java b/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/mcpackage/implem/BasicBlockMap.java index 2c25bf7..2c306a8 100644 --- a/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/mcpackage/implem/BasicBlockMap.java +++ b/src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/mcpackage/implem/BasicBlockMap.java @@ -44,6 +44,7 @@ import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.strategy.IdentityHashingStrategy; import net.minecraft.block.Block; +import net.minecraft.init.Blocks; @SideOnly(Side.CLIENT) public class BasicBlockMap implements IBlockMap { @@ -112,6 +113,8 @@ public MacroEntry(final int meta, final String substrate, final String value) { } public BasicBlockMap() { + // Air is not an emitter, always! + this.put(Blocks.air, -1, null, "NOT_EMITTER"); } @Override @@ -168,7 +171,7 @@ public void register(final String key, final String value) { if (matcher.matches()) { final String blockName = matcher.group(1); final Block block = MCHelper.getBlockNameRaw(blockName); - if (block != null) { + if (block != null && block != Blocks.air) { final int meta = matcher.group(2) == null ? -1 : Integer.parseInt(matcher.group(2)); final String substrate = matcher.group(3); if (value.startsWith("#")) diff --git a/src/main/java/org/blockartistry/mod/DynSurround/client/hud/PotionHUD.java b/src/main/java/org/blockartistry/mod/DynSurround/client/hud/PotionHUD.java index 3d00e90..4546ff4 100644 --- a/src/main/java/org/blockartistry/mod/DynSurround/client/hud/PotionHUD.java +++ b/src/main/java/org/blockartistry/mod/DynSurround/client/hud/PotionHUD.java @@ -90,6 +90,10 @@ public void doRender(final RenderGameOverlayEvent event) { for (final Iterator iterator = collection.iterator(); iterator.hasNext(); guiTop += k) { final PotionEffect potioneffect = iterator.next(); final Potion potion = Potion.potionTypes[potioneffect.getPotionID()]; + + // Because mods can be silly... + if(potion == null) + continue; GL11.glColor4f(1.0F, 1.0F, 1.0F, ModOptions.potionHudTransparency); mc.getTextureManager().bindTexture(TEXTURE); diff --git a/src/main/java/org/blockartistry/mod/DynSurround/util/MyUtils.java b/src/main/java/org/blockartistry/mod/DynSurround/util/MyUtils.java index 1462736..4e6d57d 100644 --- a/src/main/java/org/blockartistry/mod/DynSurround/util/MyUtils.java +++ b/src/main/java/org/blockartistry/mod/DynSurround/util/MyUtils.java @@ -45,4 +45,8 @@ public static int[] splitToInts(final String str, final char splitChar) { return result; } + + public static long currentTimeMillis() { + return System.nanoTime() / 1000000L; + } } diff --git a/src/main/resources/assets/dsurround/data/footsteps/acoustics.json b/src/main/resources/assets/dsurround/data/footsteps/acoustics.json index 72e643a..b078404 100644 --- a/src/main/resources/assets/dsurround/data/footsteps/acoustics.json +++ b/src/main/resources/assets/dsurround/data/footsteps/acoustics.json @@ -1248,12 +1248,12 @@ "walk" : { "name" : "metalbar.metalbar_walk", "pitch_min" : 80, - "pitch_min" : 85 + "pitch_max" : 85 }, "wander": { "name" : "metalbar.metalbar_wander", "pitch_min" : 80, - "pitch_min" : 85 + "pitch_max" : 85 }, "land" : { "type" : "simultaneous", @@ -1261,14 +1261,14 @@ { "name" : "metalbar.metalbar_walk", "pitch_min" : 80, - "pitch_min" : 85 + "pitch_max" : 85 }, { "type" : "delayed", "delay" : 30, "name" : "metalbar.metalbar_walk", "pitch_min" : 80, - "pitch_min" : 85 + "pitch_max" : 85 } ] } diff --git a/src/main/resources/assets/dsurround/data/footsteps/blockmap.json b/src/main/resources/assets/dsurround/data/footsteps/blockmap.json index e0d10f2..89731ea 100644 --- a/src/main/resources/assets/dsurround/data/footsteps/blockmap.json +++ b/src/main/resources/assets/dsurround/data/footsteps/blockmap.json @@ -1,6 +1,5 @@ { "minecraft:barrier":"NOT_EMITTER", - "minecraft:air":"NOT_EMITTER", "minecraft:stone":"stone", "minecraft:grass":"grass", "minecraft:dirt":"dirt",