public static boolean resetting;
public static boolean preattack;
public void attackEntity(PlayerEntity playerIn, Entity targetEntity) {
if (Manager.FUNCTION_MANAGER.auraFunction.sprintMode.is("Легитный") && Manager.FUNCTION_MANAGER.auraFunction.state && Manager.FUNCTION_MANAGER.auraFunction.target != null) {
preattack = true;
}
this.syncCurrentPlayItem();
if (Manager.FUNCTION_MANAGER.auraFunction.sprintMode.is("Легитный") && Manager.FUNCTION_MANAGER.auraFunction.state && Manager.FUNCTION_MANAGER.auraFunction.target != null) {
if (mc.player.isSprinting()) {
resetting = true;
if (!mc.player.isSwimming()) {
mc.player.serverSprintState = false;
mc.player.setSprinting(false);
mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));
}
}
}
this.connection.sendPacket(new CUseEntityPacket(targetEntity, playerIn.isSneaking()));
if (this.currentGameType != GameType.SPECTATOR) {
playerIn.attackTargetEntityWithCurrentItem(targetEntity);
playerIn.resetCooldown();
}
if (Manager.FUNCTION_MANAGER.auraFunction.sprintMode.is("Легитный") && Manager.FUNCTION_MANAGER.auraFunction.state && Manager.FUNCTION_MANAGER.auraFunction.target != null) {
final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
scheduledExecutorService.schedule(() -> {
if (preattack) {
preattack = false;
}
},40, TimeUnit.MILLISECONDS);
scheduledExecutorService.schedule(() -> {
if (resetting) {
resetting = false;
}
},80, TimeUnit.MILLISECONDS);
}
EventAttack event = new EventAttack(targetEntity);
EventManager.call(event);
}