Search in sources :

Example 1 with TickEvent

use of cc.hyperium.event.client.TickEvent in project Hyperium by HyperiumClient.

the class MinigameListener method onTick.

@InvokeEvent
public void onTick(TickEvent event) {
    if (Minecraft.getMinecraft().theWorld != null && Hyperium.INSTANCE.getHandlers().getHypixelDetector().isHypixel() && Minecraft.getMinecraft().theWorld.getScoreboard() != null) {
        if (cooldown <= 0) {
            cooldown = 3 * 20;
            String minigameName = getScoreboardTitle();
            Arrays.stream(Minigame.values()).filter(m -> minigameName.equalsIgnoreCase(m.scoreName) && !minigameName.equalsIgnoreCase(currentMinigameName)).forEach(m -> {
                currentMinigameName = minigameName;
                EventBus.INSTANCE.post(new JoinMinigameEvent(m));
            });
        } else {
            cooldown--;
        }
    }
}
Also used : InvokeEvent(cc.hyperium.event.InvokeEvent) Arrays(java.util.Arrays) JoinMinigameEvent(cc.hyperium.event.network.server.hypixel.JoinMinigameEvent) Minecraft(net.minecraft.client.Minecraft) EventBus(cc.hyperium.event.EventBus) ChatColor(cc.hyperium.utils.ChatColor) TickEvent(cc.hyperium.event.client.TickEvent) Hyperium(cc.hyperium.Hyperium) JoinMinigameEvent(cc.hyperium.event.network.server.hypixel.JoinMinigameEvent) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 2 with TickEvent

use of cc.hyperium.event.client.TickEvent in project Hyperium by HyperiumClient.

the class HyperiumMinecraft method runTick.

public void runTick(Profiler mcProfiler) {
    mcProfiler.startSection("hyperium_tick");
    EventBus.INSTANCE.post(new TickEvent());
    mcProfiler.endSection();
}
Also used : TickEvent(cc.hyperium.event.client.TickEvent)

Aggregations

TickEvent (cc.hyperium.event.client.TickEvent)2 Hyperium (cc.hyperium.Hyperium)1 EventBus (cc.hyperium.event.EventBus)1 InvokeEvent (cc.hyperium.event.InvokeEvent)1 JoinMinigameEvent (cc.hyperium.event.network.server.hypixel.JoinMinigameEvent)1 ChatColor (cc.hyperium.utils.ChatColor)1 Arrays (java.util.Arrays)1 Minecraft (net.minecraft.client.Minecraft)1