Fix (character, portal, enchantment) animations during speed up / slowed down path playback and rendering

This commit is contained in:
johni0702
2016-09-02 12:50:18 +02:00
parent 8d1a3f28d1
commit 0691ef9886
11 changed files with 107 additions and 74 deletions

View File

@@ -0,0 +1,32 @@
package com.replaymod.pathing.player;
import com.replaymod.core.utils.WrappedTimer;
import net.minecraft.util.Timer;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* Wrapper around the current timer that prevents the timer from advancing by itself.
*/
public class ReplayTimer extends WrappedTimer {
private final Timer state = new Timer(0);
public ReplayTimer(Timer wrapped) {
super(wrapped);
}
@Override
public void updateTimer() {
copy(this, state); // Save our current state
super.updateTimer(); // Update current state
copy(state, this); // Restore our old state
FMLCommonHandler.instance().bus().post(new UpdatedEvent());
}
public Timer getWrapped() {
return wrapped;
}
public static class UpdatedEvent extends Event {
}
}