Search in sources :

Example 1 with FlossDanceHandler

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

the class FlossKeybind method onPress.

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

Aggregations

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