diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-03 18:25:32 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-03 18:25:32 +0200 |
commit | a0ff501947a84b268e099524a06b56a6b900dad2 (patch) | |
tree | db27ca1b28dbc7e57b8c99f54c80732d3042e856 /src/main/java/io/polyfrost/oneconfig/utils/TickDelay.java | |
parent | b798930b21b89b81be05a31281f768667a6dd7f3 (diff) | |
download | OneConfig-a0ff501947a84b268e099524a06b56a6b900dad2.tar.gz OneConfig-a0ff501947a84b268e099524a06b56a6b900dad2.tar.bz2 OneConfig-a0ff501947a84b268e099524a06b56a6b900dad2.zip |
move to cc.polyfrost
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/utils/TickDelay.java')
-rw-r--r-- | src/main/java/io/polyfrost/oneconfig/utils/TickDelay.java | 40 |
1 files changed, 0 insertions, 40 deletions
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(); - } -} |