Search in sources :

Example 1 with DabHandler

use of cc.hyperium.handlers.handlers.animation.DabHandler in project Hyperium by HyperiumClient.

the class DabKeybind method onPress.

@Override
public void onPress() {
    DabHandler dabHandler = Hyperium.INSTANCE.getHandlers().getDabHandler();
    UUID uuid = (Minecraft.getMinecraft().getSession()).getProfile().getId();
    AbstractAnimationHandler.AnimationState currentState = dabHandler.get(uuid);
    NettyClient client = NettyClient.getClient();
    if (Settings.DAB_TOGGLE && currentState.isAnimating() && !wasPressed()) {
        currentState.setToggled(false);
        dabHandler.stopAnimation(uuid);
        if (client != null) {
            client.write(ServerCrossDataPacket.build(new JsonHolder().put("type", "dab_update").put("dabbing", false)));
        }
        return;
    }
    if (!wasPressed()) {
        currentState.setToggled(Settings.DAB_TOGGLE);
        dabHandler.startAnimation(uuid);
    }
    if (client != null) {
        client.write(ServerCrossDataPacket.build(new JsonHolder().put("type", "dab_update").put("dabbing", true)));
    }
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) NettyClient(cc.hyperium.netty.NettyClient) DabHandler(cc.hyperium.handlers.handlers.animation.DabHandler) AbstractAnimationHandler(cc.hyperium.handlers.handlers.animation.AbstractAnimationHandler) UUID(java.util.UUID)

Aggregations

AbstractAnimationHandler (cc.hyperium.handlers.handlers.animation.AbstractAnimationHandler)1 DabHandler (cc.hyperium.handlers.handlers.animation.DabHandler)1 NettyClient (cc.hyperium.netty.NettyClient)1 JsonHolder (cc.hyperium.utils.JsonHolder)1 UUID (java.util.UUID)1