import com.google.common.eventbus.Subscribe;
import im.arixxx.events.AttackEvent;
import im.arixxx.events.EventMotion;
import im.arixxx.events.EventUpdate;
import im.arixxx.functions.api.Category;
import im.arixxx.functions.api.Function;
import im.arixxx.functions.api.FunctionRegister;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.network.play.client.CPlayerPacket;
import net.minecraft.network.play.client.CPlayerTryUseItemPacket;
import net.minecraft.util.Hand;
@FunctionRegister(name = "Criticals", type = Category.Combat, desc = "Криты с места")
public class Criticals extends Function {
@Subscribe
private void onAttack(AttackEvent e) {
ClientPlayerEntity player = mc.player;
if (player.isOnGround()) {
mc.getConnection().sendPacket(new CPlayerPacket.PositionRotationPacket(player.getPosX(), player.getPosY() + 1e-8, player.getPosZ(), player.rotationYaw, player.rotationPitch,false));
mc.getConnection().sendPacket(new CPlayerPacket.PositionRotationPacket(player.getPosX(), player.getPosY() - 1e-9, player.getPosZ(), player.rotationYaw, player.rotationPitch, false));
if (!player.isHandActive()) {
mc.getConnection().sendPacket(new CPlayerTryUseItemPacket(Hand.OFF_HAND));
mc.playerController.onStoppedUsingItem(player);
}
} else {
mc.getConnection().sendPacket(new CPlayerPacket.PositionRotationPacket(player.getPosX(), player.getPosY() - 1e-9, player.getPosZ(), player.rotationYaw, player.rotationPitch, false));
if (!player.isHandActive()) {
mc.getConnection().sendPacket(new CPlayerTryUseItemPacket(Hand.OFF_HAND));
mc.playerController.onStoppedUsingItem(player);
}
}
}
}