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)));
}
}
Aggregations