Fix (character, portal, enchantment) animations during speed up / slowed down path playback and rendering
This commit is contained in:
32
src/main/java/com/replaymod/pathing/player/ReplayTimer.java
Normal file
32
src/main/java/com/replaymod/pathing/player/ReplayTimer.java
Normal 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 {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user