Вопрос Коррекция движения на 1.12.2

  • Автор темы Автор темы Valzer
  • Дата начала Дата начала
Начинающий
Начинающий
Статус
Оффлайн
Регистрация
30 Июн 2023
Сообщения
26
Реакции
0

Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:

  • бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
  • маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
  • приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
  • обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.

Спасибо!

Спастил коррекцию движения на 1.12.2 базу с 1.16.5, но она не работает.


Код:
Expand Collapse Copy
package wtf.vilz.client.module.impl.combat;

import com.darkmagician6.eventapi.EventTarget;

import java.util.*;

import wtf.vilz.client.Vilz;
import wtf.vilz.client.event.input.EventInput;
import wtf.vilz.client.module.Module;
import wtf.vilz.client.event.player.EventMotion;
import wtf.vilz.client.event.player.EventUpdate;
import wtf.vilz.client.module.Category;
import wtf.vilz.client.module.ModuleAnnotation;
import wtf.vilz.client.module.setting.impl.BooleanSetting;
import wtf.vilz.client.module.setting.impl.ModeSetting;
import wtf.vilz.client.module.setting.impl.MultiBooleanSetting;
import wtf.vilz.client.module.setting.impl.NumberSetting;
import wtf.vilz.client.utility.math.GCDFixUtility;
import wtf.vilz.client.utility.math.RayCastUtility;
import wtf.vilz.client.utility.math.RotationUtility;
import wtf.vilz.client.utility.move.MoveUtils;
import wtf.vilz.client.utility.move.MovementUtility;
import wtf.vilz.client.utility.player.InventoryUtility;
import net.minecraft.block.BlockAir;
import net.minecraft.block.BlockLiquid;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityOtherPlayerMP;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.monster.EntityGolem;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.*;
import net.minecraft.network.play.client.CPacketEntityAction;
import net.minecraft.network.play.client.CPacketHeldItemChange;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import org.lwjgl.util.vector.Vector2f;
import wtf.vilz.client.utility.player.PlayerUtils;

@ModuleAnnotation(name="KillAura", category=Category.COMBAT)
public class KillAura extends Module {
    public static EntityLivingBase targetEntity;
    private boolean targetVisible;
    public boolean thisContextRotatedBefore;
    public float prevAdditionYaw;
    public static Vector2f rotation = new Vector2f();
    float minCPS = 0.0F;
    public ModeSetting rotationMode = new ModeSetting("Rotation", "Matrix", new String[]{"Matrix", "Intave", "Grim"});
    public static NumberSetting range = new NumberSetting("Range", 3.5F, 1.0F, 4.0F, 0.1F);
    public static NumberSetting rotateRange = new NumberSetting("Rotate Range", 0.5F, 0.0F, 20.0F, 0.1F);
    public static BooleanSetting elrot = new BooleanSetting("Elytra Rotation", false);
    public static NumberSetting elrotRange = new NumberSetting("Elytra Distance", 0.5F, 0.0F, 50.0F, 0.1F, () -> elrot.get());
    private Entity selectedEntity;
    public MultiBooleanSetting targetSelectionSetting = new MultiBooleanSetting("Targets Selection", Arrays.asList("Players", "Mobs", "Animals", "NPC | Bots"));
    public ModeSetting sortBy = new ModeSetting("Sort By", "All", new String[]{"All", "Distance", "Health", "Best Armor", "Worst Armor", "FOV"});
    public BooleanSetting weaponOnly = new BooleanSetting("Weapon Only", false);
    public BooleanSetting pauseOnUse = new BooleanSetting("Pause On Use", false);
    public BooleanSetting wallsBypass = new BooleanSetting("Walls Bypass", true);
    public BooleanSetting onlyCritical = new BooleanSetting("Only Critical", true);
    final ModeSetting correctionType = new ModeSetting("Тип коррекции", "Незаметный", "Незаметный", "Сфокусированный");
    public static BooleanSetting sprint = new BooleanSetting("Sprint Reset", false);
    public static BooleanSetting ShieldBypass = new BooleanSetting("ShieldBypass", false);
    public BooleanSetting spaceOnly;
    public Vector2f rotateVector = new Vector2f(0.0F, 0.0F);
    public BooleanSetting waterCritical;
    public BooleanSetting shieldDesync;
    public BooleanSetting breakShield;
    private int ticks = 0;
    boolean isRotated;
    float lastYaw;
    float lastPitch;
    public static EntityLivingBase target;
    @EventTarget
    public void onInput(EventInput eventInput) {
        if (targetEntity != null
                && this.correctionType.is("Незаметный")
                && mc.player != null
                && !mc.player.isElytraFlying()
                && Vilz.getInstance().getModuleManager().getFreeCam().player == null) {
            MoveUtils.fixMovement(eventInput, this.rotateVector.x);
        }
    }
    public KillAura() {
        BooleanSetting var10005 = this.onlyCritical;
        Objects.requireNonNull(var10005);
        Objects.requireNonNull(var10005);
        this.spaceOnly = new BooleanSetting("Space Only", false, var10005::get);
        Objects.requireNonNull(var10005);
        Objects.requireNonNull(var10005);
        this.waterCritical = new BooleanSetting("Water Critical", true, var10005::get);
        this.shieldDesync = new BooleanSetting("Shield Desync", false);
        this.breakShield = new BooleanSetting("Break Shield", true);
    }

