Update to MC 1.14 / Fabric
This commit is contained in:
@@ -1,20 +1,10 @@
|
||||
package com.replaymod.pathing.player;
|
||||
|
||||
import com.replaymod.core.utils.WrappedTimer;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
import net.minecraft.util.Timer;
|
||||
|
||||
//#if MC>=10800
|
||||
//#if MC>=11300
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
//#else
|
||||
//$$ import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
//#endif
|
||||
//#else
|
||||
//$$ import cpw.mods.fml.common.eventhandler.Event;
|
||||
//#endif
|
||||
|
||||
import static com.replaymod.core.versions.MCVer.*;
|
||||
|
||||
/**
|
||||
* Wrapper around the current timer that prevents the timer from advancing by itself.
|
||||
*/
|
||||
@@ -30,7 +20,12 @@ public class ReplayTimer extends WrappedTimer {
|
||||
}
|
||||
|
||||
@Override
|
||||
// This should be handled by Remap but it isn't (was handled before a9724e3).
|
||||
//#if MC>=11400
|
||||
//$$ public void beginRenderTick(
|
||||
//#else
|
||||
public void updateTimer(
|
||||
//#endif
|
||||
//#if MC>=11300
|
||||
long sysClock
|
||||
//#endif
|
||||
@@ -42,13 +37,20 @@ public class ReplayTimer extends WrappedTimer {
|
||||
//#endif
|
||||
); // Update current state
|
||||
copy(state, this); // Restore our old state
|
||||
FML_BUS.post(new UpdatedEvent());
|
||||
UpdatedCallback.EVENT.invoker().onUpdate();
|
||||
}
|
||||
|
||||
public Timer getWrapped() {
|
||||
return wrapped;
|
||||
}
|
||||
|
||||
public static class UpdatedEvent extends Event {
|
||||
public interface UpdatedCallback {
|
||||
Event<UpdatedCallback> EVENT = EventFactory.createArrayBacked(UpdatedCallback.class,
|
||||
(listeners) -> () -> {
|
||||
for (UpdatedCallback listener : listeners) {
|
||||
listener.onUpdate();
|
||||
}
|
||||
});
|
||||
void onUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user