Fix mouse/keys not working when replay is paused

This commit is contained in:
johni0702
2015-10-04 19:02:11 +02:00
parent 526ee76d4a
commit 4d27875955
6 changed files with 251 additions and 3 deletions

View File

@@ -23,7 +23,6 @@ import eu.crushedpixel.replaymod.settings.EncodingPreset;
import eu.crushedpixel.replaymod.settings.RenderOptions;
import eu.crushedpixel.replaymod.settings.ReplaySettings;
import eu.crushedpixel.replaymod.sound.SoundHandler;
import eu.crushedpixel.replaymod.timer.ReplayTimer;
import eu.crushedpixel.replaymod.utils.OpenGLUtils;
import eu.crushedpixel.replaymod.utils.TooltipRenderer;
import eu.crushedpixel.replaymod.video.rendering.Pipelines;
@@ -177,8 +176,6 @@ public class ReplayMod {
@EventHandler
public void init(FMLInitializationEvent event) {
mc.timer = new ReplayTimer();
MinecraftForge.EVENT_BUS.register(guiEventHandler = new GuiEventHandler());
FMLCommonHandler.instance().bus().register(keyInputHandler);
@@ -447,4 +444,8 @@ public class ReplayMod {
System.exit(-1);
}
}
public Minecraft getMinecraft() {
return mc;
}
}

View File

@@ -0,0 +1,33 @@
package com.replaymod.core.utils;
import net.minecraft.util.Timer;
public class WrappedTimer extends Timer {
protected final Timer wrapped;
public WrappedTimer(Timer wrapped) {
super(0);
this.wrapped = wrapped;
copy(wrapped, this);
}
@Override
public void updateTimer() {
copy(this, wrapped);
wrapped.updateTimer();
copy(wrapped, this);
}
protected void copy(Timer from, Timer to) {
to.ticksPerSecond = from.ticksPerSecond;
to.lastHRTime = from.lastHRTime;
to.elapsedTicks = from.elapsedTicks;
to.renderPartialTicks = from.renderPartialTicks;
to.timerSpeed = from.timerSpeed;
to.elapsedPartialTicks = from.elapsedPartialTicks;
to.lastSyncSysClock = from.lastSyncSysClock;
to.lastSyncHRClock = from.lastSyncHRClock;
to.field_74285_i = from.field_74285_i;
to.timeSyncAdjustment = from.timeSyncAdjustment;
}
}