    @EventTarget
    public void onUpdateAura(EventUpdate eventUpdate) {
        this.resolvePlayers();
        this.onAura();
        this.releaseResolver();
    }

    @EventTarget
    public void onMotion(EventMotion eventMotion) {
        if (targetEntity != null && this.weaponOnly()) {
            float yaw = rotation.x;
            float pitch = rotation.y;
            Minecraft var10000 = mc;
            Minecraft.player.rotationYawHead = yaw;
            var10000 = mc;
            Minecraft.player.renderYawOffset = PlayerUtils.calculateCorrectYawOffset(yaw);
            var10000 = mc;
            Minecraft.player.rotationPitchHead = pitch;
            eventMotion.setYaw(yaw);
            eventMotion.setPitch(pitch);
        }
    }

    public void onDisable() {
        targetEntity = null;
        Minecraft var10000 = mc;
        if (Minecraft.player != null) {
            Minecraft var10001 = mc;
            rotation.x = Minecraft.player.rotationYaw;
            var10001 = mc;
            rotation.y = Minecraft.player.rotationPitch;
        }
        this.ticks = 0;
        super.onDisable();
    }

    public void onAura() {
        if (this.shieldDesync.get()) {
            Minecraft var10000 = mc;
            if (Minecraft.player.isHandActive()) {
                var10000 = mc;
                if (Minecraft.player.isActiveItemStackBlocking(4 + (new Random()).nextInt(4))) {
                    var10000 = mc;
                    Minecraft var10001 = mc;
                    Minecraft.playerController.onStoppedUsingItem(Minecraft.player);
                }
            }
        }

        if (this.minCPS > 0.0F) {
            --this.minCPS;
        }

        if (targetEntity != null && !this.isValidTarget(targetEntity)) {
            targetEntity = null;
        }

        if (targetEntity == null) {
            targetEntity = this.findTarget();
        }

        if (targetEntity == null) {
            rotation.x = Minecraft.player.rotationYaw;
            rotation.y = Minecraft.player.rotationPitch;
        } else if (this.weaponOnly()) {
            this.thisContextRotatedBefore = false;
            this.attackMethod(targetEntity);
            if (!this.thisContextRotatedBefore) {
                this.getVectorRotation(targetEntity, false);
            }
        }
    }

    public void attackMethod(EntityLivingBase entity) {
        if (this.whenFalling() && this.minCPS == 0.0F && this.getHitBox(entity, (double)range.get()) != null) {
            if (this.pauseOnUse.get() && Minecraft.player.isHandActive()) {
                return;
            }

            this.getVectorRotation(entity, true);
            if (ShieldBypass.get() && Minecraft.player.isActiveItemStackBlocking()) {
                Minecraft.playerController.onStoppedUsingItem(Minecraft.player);
            }

            if (sprint.get()) {
                if (Minecraft.player.serverSprintState && !Minecraft.player.onGround) {
                    Minecraft.player.connection.sendPacket(new CPacketEntityAction(Minecraft.player, CPacketEntityAction.Action.STOP_SPRINTING));
                    Minecraft.player.serverSprintState = false;
                    Minecraft.player.setFlag(3, false);
                }
            } else {
                Minecraft.player.connection.sendPacket(new CPacketEntityAction(Minecraft.player, CPacketEntityAction.Action.STOP_SPRINTING));
            }

            this.minCPS = 10.0F;
            Minecraft.playerController.attackEntity(Minecraft.player, targetEntity);
            Minecraft.player.swingArm(EnumHand.MAIN_HAND);
            Minecraft.player.resetCooldown();
            this.breakShieldMethod((EntityPlayer)entity);
        }
    }

