Added Core Mod to redirect the Enchantment Rendering getSystemTime() calls to a the EnchantmentTimer (glow now slows down)

This commit is contained in:
Marius Metzger
2015-03-16 01:45:36 +01:00
parent 403d896862
commit 14f53f7429
31 changed files with 549 additions and 184 deletions

View File

@@ -0,0 +1,35 @@
package eu.crushedpixel.replaymod.timer;
import eu.crushedpixel.replaymod.replay.ReplayHandler;
import eu.crushedpixel.replaymod.replay.ReplayProcess;
public class EnchantmentTimer {
private static long lastRealTime = System.currentTimeMillis();
private static long lastFakeTime = System.currentTimeMillis();
private static long recordingTime = 0;
public static void resetRecordingTime() {
recordingTime = 0;
}
public static void increaseRecordingTime(long amount) {
recordingTime += amount;
}
public static long getEnchantmentTime() {
if(!(ReplayHandler.isInPath() && ReplayProcess.isVideoRecording())) {
if(ReplayHandler.isInReplay()) {
long timeDiff = System.currentTimeMillis() - lastRealTime;
double toAdd = timeDiff*ReplayHandler.getSpeed();
lastFakeTime = Math.round(lastFakeTime+toAdd);
lastRealTime = System.currentTimeMillis();
return lastFakeTime;
}
lastFakeTime = lastRealTime = System.currentTimeMillis();
return lastRealTime;
}
return recordingTime;
}
}