use of cc.hyperium.handlers.handlers.animation.TPoseHandler in project Hyperium by HyperiumClient.
the class TPoseKeybind method onPress.
@Override
public void onPress() {
TPoseHandler tPoseHandler = Hyperium.INSTANCE.getHandlers().getTPoseHandler();
UUID uuid = (Minecraft.getMinecraft().getSession()).getProfile().getId();
AbstractAnimationHandler.AnimationState currentState = tPoseHandler.get(uuid);
tPoseToggled = !Settings.TPOSE_TOGGLE_MODE || !tPoseToggled;
NettyClient client = NettyClient.getClient();
if (Settings.TPOSE_TOGGLE_MODE) {
currentState.setToggled(tPoseToggled);
if (tPoseToggled)
tPoseHandler.startAnimation(uuid);
else
tPoseHandler.stopAnimation(uuid);
if (client != null) {
client.write(ServerCrossDataPacket.build(new JsonHolder().put("type", "tpose_update").put("posing", tPoseToggled)));
}
return;
}
if (Settings.TPOSE_TOGGLE && currentState.isAnimating() && !wasPressed()) {
currentState.setToggled(false);
tPoseHandler.stopAnimation(uuid);
if (client != null) {
client.write(ServerCrossDataPacket.build(new JsonHolder().put("type", "tpose_update").put("posing", false)));
}
return;
}
if (!wasPressed()) {
currentState.setToggled(Settings.TPOSE_TOGGLE);
tPoseHandler.startAnimation(uuid);
}
if (client != null) {
client.write(ServerCrossDataPacket.build(new JsonHolder().put("type", "tpose_update").put("posing", true)));
}
}
Aggregations