    public void shieldBreaker(EntityPlayer base) {
        Minecraft var10000 = mc;
        Minecraft var10001 = mc;
        Minecraft.playerController.attackEntity(Minecraft.player, base);
        var10000 = mc;
        Minecraft.player.swingArm(EnumHand.MAIN_HAND);
    }

    public void getVectorRotation(EntityLivingBase entity, boolean attackContext) {
        float var43;
        label83: {
            if (elrot.get()) {
                Minecraft var10000 = mc;
                if (Minecraft.player.isElytraFlying()) {
                    var43 = elrotRange.get();
                    break label83;
                }
            }
            var43 = 0.0F;
        }

        float rotateRangeValue = var43;
        float rangeValue = range.get() + rotateRangeValue;
        this.thisContextRotatedBefore = true;
        Vec3d var44 = new Vec3d(entity.posX, entity.posY, entity.posZ);
        Minecraft var10002 = mc;
        double var46 = Minecraft.player.posY - entity.posY;
        double var10004 = (double)entity.height;
        Minecraft var10005 = mc;
        var44 = var44.add((double)0.0F, MathHelper.clamp(var46, (double)0.0F, var10004 * (Minecraft.player.getPositionEyes(1.0F).distanceTo(new Vec3d(entity.posX, entity.posY + (double)(entity.height / 2.0F), entity.posZ)) / (double)rangeValue)), (double)0.0F);
        Minecraft var10003 = mc;
        double var47 = Minecraft.player.posX;
        Minecraft var48 = mc;
        var10005 = mc;
        double var49 = Minecraft.player.posY + (double)Minecraft.player.getEyeHeight();
        var10005 = mc;
        Vec3d vec3d = var44.subtract(new Vec3d(var47, var49, Minecraft.player.posZ));
        Vec3d vec = this.getHitBox(entity, (double)rangeValue);
        if (vec == null) {
            vec = entity.getPositionEyes(1.0F);
        }

        double x = vec.x - Minecraft.player.posX;
        double y = vec.y - Minecraft.player.getPositionEyes(1.0F).y;
        double z = vec.z - Minecraft.player.posZ;
        double dst = Math.sqrt(Math.pow(x, (double)2.0F) + Math.pow(z, (double)2.0F));
        float yawToTarget = (float)MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(z, x)) - (double)90.0F);
        float pitchToTarget = (float)(-Math.toDegrees(Math.atan2(y, dst)));
        float yawToTarget1 = (float)MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec3d.z, vec3d.x)) - (double)90.0F);
        float pitchToTarget1 = (float)(-Math.toDegrees(Math.atan2(vec3d.y, Math.hypot(vec3d.x, vec3d.z))));
        float yawDelta32 = MathHelper.wrapDegrees(yawToTarget1 - rotation.x);
        float pitchDelta32 = MathHelper.wrapDegrees(pitchToTarget1 - rotation.y);
        int roundYawDelta = (int)Math.abs(yawDelta32);
        int roundPitchDelta = (int)Math.abs(pitchDelta32);
        if (this.wallsBypass.get() && this.targetVisible && !attackContext) {
            yawToTarget = (float)((double)yawToTarget + (double)20.0F);
        }

        switch (this.rotationMode.get()) {
            case "Intave":
                float maxYawChange = Math.min(Math.max((float)roundYawDelta * 0.8F, 1.0F), 60.0F);
                float maxPitchChange = Math.min(Math.max((float)roundPitchDelta * 0.5F, 0.5F), 30.0F);
                float randomYawOffset = (float)(Math.random() * 0.2 - 0.1);
                float randomPitchOffset = (float)(Math.random() * 0.15 - 0.075);

                if (Math.abs(maxYawChange - this.lastYaw) < 2.0F) {
                    maxYawChange = this.lastYaw + (float)(Math.random() * (double)2.0F + (double)2.0F);
                }
                if (Math.abs(maxPitchChange - this.lastPitch) < 1.0F) {
                    maxPitchChange = this.lastPitch + (float)(Math.random() * (double)1.0F + (double)1.0F);
                }

                float yaw = rotation.x + (yawDelta32 > 0.0F ? maxYawChange : -maxYawChange) + randomYawOffset;
                float pitch = MathHelper.clamp(rotation.y + (pitchDelta32 > 0.0F ? maxPitchChange : -maxPitchChange) + randomPitchOffset, -89.0F, 89.0F);

                this.rotateVector.x = yaw;
                this.rotateVector.y = pitch;

                float gcd = GCDFixUtility.getGCDValue();
                yaw -= (yaw - rotation.x) % gcd;
                pitch -= (pitch - rotation.y) % gcd;
                rotation = new Vector2f(yaw, pitch);
                this.lastYaw = maxYawChange;
                this.lastPitch = maxPitchChange;
                break;

            case "Matrix":
                float yawToTarget2 = MathHelper.wrapDegrees(yawToTarget);
                float yawDelta23 = MathHelper.wrapDegrees(yawToTarget2 - rotation.x);
                int yawDeltaAbs = (int)Math.abs(yawDelta23);
                float f2 = pitchToTarget - rotation.y;
                float pitchDeltaAbs = Math.abs(f2);
                float additionYaw = (float)Math.min(Math.max(yawDeltaAbs, 1), 80);
                float additionPitch = Math.max(attackContext && targetEntity != null ? pitchDeltaAbs : 1.0F, 2.0F);

                if (Math.abs(additionYaw - this.prevAdditionYaw) <= 3.0F) {
                    additionYaw = this.prevAdditionYaw + 3.1F;
                }

                float f3 = rotation.x + (yawDelta23 > 0.0F ? additionYaw : -additionYaw) * 1.0001F;
                float f4 = MathHelper.clamp(rotation.y + (f2 > 0.0F ? additionPitch : -additionPitch) * 1.0001F, -90.0F, 90.0F);

                this.rotateVector.x = f3;
                this.rotateVector.y = f4;

                rotation.x = f3;
                rotation.y = f4;
                this.prevAdditionYaw = additionYaw;
                break;

            case "Grim":
                this.rotateVector.x = yawToTarget;
                this.rotateVector.y = pitchToTarget;

                rotation.x = yawToTarget;
                rotation.y = pitchToTarget;
                break;
        }
    }

    public boolean ignoreWalls() {
        Minecraft var10002 = mc;
        Minecraft var10003 = mc;
        Minecraft var10004 = mc;
        new BlockPos(Minecraft.player.lastReportedPosX, Minecraft.player.lastReportedPosY, Minecraft.player.lastReportedPosZ);
        return true;
    }

    public boolean whenFalling() {
        Minecraft mc = Minecraft.getMinecraft();
        boolean critWater = false;

        if (this.waterCritical.get()) {
            if (mc.world.getBlockState(new BlockPos(mc.player.posX, mc.player.posY, mc.player.posZ)).getBlock() instanceof BlockLiquid) {
                double var5 = mc.player.posY + 1.0;
                if (mc.world.getBlockState(new BlockPos(mc.player.posX, var5, mc.player.posZ)).getBlock() instanceof BlockAir) {
                    critWater = true;
                }
            }
        }

        boolean reason = mc.player.isPotionActive(MobEffects.BLINDNESS) ||
                mc.player.isOnLadder() ||
                (mc.player.isInWater() && !critWater) ||
                mc.player.isInWeb ||
                mc.player.capabilities.isFlying;

        if (mc.player.getCooledAttackStrength(1.5F) < 0.93F) {
            return false;
        }

        if (this.spaceOnly.get() && !mc.gameSettings.keyBindJump.isKeyDown()) {
            return false;
        }

        if (this.onlyCritical.get() && !reason) {
            if (MovementUtility.isBlockAboveHead()) {
                if (mc.player.onGround && mc.player.fallDistance > 0.0F) {
                    return true;
                }
            }
            if (!mc.player.onGround && mc.player.fallDistance > 0.0F) {
                return true;
            }
            return false;
        }

        return true;
    }

    public void breakShieldMethod(EntityPlayer entity) {
        if (entity.isActiveItemStackBlocking()) {
            int invSlot = InventoryUtility.getAxeInInventory(false);
            int hotBarSlot = InventoryUtility.getAxeInInventory(true);
            if (hotBarSlot != -1) {
                Minecraft var10000 = mc;
                Minecraft.player.connection.sendPacket(new CPacketHeldItemChange(hotBarSlot));
                var10000 = mc;
                Minecraft var10001 = mc;
                Minecraft.playerController.attackEntity(Minecraft.player, entity);
                var10000 = mc;
                Minecraft.player.swingArm(EnumHand.MAIN_HAND);
                var10000 = mc;
                Minecraft var10003 = mc;
                Minecraft.player.connection.sendPacket(new CPacketHeldItemChange(Minecraft.player.inventory.currentItem));
            }
        }
    }

    public boolean weaponOnly() {
        if (!this.weaponOnly.get()) {
            return true;
        } else {
            Minecraft var10000 = mc;
            boolean var2;
            if (!(Minecraft.player.getHeldItemMainhand().getItem() instanceof ItemSword)) {
                Minecraft var1 = mc;
                if (!(Minecraft.player.getHeldItemMainhand().getItem() instanceof ItemAxe)) {
                    var2 = false;
                    return var2;
                }
            }
            var2 = true;
            return var2;
        }
    }

    public EntityLivingBase findTarget() {
        ArrayList<EntityLivingBase> entity = new ArrayList<EntityLivingBase>();
        for (Entity player : KillAura.mc.world.loadedEntityList) {
            if (!(player instanceof EntityLivingBase)) continue;
            if (this.isValidTarget((EntityLivingBase)player)) {
                entity.add((EntityLivingBase)player);
                continue;
            }
            entity.remove(player);
        }
        String mode = this.sortBy.get();
        if (mode.equals("All")) {
            entity.sort(Comparator.comparingDouble(EntityLivingBase::getTotalArmorValue).thenComparing((entity1, entity2) -> (int)(entity1.getHealth() - entity2.getHealth())).thenComparing(Minecraft.player::getDistance));
        } else if (mode.equals("Distance")) {
            entity.sort(Comparator.comparingDouble(Minecraft.player::getDistance));
        } else if (mode.equalsIgnoreCase("FOV")) {
            entity.sort(Comparator.comparingDouble(this::getFov));
        } else if (mode.equalsIgnoreCase("Health")) {
            entity.sort((entity1, entity2) -> (int)(entity1.getHealth() - entity2.getHealth()));
        } else if (mode.equalsIgnoreCase("Best Armor")) {
            entity.sort(Comparator.comparing(EntityLivingBase::getTotalArmorValue).reversed());
        } else if (mode.equalsIgnoreCase("Worst Armor")) {
            entity.sort(Comparator.comparing(EntityLivingBase::getTotalArmorValue));
        }
        return entity.isEmpty() ? null : (EntityLivingBase)entity.get(0);
    }

    public float getFov(EntityLivingBase entity) {
        Minecraft var10001 = mc;
        double diffX = entity.posX - Minecraft.player.posX;
        var10001 = mc;
        double diffZ = entity.posZ - Minecraft.player.posZ;
        double angle = Math.toDegrees(Math.atan2(diffZ, diffX)) - (double)90.0F;
        var10001 = mc;
        return (float)Math.abs(MathHelper.wrapDegrees(angle - (double)Minecraft.player.rotationYaw));
    }

    public boolean isValidTarget(EntityLivingBase e) {
        Minecraft var10001 = mc;
        if (e != Minecraft.player && !e.isDead && !(e.getHealth() <= 0.0F) && !(e instanceof EntityArmorStand) && !Vilz.getInstance().getFriendManager().isFriend(e.getName()) && (!(e instanceof EntityPlayer) || !AntiBot.bots.contains(e) || this.targetSelectionSetting.get(3)) && (!(e instanceof EntityPlayer) || !((EntityPlayer)e).isBot || this.targetSelectionSetting.get(3)) && (!(e instanceof EntityPlayer) || this.targetSelectionSetting.get(0)) && (!(e instanceof EntityMob) || this.targetSelectionSetting.get(1)) && (!(e instanceof EntityAnimal) && !(e instanceof EntityGolem) && !(e instanceof EntitySquid) && !(e instanceof EntityVillager) || this.targetSelectionSetting.get(2))) {
            if (!this.ignoreWalls() && elrot.get()) {
                Minecraft var10000 = mc;
                if (Minecraft.player.isElytraFlying()) {
                    return this.getHitBox(e, (double)(range.get() + elrotRange.get())) != null;
                }
            }
            if (!this.ignoreWalls()) {
                return this.getHitBox(e, (double)(range.get() + rotateRange.get())) != null;
            } else {
                var10001 = mc;
                float var2 = e.getDistance(Minecraft.player);
                float var5;
                if (elrot.get()) {
                    Minecraft var4 = mc;
                    if (Minecraft.player.isElytraFlying()) {
                        var5 = range.get() + elrotRange.get();
                        return var2 <= var5;
                    }
                }
                var5 = range.get() + rotateRange.get();
                return var2 <= var5;
            }
        } else {
            return false;
        }
    }

    public Vec3d getHitBox(Entity entity, double rotateDistance) {
        if (entity.getDistanceSq(entity) >= 36.0) {
            return null;
        }
        Vec3d head = KillAura.findHitboxCoord(Hitbox.HEAD, entity);
        Vec3d chest = KillAura.findHitboxCoord(Hitbox.CHEST, entity);
        Vec3d legs = KillAura.findHitboxCoord(Hitbox.LEGS, entity);
        ArrayList<Vec3d> points = new ArrayList<Vec3d>(Arrays.asList(head, chest, legs));
        points.removeIf(point -> {
            this.targetVisible = !this.isHitBoxVisible(entity, (Vec3d)point, rotateDistance);
            return this.targetVisible;
        });
        if (points.isEmpty()) {
            return null;
        }
        points.sort((d1, d2) -> {
            Vector2f r1 = RotationUtility.getDeltaForCoord(rotation, d1);
            Vector2f r2 = RotationUtility.getDeltaForCoord(rotation, d2);
            float y1 = Math.abs(r1.y);
            float y2 = Math.abs(r2.y);
            return (int)((y1 - y2) * 1000.0f);
        });
        return points.get(0);
    }

    public static Vec3d findHitboxCoord(Hitbox box, Entity target) {
        double yCoord = 0.0;
        switch (box) {
            case HEAD: {
                yCoord = target.getEyeHeight();
                break;
            }
            case CHEST: {
                yCoord = target.getEyeHeight() / 2.0f;
                break;
            }
            case LEGS: {
                yCoord = 0.05;
            }
        }
        return target.getPositionVector().add(0.0, yCoord, 0.0);
    }

    public boolean isHitBoxVisible(Entity target, Vec3d vector, double dst) {
        return RayCastUtility.getPointedEntity(RotationUtility.getRotationForCoord(vector), dst, 1.0F, !this.ignoreWalls(), target) == target;
    }

    public void resolvePlayers() {
        Minecraft var10000 = mc;
        for(EntityPlayer player : Minecraft.world.playerEntities) {
            if (player instanceof EntityOtherPlayerMP) {
                ((EntityOtherPlayerMP)player).resolve();
            }
        }
    }

    public void releaseResolver() {
        Minecraft var10000 = mc;
        for(EntityPlayer player : Minecraft.world.playerEntities) {
            if (player instanceof EntityOtherPlayerMP) {
                ((EntityOtherPlayerMP)player).releaseResolver();
            }
        }
    }

    static {
        rotation = new Vector2f();
        range = new NumberSetting("Range", 3.5f, 1.0f, 4.0f, 0.1f);
        rotateRange = new NumberSetting("Rotate Range", 0.5f, 0.0f, 20.0f, 0.1f);
    }

    public static enum Hitbox {
        HEAD,
        CHEST,
        LEGS;
    }

    public static boolean isActiveItemStackBlocking(EntityPlayer other, int time) {
        if (other.isHandActive() && !other.activeItemStack.isEmpty()) {
            Item item = other.activeItemStack.getItem();
            return item.getItemUseAction(other.activeItemStack) == EnumAction.BLOCK && item.getMaxItemUseDuration(other.activeItemStack) - other.activeItemStackUseCount >= time;
        } else {
            return false;
        }
    }
}






