Skip to content

Commit

Permalink
Handfull of fixes based on new work
Browse files Browse the repository at this point in the history
  • Loading branch information
OreCruncher committed Jan 13, 2017
1 parent c052730 commit 8adac3f
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
// }
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<PendingSound> pending = new ArrayList<PendingSound>();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<PendingSound> iter = pending.iterator();
while (iter.hasNext()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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("#"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ public void doRender(final RenderGameOverlayEvent event) {
for (final Iterator<PotionEffect> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ public static int[] splitToInts(final String str, final char splitChar) {

return result;
}

public static long currentTimeMillis() {
return System.nanoTime() / 1000000L;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1248,27 +1248,27 @@
"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",
"array" : [
{
"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
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"minecraft:barrier":"NOT_EMITTER",
"minecraft:air":"NOT_EMITTER",
"minecraft:stone":"stone",
"minecraft:grass":"grass",
"minecraft:dirt":"dirt",
Expand Down

0 comments on commit 8adac3f

Please sign in to comment.