-
Автор темы
- #1
Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:
- бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
- маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
- приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
- обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.
Спасибо!
Я хочу сделать свой клиент чтобы все нужные мне функции были в одном клиенте. За основу я взял экселент. Вот например я хочу спастить эту килку:
Нахожу от туда ротацию Vulcan которая мне и нужна:
И вставляю эту ротацию в код килауры которая уже в экселенте, добавляю утилки и импортирую их. Но неработает нихуя потому что там не только логика ротации а ещё и вызов функции атаки а как заменить логику атаки с экселента на эту я не знаю.
Java:
package dev.nova.client.modules.impl.combat;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import dev.nova.Nova;
import dev.nova.client.draggable.impl.ThemeSettingsDraggable;
import dev.nova.client.event.api.ClientEvent;
import dev.nova.client.event.event.player.*;
import dev.nova.client.event.event.render.WorldRenderEvent;
import dev.nova.client.modules.Category;
import dev.nova.client.modules.Module;
import dev.nova.client.modules.ModuleManager;
import dev.nova.client.modules.impl.render.particles.OtherParticles;
import dev.nova.client.modules.settings.*;
import dev.nova.client.ui.clientui.UIScreen;
import dev.nova.client.ui.mainmenu.MainMenuConstants;
import dev.nova.client.utils.animation.compact.CompactAnimation;
import dev.nova.client.utils.animation.compact.Easing;
import dev.nova.client.utils.animation.extended.Animation;
import dev.nova.client.utils.animation.extended.Direction;
import dev.nova.client.utils.animation.extended.impl.EaseInOutQuad;
import dev.nova.client.utils.color.NColor;
import dev.nova.client.utils.math.NMathUtil;
import dev.nova.client.utils.math.vector.CVec3;
import dev.nova.client.utils.player.InventoryUtility;
import dev.nova.client.utils.player.input.GCDFix;
import dev.nova.client.utils.player.input.RotationUtil;
import dev.nova.client.utils.player.movement.MoveUtil;
import dev.nova.client.utils.render.RenderUtil;
import dev.nova.pig.pattern.Singleton;
import lombok.*;
import lombok.experimental.FieldDefaults;
import net.minecraft.block.AirBlock;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.ProjectileHelper;
import net.minecraft.item.*;
import net.minecraft.network.play.client.CAnimateHandPacket;
import net.minecraft.network.play.client.CEntityActionPacket;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.network.play.client.CUseEntityPacket;
import net.minecraft.util.Hand;
import net.minecraft.util.Namespaced;
import net.minecraft.util.math.*;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector3f;
import net.optifine.reflect.Reflector;
import net.optifine.shaders.Shaders;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.Comparator;
import java.util.EnumSet;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.StreamSupport;
import static com.mojang.blaze3d.systems.RenderSystem.depthMask;
import static dev.nova.Nova.startTime;
import static net.optifine.reflect.Reflector.Minecraft;
@Getter
@Setter
@FieldDefaults(level = AccessLevel.PRIVATE)
public class KillAura extends Module {
public static Singleton<KillAura> singleton = Singleton.create(() -> ModuleManager.get(KillAura.class));
final NumberSetting range = new NumberSetting("Range", this, 3, "%.1f", 2, 6);
final BooleanSetting shieldBreak = new BooleanSetting("Shield Breaker", this, true);
final BooleanSetting onlyCriticals = new BooleanSetting("Only Criticals", this, true);
final BooleanSetting correctMovement = new BooleanSetting("Movement Correct", this, true);
final BooleanSetting renderMarker = new BooleanSetting("Render Marker", this, true);
final BooleanSetting throughWalls = new BooleanSetting("Through Walls", this, true);
Rotation rotationMode = Rotation.Vulcan;
EnumSet<Targets> targets = EnumSet.of(Targets.Players, Targets.Mobs);
Priority priority = Priority.Health;
Animation markerAnimation = new EaseInOutQuad(200, 0.2f);
boolean markerReached;
boolean markerRQ;
@Getter
public static LivingEntity target;
final Vector2f rotation = Vector2f.ZERO;
boolean rotatedBefore;
float prevYaw;
public KillAura() {
super("KillAura", Category.COMBAT, "Атакует сущностей/игроков в выбраном радиусе");
addSettings(new EnumSetting<>("Rotation", this, this::getRotationMode, this::setRotationMode, Rotation.class),
new MultiEnumSetting<>("Targets", this, this::getTargets, this::setTargets, Targets.class),
new EnumSetting<>("Priority", this, this::getPriority, this::setPriority, Priority.class),
range, shieldBreak, onlyCriticals, correctMovement, throughWalls, renderMarker);
}
@ClientEvent
public void onPlayerUpdate(PlayerUpdateEvent event) {
if (!isEnabled()) return;
target = findTarget();
if (target == null) {
rotation.setX(mc.player.getYaw(mc.getRenderPartialTicks()));
rotation.setY(mc.player.getPitch(mc.getRenderPartialTicks()));
}
}
@ClientEvent
public void onChangeMotion(ChangeMotionEvent event) {
if (!isEnabled()) return;
if (target == null)
return;
event.setYaw(rotation.getX());
event.setPitch(rotation.getY());
mc.player.movementYaw = rotation.getX();
if (false) { // client rotation
mc.player.rotationYaw = rotation.getX();
mc.player.rotationPitch = rotation.getY();
}
mc.player.renderYawOffset = rotation.getX();
mc.player.rotationYawHead = rotation.getX();
mc.player.rotationPitchHead = rotation.getY();
if (false)
if (Math.abs(mc.player.rotationYaw - rotation.getX()) > 30) {
mc.player.serverSprintState = false;
mc.player.setSprinting(false);
}
event.postActions.add(() -> {
if (false)
if (Math.abs(mc.player.rotationYaw - rotation.getX()) > 30) {
mc.player.serverSprintState = false;
mc.player.setSprinting(false);
}
if (target != null) {
handleKillAura();
if (!target.isAlive())
target = null;
}
});
}
@ClientEvent
public void onMove(MoveEvent event) {
if (!isEnabled()) return;
if (correctMovement.getValue() && target != null)
MoveUtil.fixMovement(event, rotation.getX());
}
@ClientEvent
public void onStrafe(EventStrafe event) {
if (!isEnabled()) return;
if (correctMovement.getValue() && target != null)
event.setYaw(rotation.getX());
}
@ClientEvent
public void onPlayerJump(PlayerJumpEvent event) {
if (!isEnabled()) return;
if (correctMovement.getValue() && target != null)
event.setYaw(rotation.x);
}
@ClientEvent
public void onLook(LookEvent event) {
if (!isEnabled()) return;
if (correctMovement.getValue() && target != null)
event.setRotation(rotation);
}
public float markerX = 0;
public float markerY = 0;
public float markerZ = 0;
public CompactAnimation markerA = new CompactAnimation(Easing.EASE_OUT_CUBIC, 600);
@ClientEvent
public void onRenderMarker(WorldRenderEvent event) {
// if (!isEnabled()) return;
if (!renderMarker.getValue())
return;
if (target == null) {
markerReached = false;
markerRQ = false;
markerAnimation = new EaseInOutQuad(200, 0.2f);
markerAnimation.reset();
markerA.run(0f);
//return;
} else {
markerA.run(1f);
}
if (!markerReached) {
markerAnimation.setDirection(true);
if (markerAnimation.finished(Direction.FORWARDS))
markerReached = true;
} else markerAnimation.setDirection(false);
MatrixStack ms = event.getMatrixStack();
double ix = -((mc.getRenderManager().info.getProjectedView().getX()));
double iy = -((mc.getRenderManager().info.getProjectedView().getY()));
double iz = -((mc.getRenderManager().info.getProjectedView().getZ()));
double x = markerX;
double y = markerY;
double z = markerZ;
if (target != null) {
double xv = NMathUtil.interporate(mc.getRenderPartialTicks(), target.lastTickPosX, target.getPosX());
double yv = NMathUtil.interporate(mc.getRenderPartialTicks(), target.lastTickPosY, target.getPosY()) + target.getHeight() / 1.6f;
double zv = NMathUtil.interporate(mc.getRenderPartialTicks(), target.lastTickPosZ, target.getPosZ());
markerX = NMathUtil.lerp(markerX, (float) xv, 0.2f);
markerY = NMathUtil.lerp(markerY, (float) yv, 0.2f);
markerZ = NMathUtil.lerp(markerZ, (float) zv, 0.2f);
if (Math.abs(markerX - xv) > 16) {
markerX = (float) xv;
markerY = (float) yv;
markerZ = (float) zv;
}
//x = xv;
//y = yv;
//z = zv;
}
if (false) {
ms.push();
ms.translate(ix, iy, iz);
ms.translate(x, y, z);
ms.rotate(mc.getRenderManager().info.getRotation());
float factor = 1.5f;
float b = (float) (((Math.sin(((System.currentTimeMillis() - startTime) / 200F)) * 0.5f + markerAnimation.getOutput().floatValue() * 4)) * 0.1f + 0.4f) / factor;
float xM = 0.25f / factor;
float size = 0.5f / factor;
float xFactor = 0;
float yFactor = -0.18f;
depthMask(false);
float alpha = Shaders.shaderPackLoaded ? 1f : 0.9f;
alpha *= markerA.getNumberValue().floatValue();
for (int i = 0; i < 1; i++) {
GL11.glDisable(GL11.GL_DEPTH_TEST);
RenderUtil.drawImage(ms, new Namespaced("nova/icons/ui/markers/arrow2g.png"), (-b - xM) + xFactor, yFactor, 0, size, size, NColor.fromColor(UIScreen.timeTheme.otherColor).withCustomAlpha(alpha).getRGB());
GL11.glDisable(GL11.GL_DEPTH_TEST);
RenderUtil.drawImage(ms, new Namespaced("nova/icons/ui/markers/arrowg.png"), (b - xM) + xFactor, yFactor, 0, size, size, NColor.fromColor(UIScreen.timeTheme.otherColor).withCustomAlpha(alpha).getRGB());
GL11.glDisable(GL11.GL_DEPTH_TEST);
RenderUtil.drawImage(ms, new Namespaced("nova/icons/ui/markers/arrow3g.png"), (-xM) + xFactor, (b) + yFactor, 0, size, size, NColor.fromColor(UIScreen.timeTheme.otherColor).withCustomAlpha(alpha).getRGB());
GL11.glDisable(GL11.GL_DEPTH_TEST);
RenderUtil.drawImage(ms, new Namespaced("nova/icons/ui/markers/arrow4g.png"), (-xM) + xFactor, (-b) + yFactor, 0, size, size, NColor.fromColor(UIScreen.timeTheme.otherColor).withCustomAlpha(alpha).getRGB());
}
GL11.glEnable(GL11.GL_DEPTH_TEST);
depthMask(true);
ms.pop();
}
renderAlternativeMarker(ms);
}
public void renderAlternativeMarker(MatrixStack stack) {
float c = (float) ((((System.currentTimeMillis() - startTime) / 1500F)) + (Math.sin((((System.currentTimeMillis() - startTime) / 1500F))) / 10f));
MatrixStack ms = stack;
double ix = -((mc.getRenderManager().info.getProjectedView().getX()));
double iy = -((mc.getRenderManager().info.getProjectedView().getY()));
double iz = -((mc.getRenderManager().info.getProjectedView().getZ()));
double x = markerX;
double y = markerY;
double z = markerZ;
float alpha = Shaders.shaderPackLoaded ? 1f : 0.5f;
alpha *= markerA.getNumberValue().floatValue();
ColorSetting sett = ThemeSettingsDraggable.current.color1Setting;
boolean rb = false;
if (!sett.selectedMode.equals(ColorSetting.DefaultColors.RAINBOW)) {
sett = ThemeSettingsDraggable.current.color2Setting;
if (sett.selectedMode.equals(ColorSetting.DefaultColors.RAINBOW))
rb = true;
} else {
rb = true;
}
float pl = 0;
boolean fa = true;
for (int b = 0; b < 3; b++) {
for (float i = c * 360; i < c * 360 + 90; i += 2) {
float cur = i;
float min = c * 360;
float max = c * 360 + 90;
float dc = NMathUtil.normalize(cur, c * 360 - 45, max);
float degrees = i;
Color color = ThemeSettingsDraggable.current.color1Setting.calculateColor((int) degrees * 2 + b * 32);
Color color2 = ThemeSettingsDraggable.current.color2Setting.calculateColor((int) degrees * 2 + b * 32 + 4);
float rf = 0.6f * markerA.getNumberValue().floatValue();
double radians = Math.toRadians(degrees);
double plY = pl + Math.sin(radians * 1.2f) * 0.1f;
if ((fa ? i >= max - 4 : i == min) && Math.random() < 0.01f && target != null) {
//OtherParticles.singleton.get().particleList.clear();
OtherParticles.singleton.get().particleList.add(new OtherParticles.Particle(OtherParticles.singleton.get().generateMotion().mul(0.05f),
new CVec3((float) (x + Math.cos(radians) * rf), (float) (y + plY - 0.7f), (float) (z + Math.sin(radians) * rf))));
}
ms.push();
ms.translate(ix, iy, iz);
ms.translate(x, y, z);
ms.rotate(mc.getRenderManager().info.getRotation());
depthMask(false);
float q = (!fa ? 0.25f : 0.15f) * (Math.max(fa ? 0.25f : 0.15f, fa ? dc : (1f - -(0.4f - dc)) / 2f) + 0.45f);
float w = q * (2f + ((0.5f - alpha) * 2));
//GL11.glDisable(GL11.GL_DEPTH_TEST);
RenderUtil.drawImage(ms,
new Namespaced("nova/icons/visuals/circleglow2.png"),
Math.cos(radians) * rf - w / 2f,
plY - 0.7,
Math.sin(radians) * rf - w / 2f, w, w,
NColor.fromColor(color).withCustomAlpha(alpha).hashCode(),
NColor.fromColor(color2).withCustomAlpha(alpha).hashCode(),
NColor.fromColor(color2).withCustomAlpha(alpha).hashCode(),
NColor.fromColor(color).withCustomAlpha(alpha).hashCode());
GL11.glEnable(GL11.GL_DEPTH_TEST);
depthMask(true);
ms.pop();
}
c *= -1.25f;
fa = !fa;
pl += 0.45f;
}
}
private LivingEntity findTarget() {
Comparator<LivingEntity> comparator = priority.apply(mc.player);
return StreamSupport.stream(mc.world.getAllEntities().spliterator(), false)
.filter(e -> e instanceof LivingEntity)
.map(e -> (LivingEntity) e)
.filter(e -> (throughWalls.getValue() || mc.player.canEntityBeSeen(e)) && e.isAlive() && e.deathTime <= 0 && e != mc.player && !e.getName().equals(mc.player.getName())
&& e != mc.getRenderViewEntity() && mc.player.getDistance(e) <= (range.getValue() + 0.2F) &&
!AntiBot.checkBot(e) && !Nova.friendManager.isFriend(e) && targets.stream().anyMatch(t -> t.test(e))).min(comparator).orElse(null);
}
private boolean canAttack() {
boolean reasonForCancelCritical = !onlyCriticals.getValue() && (mc.player.abilities.isFlying || mc.player.isElytraFlying() || mc.player.isInWater() || mc.player.isInLava()
|| mc.player.isSwimming() || mc.player.isOnLadder() || mc.player.isRidingHorse() || mc.player.isSwimming());
boolean tickCheck = (mc.player.getHeldItemMainhand().getItem() instanceof ToolItem)
|| (mc.player.getHeldItemMainhand().getItem() instanceof SwordItem)
|| (mc.player.getHeldItemMainhand().getItem() instanceof TridentItem);
float attackStrength = mc.player.getCooledAttackStrength(tickCheck ? 1.5F : 0F);
if (attackStrength < (0.93F - Math.random() * 0.05))
return false;
return /*true && rotationEnd*/ checkFalling() && rotationEnd;
}
private void handleKillAura() {
if (target == null) {
prevYaw = mc.player.rotationYaw;
prevPitch = mc.player.rotationPitch;
rotation.setX(mc.player.getYaw(mc.getRenderPartialTicks()));
rotation.setY(mc.player.getPitch(mc.getRenderPartialTicks()));
if (mc.gameSettings.keyBindUseItem.isPressed())
mc.gameSettings.keyBindUseItem.setPressed(false);
return;
}
if (mc.player.isHandActive() && mc.player.isActiveItemStackBlocking())
mc.playerController.onStoppedUsingItem(mc.player);
rotatedBefore = false;
attack();
if (!rotatedBefore)
updateRotation(false);
}
private void attack() {
if (canAttack()) {
updateRotation(true);
boolean prevSprint = mc.player.isSprinting();
if (prevSprint) {
mc.player.serverSprintState = false;
mc.gameSettings.keyBindSprint.setPressed(false);
mc.player.setSprinting(false);
mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));
}
if (mc.player.isActiveItemStackBlocking())
mc.playerController.onStoppedUsingItem(mc.player);
if (shieldBreak.getValue() && isBlocking(target) && InventoryUtility.findAxe() != -1)
breakShield();
mc.playerController.attackEntity(mc.player, target);
mc.player.swingArm(Hand.MAIN_HAND);
if (mc.player.isSprinting() != prevSprint) {
mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING));
mc.player.setSprinting(prevSprint);
mc.gameSettings.keyBindSprint.setPressed(prevSprint);
mc.player.serverSprintState = prevSprint;
}
}
}
public boolean rotationEnd;
public float prevPitch;
private void updateRotation(boolean attack) {
rotatedBefore = true;
Vector3d ent = NMathUtil.getInterpolatedPos(target, mc.getRenderPartialTicks());
double deltaX = (ent.getX() - (target.lastTickPosX - target.getPosX())) - (mc.player.getPosX());
double deltaY = (ent.getY() + target.getEyeHeight(target.getPose()) / 4f) - mc.player.getEyePosition(mc.getRenderPartialTicks()).getY();
double deltaZ = (ent.getZ() - (target.lastTickPosZ - target.getPosZ())) - mc.player.getPosZ();
double dst = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
double yawToTarget = Math.toDegrees(Math.atan2(deltaZ, deltaX)) - 90.0;
double pitchToTarget = -Math.toDegrees(Math.atan2(deltaY, dst));
float yawToTarget2 = (float) MathHelper.wrapDegrees(yawToTarget);
float pitchToTarget2 = (float) pitchToTarget;
switch (rotationMode) {
case Default: {
float yawDelta = MathHelper.wrapDegrees(yawToTarget2 - rotation.getX()) / 1.0001f;
int yawDeltaAbs = (int) Math.abs(yawDelta);
float pitchDelta = (pitchToTarget2 - rotation.getY()) / 1.0001f;
float pitchDeltaAbs = Math.abs(pitchDelta);
float additionYaw = Math.min(Math.max(yawDeltaAbs, 1), 80);
float additionPitch = Math.max(attack ? pitchDeltaAbs : 1.0f, 2.0f);
if (Math.abs(additionYaw - prevYaw) <= 3.0f)
additionYaw = prevYaw + 3.1f;
float newYaw = rotation.getX() + (yawDelta > 0.0f ? additionYaw : -additionYaw) * 1.0001f;
float newPitch = MathHelper.clamp(rotation.getY() + (pitchDelta > 0.0f ? additionPitch : -additionPitch) * 1.0001f, -90.0f, 90.0f);
rotation.setX(newYaw);
rotation.setY(newPitch);
prevYaw = additionYaw;
rotationEnd = true;
break;
}
case Vulcan: {
float[] rotationb = RotationUtil.getMultiPoint(mc.player, target, true);
rotation.setX(rotationb[0]);
rotation.setY(rotationb[1]);
rotationEnd = true;
if (true) {
break;
}
float yawDelta = MathHelper.wrapDegrees(yawToTarget2 - rotation.getX());
float pitchDelta = pitchToTarget2 - rotation.getY();
if (yawDelta > 180.0f)
yawDelta -= 180.0f;
float yawDeltaAbs = Math.abs(yawDelta);
float pitchDelta2 = Math.max(attack ? Math.abs(pitchDelta) : 1.0f, (float) (2.0 + Math.random()));
float yawDelta2 = Math.min(Math.max(yawDeltaAbs, 1.0f), (float) (60.0 - Math.random()));
if (Math.abs(yawDelta2 - prevYaw) <= 3.0f)
yawDelta2 = prevYaw + 0.3f;
float newYaw = rotation.getX() + (yawDelta > 0.0f ? yawDelta2 : -yawDelta2);
float newPitch = rotation.getY() + (pitchDelta > 0.0f ? pitchDelta2 : -pitchDelta2);
newYaw = rotation.getX() + GCDFix.getFixedRotation(MathHelper.wrapDegrees(newYaw - rotation.getX()));
rotation.setY(rotation.getY() + GCDFix.getFixedRotation(newPitch - rotation.getY()));
rotation.setY(MathHelper.clamp(rotation.getY(), -90.0f, 90.0f));
rotation.setX(newYaw);
prevYaw = yawDelta2;
rotationEnd = true;
break;
}
case FunTime: {
//double distanceToTarget = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
float targetYaw = (float) MathHelper.wrapDegrees(yawToTarget);
float targetPitch = (float) pitchToTarget;
float yawDifference = MathHelper.wrapDegrees(targetYaw - rotation.x);
float pitchDifference = targetPitch - rotation.y;
if (yawDifference > 180.0f)
yawDifference -= 180.0f;
float absoluteYawDifference = Math.abs(yawDifference);
float pitchChange = Math.max(1.0f, (float) (2.0));
float yawChange = Math.min(Math.max(absoluteYawDifference, 1.0f), (float) (60.0));
boolean tickRotation = true;
boolean canRotation = mc.player.ticksExisted % 2 == 0;
if (tickRotation) {
if (canRotation) {
prevYaw = yawChange;
prevPitch = pitchChange;
}
yawChange = prevYaw;
pitchChange = prevPitch;
} else {
if (Math.abs(yawChange - prevYaw) <= 3.0f)
yawChange = prevYaw + 3.1f;
}
float newAdjustedPitch = rotation.y + (pitchDifference > 0.0f ? pitchChange : -pitchChange);
float newAdjustedYaw = rotation.x + (yawDifference > 0.0f ? yawChange : -yawChange);
newAdjustedYaw = rotation.x + GCDFix.getFixedRotation(MathHelper.wrapDegrees(newAdjustedYaw - rotation.x));
rotation.y += GCDFix.getFixedRotation(newAdjustedPitch - rotation.y);
rotation.y = MathHelper.clamp(rotation.y, -90.0f, 90.0f);
rotation.x = newAdjustedYaw;
//prevYaw = yawChange;
rotationEnd = Math.abs(yawChange - prevYaw) <= 1.5f;
break;
}
}
}
public float getDebugFps() {
return Reflector.getFieldValueInt(Reflector.Minecraft_debugFPS, -1);
}
KillAura aura;
public Vector2f correctRotation(float yaw, float pitch) {
// if ((yaw == -90 && pitch == 90) || yaw == -180) return new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
float gcd = getGCDValue();
yaw -= yaw % gcd;
pitch -= pitch % gcd;
return new Vector2f(yaw, pitch);
}
public float getSensitivity(float rot) {
return getDeltaMouse(rot) * getGCDValue();
}
public float getGCDValue() {
return (float) (getGCD() * 0.15);
}
public float getGCD() {
float f1;
return (f1 = (float) (mc.gameSettings.mouseSensitivity * 0.6 + 0.2)) * f1 * f1 * 8;
}
public float getDeltaMouse(float delta) {
return Math.round(delta / getGCDValue());
}
public void calculateRotation() {
aura = this;
if (Float.isNaN(this.rotation.x)) this.rotation.x = 0;
if (Float.isNaN(this.rotation.y)) this.rotation.y = 0;
//Chat.debug(mc.player.getPositionVec().add(new Vector3d(0, mc.player.getDistance(this.aura.getTarget()) < 2.3f ? (mc.player.getPosY() >= this.aura.getTarget().getPosY() ? 0 : 0) : hitboxSize/2, 0)).distanceTo(Rotation.getBestPoint(mc.player.getEyePosition(mc.timer.renderPartialTicks), aura.getTarget())));
double hitboxSize = target.getBoundingBox().maxY - target.getBoundingBox().minY;
Vector3d pos = target.getPositionVec().add(0, mc.player.getDistance(this.aura.getTarget()) < 2 ? (mc.player.getPosY() >= this.aura.getTarget().getPosY() ? 0 : 0) : hitboxSize/2, 0) //Rotation.getFixedPoint(mc.player.getPositionVec().add(0,1,0), aura.getTarget()) //aura.getTarget().getPositionVec().add(0,1,0)
.subtract(mc.player.getEyePosition(mc.getRenderPartialTicks()));
float shortestYawPath = (float) ((((((Math.toDegrees(Math.atan2(pos.z, pos.x)) - 90) - this.rotation.x) % 360) + 540) % 360) - 180);
float targetYaw = this.rotation.x + shortestYawPath;
float targetPitch = (float) -Math.toDegrees(Math.atan2(pos.y, Math.hypot(pos.x, pos.z)));
this.rotation.x = (float) NMathUtil.lerp(this.rotation.x, targetYaw, getAIRotationSpeed(Math.abs(this.rotation.x - targetYaw)));
this.rotation.y = (float) NMathUtil.lerp(this.rotation.y, targetPitch, 0.07f / Math.max((float) getDebugFps(), 5) * 75);
Vector2f correctedRotation = correctRotation(
this.rotation.x,
this.rotation.y
);
this.rotation.x = correctedRotation.x;
this.rotation.y = correctedRotation.y;
}
private float getAIRotationSpeed(float diff) {
boolean result = rayTraceWithBlock(3, this.rotation.x, this.rotation.y, mc.player, aura.getTarget());
if (result) return 0.25f / Math.max((float) getDebugFps(), 5) * 75;
return MathHelper.clamp((180 - diff)
/ 180, 0, 0.2f)
/ Math.max((float) getDebugFps(), 5)
* 75;
}
public static Vector3d getVectorForRotation(float pitch, float yaw) {
float yawRadians = -yaw * ((float) Math.PI / 180) - (float) Math.PI;
float pitchRadians = -pitch * ((float) Math.PI / 180);
float cosYaw = MathHelper.cos(yawRadians);
float sinYaw = MathHelper.sin(yawRadians);
float cosPitch = -MathHelper.cos(pitchRadians);
float sinPitch = MathHelper.sin(pitchRadians);
return new Vector3d(sinYaw * cosPitch, sinPitch, cosYaw * cosPitch);
}
public static RayTraceResult rayTrace(double rayTraceDistance,
float yaw,
float pitch,
Entity entity) {
Vector3d startVec = mc.player.getEyePosition(1.0F);
Vector3d directionVec = getVectorForRotation(pitch, yaw);
Vector3d endVec = startVec.add(
directionVec.x * rayTraceDistance,
directionVec.y * rayTraceDistance,
directionVec.z * rayTraceDistance
);
return mc.world.rayTraceBlocks(new RayTraceContext(
startVec,
endVec,
RayTraceContext.BlockMode.OUTLINE,
RayTraceContext.FluidMode.NONE,
entity)
);
}
public boolean rayTraceWithBlock(double rayTraceDistance,
float yaw,
float pitch,
Entity entity, Entity target) {
RayTraceResult object = null;
if (entity != null && mc.world != null) {
float partialTicks = mc.getRenderPartialTicks();
double distance = rayTraceDistance;
object = rayTrace(rayTraceDistance, yaw, pitch, entity);
Vector3d vector3d = entity.getEyePosition(partialTicks);
boolean flag = false;
double d1 = distance;
if (mc.playerController.extendedReach()) {
d1 = 6.0D;
distance = d1;
}
d1 = d1 * d1;
if (object != null) {
d1 = object.getHitVec().squareDistanceTo(vector3d);
}
Vector3d vector3d1 = getVectorForRotation(pitch, yaw);
Vector3d vector3d2 = vector3d.add(vector3d1.x * distance, vector3d1.y * distance, vector3d1.z * distance);
float f = 1.0F;
AxisAlignedBB axisalignedbb = entity.getBoundingBox().expand(vector3d1.scale(distance)).grow(1.0D, 1.0D, 1.0D);
EntityRayTraceResult entityraytraceresult = ProjectileHelper.rayTraceEntities(entity, vector3d, vector3d2, axisalignedbb, (p_lambda$getMouseOver$0_0_) ->
{
return !p_lambda$getMouseOver$0_0_.isSpectator() && p_lambda$getMouseOver$0_0_.canBeCollidedWith();
}, d1);
if (entityraytraceresult != null) {
Entity entity1 = entityraytraceresult.getEntity();
Vector3d vector3d3 = entityraytraceresult.getHitVec();
double d2 = vector3d.squareDistanceTo(vector3d3);
if (d2 < d1 || object == null) {
object = entityraytraceresult;
}
}
}
if (object instanceof EntityRayTraceResult e) {
if (e.getEntity().getEntityId() == target.getEntityId()) {
return true;
}
}
return false;
}
public boolean criticalCheck() {
boolean reasonForCancelCritical = !onlyCriticals.getValue() && (mc.player.abilities.isFlying || mc.player.isElytraFlying() || mc.player.isInWater() || mc.player.isInLava()
|| mc.player.isSwimming() || mc.player.isOnLadder() || mc.player.isRidingHorse() || mc.player.isSwimming());
boolean tickCheck = (mc.player.getHeldItemMainhand().getItem() instanceof ToolItem)
|| (mc.player.getHeldItemMainhand().getItem() instanceof SwordItem)
|| (mc.player.getHeldItemMainhand().getItem() instanceof TridentItem);
return reasonForCancelCritical || tickCheck;
}
private boolean checkFalling() {
boolean condition = criticalCheck();
boolean onlyCrits = true;
boolean smartCrits = false;
if (mc.player.isElytraFlying()) {
return true;
}
if (mc.gameSettings.keyBindJump.isKeyDown()) {
if ((mc.world.getBlockState(mc.player.getPosition()).getMaterial().isLiquid() && mc.world.getBlockState(new BlockPos(mc.player.getPosX(), mc.player.getPosY() + 1,
mc.player.getPosZ())).getBlock() instanceof AirBlock))
if (mc.player.fallDistance > 0.0f)
return true;
}
final float fallDistance = NMathUtil.randomizeFloat(NMathUtil.EPSILON6, NMathUtil.EPSILON2);
if (onlyCrits && !smartCrits) {
return !mc.player.isOnGround() && mc.player.fallDistance >= fallDistance && mc.player.motion.y <= -fallDistance;
}
return condition || (!mc.player.isOnGround() && mc.player.fallDistance >= fallDistance && mc.player.motion.y <= -fallDistance);
}
private void breakShield() {
int oldSlot = mc.player.inventory.currentItem;
mc.player.connection.sendPacket(new CHeldItemChangePacket(InventoryUtility.findAxe()));
mc.player.connection.sendPacket(new CUseEntityPacket(target, false));
mc.player.connection.sendPacket(new CAnimateHandPacket(Hand.MAIN_HAND));
mc.player.connection.sendPacket(new CHeldItemChangePacket(oldSlot));
mc.player.resetCooldown();
Nova.addMsg("Successfully broke " + target.getName().getString() + "'s shield");
}
private boolean isBlocking(LivingEntity entity) {
ItemStack offhandStack = entity.getHeldItemOffhand();
if (offhandStack.getItem() instanceof ShieldItem)
return entity.isActiveItemStackBlocking();
return false;
}
@Override
public void onDisable() {
super.onDisable();
rotation.setX(mc.player.getYaw(mc.getRenderPartialTicks()));
rotation.setY(mc.player.getPitch(mc.getRenderPartialTicks()));
target = null;
}
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
public enum Targets implements Predicate<Entity> {
Players(e -> e instanceof PlayerEntity),
Animals(e -> e instanceof AnimalEntity),
Mobs(e -> e instanceof MobEntity),
Villagers(e -> e instanceof VillagerEntity);
Predicate<Entity> predicate;
@Override
public boolean test(Entity entity) {
return predicate.test(entity);
}
}
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
public enum Priority implements Function<ClientPlayerEntity, Comparator<LivingEntity>> {
Distance(player -> Comparator.comparingDouble(player::getDistance)),
Health(player -> (first, second) -> Float.compare(first.getHealth(), second.getHealth()));
Function<ClientPlayerEntity, Comparator<LivingEntity>> comparator;
public int compare(ClientPlayerEntity player, LivingEntity first, LivingEntity second) {
return comparator.apply(player).compare(first, second);
}
@Override
public Comparator<LivingEntity> apply(ClientPlayerEntity controlledPlayer) {
return comparator.apply(controlledPlayer);
}
}
public enum Rotation {
Default, Vulcan, FunTime
}
}
Java:
case Vulcan: {
float[] rotationb = RotationUtil.getMultiPoint(mc.player, target, true);
rotation.setX(rotationb[0]);
rotation.setY(rotationb[1]);
rotationEnd = true;
if (true) {
break;
}
float yawDelta = MathHelper.wrapDegrees(yawToTarget2 - rotation.getX());
float pitchDelta = pitchToTarget2 - rotation.getY();
if (yawDelta > 180.0f)
yawDelta -= 180.0f;
float yawDeltaAbs = Math.abs(yawDelta);
float pitchDelta2 = Math.max(attack ? Math.abs(pitchDelta) : 1.0f, (float) (2.0 + Math.random()));
float yawDelta2 = Math.min(Math.max(yawDeltaAbs, 1.0f), (float) (60.0 - Math.random()));
if (Math.abs(yawDelta2 - prevYaw) <= 3.0f)
yawDelta2 = prevYaw + 0.3f;
float newYaw = rotation.getX() + (yawDelta > 0.0f ? yawDelta2 : -yawDelta2);
float newPitch = rotation.getY() + (pitchDelta > 0.0f ? pitchDelta2 : -pitchDelta2);
newYaw = rotation.getX() + GCDFix.getFixedRotation(MathHelper.wrapDegrees(newYaw - rotation.getX()));
rotation.setY(rotation.getY() + GCDFix.getFixedRotation(newPitch - rotation.getY()));
rotation.setY(MathHelper.clamp(rotation.getY(), -90.0f, 90.0f));
rotation.setX(newYaw);
prevYaw = yawDelta2;
rotationEnd = true;
break;
}