Код:
Expand Collapse Copy
package wtf.vilz.client.utility.move;

import net.minecraft.util.MovementInput;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;
import wtf.vilz.client.event.input.EventInput;
import wtf.vilz.client.module.impl.player.FreeCam;

import static com.jhlabs.math.Helper.mc;

public final class MoveUtils {
    public static boolean isMoving() {
        return mc.player.movementInput.moveForward != 0.0F || mc.player.movementInput.moveStrafe != 0.0F;
    }

    public static void fixMovement(EventInput event, float yaw) {
        float forward = event.getForward();
        float strafe = event.getStrafe();
        double angle = MathHelper.wrapDegrees(Math.toDegrees(direction(mc.player.isElytraFlying() ? yaw : mc.player.rotationYaw, forward, strafe)));
        if (forward != 0.0F || strafe != 0.0F) {
            float closestForward = 0.0F;
            float closestStrafe = 0.0F;
            float closestDifference = Float.MAX_VALUE;

            for (float predictedForward = -1.0F; predictedForward <= 1.0F; predictedForward++) {
                for (float predictedStrafe = -1.0F; predictedStrafe <= 1.0F; predictedStrafe++) {
                    if (predictedStrafe != 0.0F || predictedForward != 0.0F) {
                        double predictedAngle = MathHelper.wrapDegrees(Math.toDegrees(direction(yaw, predictedForward, predictedStrafe)));
                        double difference = Math.abs(angle - predictedAngle);
                        if (difference < closestDifference) {
                            closestDifference = (float)difference;
                            closestForward = predictedForward;
                            closestStrafe = predictedStrafe;
                        }
                    }
                }
            }

            event.setForward(closestForward);
            event.setStrafe(closestStrafe);
        }
    }

