From a0ff501947a84b268e099524a06b56a6b900dad2 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Tue, 3 May 2022 18:25:32 +0200 Subject: move to cc.polyfrost --- .../io/polyfrost/oneconfig/utils/TickDelay.java | 40 ---------------------- 1 file changed, 40 deletions(-) delete mode 100644 src/main/java/io/polyfrost/oneconfig/utils/TickDelay.java (limited to 'src/main/java/io/polyfrost/oneconfig/utils/TickDelay.java') diff --git a/src/main/java/io/polyfrost/oneconfig/utils/TickDelay.java b/src/main/java/io/polyfrost/oneconfig/utils/TickDelay.java deleted file mode 100644 index 0babff1..0000000 --- a/src/main/java/io/polyfrost/oneconfig/utils/TickDelay.java +++ /dev/null @@ -1,40 +0,0 @@ -package io.polyfrost.oneconfig.utils; - -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; - -public class TickDelay { - private int delay; - private final Runnable function; - - public TickDelay(Runnable functionName, int ticks) { - register(); - delay = ticks; - function = functionName; - } - - @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent event) { - if (event.phase == TickEvent.Phase.START) { - // Delay expired - if (delay < 1) { - run(); - destroy(); - } - delay--; - } - } - - private void destroy() { - MinecraftForge.EVENT_BUS.unregister(this); - } - - private void register() { - MinecraftForge.EVENT_BUS.register(this); - } - - private void run() { - function.run(); - } -} -- cgit