    public static double direction(float rotationYaw, double moveForward, double moveStrafing) {
        if (moveForward < 0.0) {
            rotationYaw += 180.0F;
        }

        float forward = 1.0F;
        if (moveForward < 0.0) {
            forward = -0.5F;
        } else if (moveForward > 0.0) {
            forward = 0.5F;
        }

        if (moveStrafing > 0.0) {
            rotationYaw -= 90.0F * forward;
        }

        if (moveStrafing < 0.0) {
            rotationYaw += 90.0F * forward;
        }

        return Math.toRadians(rotationYaw);
    }

    public static double getMotion() {
        return Math.hypot(mc.player.motionX, mc.player.motionZ);
    }

    public static void setMotion(double speed) {
        if (isMoving()) {
            double yaw = getDirection(true);
            mc.player.motionX = -Math.sin(yaw) * speed;
            mc.player.motionZ = Math.cos(yaw) * speed;
        }
    }

    public static void setMotionOld(double motion) {
        double forward = mc.player.movementInput.moveForward;
        double strafe = mc.player.movementInput.moveStrafe;
        float yaw = mc.player.rotationYaw;
        if (forward == 0.0 && strafe == 0.0) {
            mc.player.motionX = 0.0;
            mc.player.motionZ = 0.0;
        } else {
            if (forward != 0.0) {
                if (strafe > 0.0) {
                    yaw += forward > 0.0 ? -45 : 45;
                } else if (strafe < 0.0) {
                    yaw += forward > 0.0 ? 45 : -45;
                }

                strafe = 0.0;
                if (forward > 0.0) {
                    forward = 1.0;
                } else if (forward < 0.0) {
                    forward = -1.0;
                }
            }

            mc.player.motionX = forward * motion * MathHelper.cos((float)Math.toRadians(yaw + 90.0F))
                    + strafe * motion * MathHelper.sin((float)Math.toRadians(yaw + 90.0F));
            mc.player.motionZ = forward * motion * MathHelper.sin((float)Math.toRadians(yaw + 90.0F))
                    - strafe * motion * MathHelper.cos((float)Math.toRadians(yaw + 90.0F));
        }
    }

    public static boolean isBlockUnder(float under) {
        if (mc.player.posY < 0.0) {
            return false;
        } else {
            AxisAlignedBB aab = mc.player.getEntityBoundingBox().offset(0.0, -under, 0.0);
            return mc.world.getCollisionBoxes(mc.player, aab).isEmpty();
        }
    }

    public static double getDirection(boolean toRadians) {
        float rotationYaw = mc.player.rotationYaw;
        if (mc.player.moveForward < 0.0F) {
            rotationYaw += 180.0F;
        }

        float forward = 1.0F;
        if (mc.player.moveForward < 0.0F) {
            forward = -0.5F;
        } else if (mc.player.moveForward > 0.0F) {
            forward = 0.5F;
        }

        if (mc.player.moveStrafing > 0.0F) {
            rotationYaw -= 90.0F * forward;
        }

        if (mc.player.moveStrafing < 0.0F) {
            rotationYaw += 90.0F * forward;
        }

        return toRadians ? Math.toRadians(rotationYaw) : rotationYaw;
    }

    private MoveUtils() {
        throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
    }
}
 
Назад
Сверху Снизу