Начинающий
Увидел у дединсайда обход inventorymove и решил слить сюды его ибо нефиг пон
помойка:@Override public void onEvent(Event event) { if (event instanceof EventUpdate) { if (mc.player != null) { KeyBinding[] pressedKeys = {mc.gameSettings.keyBindForward, mc.gameSettings.keyBindBack, mc.gameSettings.keyBindLeft, mc.gameSettings.keyBindRight, mc.gameSettings.keyBindJump, mc.gameSettings.keyBindSprint}; if (bypass.get() && !timerUtils.isReached(400)) { for (KeyBinding keyBinding : pressedKeys) { keyBinding.setPressed(false); } return; } if (mc.currentScreen instanceof ChatScreen || mc.currentScreen instanceof EditSignScreen) return; updateKeyBindingState(pressedKeys); } } if (event instanceof EventPacket eventPacket) { if (bypass.get() && eventPacket.getPacket() instanceof CClickWindowPacket windowPacket && MovementUtils.isMoving() && mc.currentScreen instanceof InventoryScreen) { packet.add(windowPacket); eventPacket.setCancel(true); } } if (event instanceof EventInventoryClose eventInventoryClose) { if (bypass.get() && mc.currentScreen instanceof InventoryScreen && !packet.isEmpty() && MovementUtils.isMoving()) { new Thread(() -> { timerUtils.reset(); try { Thread.sleep(300); } catch (InterruptedException e) { throw new RuntimeException(e); } for (IPacket packet : packet) { mc.player.connection.sendPacket(packet); } packet.clear(); }).start(); eventInventoryClose.setCancel(true); } } } private void updateKeyBindingState(KeyBinding[] keyBindings) { for (KeyBinding keyBinding : keyBindings) { boolean isKeyPressed = InputMappings.isKeyDown(mw.getHandle(), keyBinding.getDefault().getKeyCode()); keyBinding.setPressed(isKeyPressed); } } }
ВОТ ОХУЕННЫЙ ИНВ МУВ ПОД РВУвидел у дединсайда обход inventorymove и решил слить сюды его ибо нефиг пон
помойка:@Override public void onEvent(Event event) { if (event instanceof EventUpdate) { if (mc.player != null) { KeyBinding[] pressedKeys = {mc.gameSettings.keyBindForward, mc.gameSettings.keyBindBack, mc.gameSettings.keyBindLeft, mc.gameSettings.keyBindRight, mc.gameSettings.keyBindJump, mc.gameSettings.keyBindSprint}; if (bypass.get() && !timerUtils.isReached(400)) { for (KeyBinding keyBinding : pressedKeys) { keyBinding.setPressed(false); } return; } if (mc.currentScreen instanceof ChatScreen || mc.currentScreen instanceof EditSignScreen) return; updateKeyBindingState(pressedKeys); } } if (event instanceof EventPacket eventPacket) { if (bypass.get() && eventPacket.getPacket() instanceof CClickWindowPacket windowPacket && MovementUtils.isMoving() && mc.currentScreen instanceof InventoryScreen) { packet.add(windowPacket); eventPacket.setCancel(true); } } if (event instanceof EventInventoryClose eventInventoryClose) { if (bypass.get() && mc.currentScreen instanceof InventoryScreen && !packet.isEmpty() && MovementUtils.isMoving()) { new Thread(() -> { timerUtils.reset(); try { Thread.sleep(300); } catch (InterruptedException e) { throw new RuntimeException(e); } for (IPacket packet : packet) { mc.player.connection.sendPacket(packet); } packet.clear(); }).start(); eventInventoryClose.setCancel(true); } } } private void updateKeyBindingState(KeyBinding[] keyBindings) { for (KeyBinding keyBinding : keyBindings) { boolean isKeyPressed = InputMappings.isKeyDown(mw.getHandle(), keyBinding.getDefault().getKeyCode()); keyBinding.setPressed(isKeyPressed); } } }
package im.Exo.functions.impl.player;
import com.google.common.eventbus.Subscribe;
import im.Exo.events.EventPacket;
import im.Exo.events.EventUpdate;
import im.Exo.events.InventoryCloseEvent;
import im.Exo.functions.api.Category;
import im.Exo.functions.api.Function;
import im.Exo.functions.api.FunctionRegister;
import im.Exo.functions.settings.impl.BooleanSetting;
import im.Exo.utils.client.ClientUtil;
import im.Exo.utils.math.StopWatch;
import im.Exo.utils.player.MoveUtils;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.gui.screen.EditSignScreen;
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.util.InputMappings;
import net.minecraft.network.IPacket;
import net.minecraft.network.play.client.CClickWindowPacket;
import net.minecraft.network.play.server.SCloseWindowPacket;
import java.util.ArrayList;
import java.util.List;
@FunctionRegister(name = "InventoryMove", type = Category.Player)
public class InventoryMove extends Function {
private final List<IPacket<?>> packet = new ArrayList<>();
private final BooleanSetting mode = new BooleanSetting("Обход Grim", false);
public InventoryMove() {addSettings(mode);}
@Subscribe
public void onUpdate(EventUpdate e) {
if (mc.player != null) {
final KeyBinding[] pressedKeys = {mc.gameSettings.keyBindForward, mc.gameSettings.keyBindBack,
mc.gameSettings.keyBindLeft, mc.gameSettings.keyBindRight, mc.gameSettings.keyBindJump,
mc.gameSettings.keyBindSprint};
if (mode.get()) {
if (!wait.isReached(400)) {
for (KeyBinding keyBinding : pressedKeys) {
keyBinding.setPressed(false);
}
return;
}
}
if (mc.currentScreen instanceof ChatScreen || mc.currentScreen instanceof EditSignScreen) {
return;
}
updateKeyBindingState(pressedKeys);
}
}
@Subscribe
public void onPacket(EventPacket e) {
if (mode.get()) {
if (e.getPacket() instanceof CClickWindowPacket p && MoveUtils.isMoving()) {
if (mc.currentScreen instanceof InventoryScreen) {
packet.add(p);
e.cancel();
}
}
}
}
public StopWatch wait = new StopWatch();
@Subscribe
public void onClose(InventoryCloseEvent e) {
if (mode.get()) {
if (mc.currentScreen instanceof InventoryScreen && !packet.isEmpty() && MoveUtils.isMoving()) {
new Thread(() -> {
wait.reset();
try {
Thread.sleep(300);
} catch (InterruptedException ex) {
throw new RuntimeException(ex);
}
for (IPacket p : packet) {
mc.player.connection.sendPacketWithoutEvent(p);
}
packet.clear();
}).start();
e.cancel();
}
}
}
private void updateKeyBindingState(KeyBinding[] keyBindings) {
for (KeyBinding keyBinding : keyBindings) {
boolean isKeyPressed = InputMappings.isKeyDown(mc.getMainWindow().getHandle(), keyBinding.getDefault().getKeyCode());
keyBinding.setPressed(isKeyPressed);
}
}
}
и килка пиздатая на рв нахуйУвидел у дединсайда обход inventorymove и решил слить сюды его ибо нефиг пон
помойка:@Override public void onEvent(Event event) { if (event instanceof EventUpdate) { if (mc.player != null) { KeyBinding[] pressedKeys = {mc.gameSettings.keyBindForward, mc.gameSettings.keyBindBack, mc.gameSettings.keyBindLeft, mc.gameSettings.keyBindRight, mc.gameSettings.keyBindJump, mc.gameSettings.keyBindSprint}; if (bypass.get() && !timerUtils.isReached(400)) { for (KeyBinding keyBinding : pressedKeys) { keyBinding.setPressed(false); } return; } if (mc.currentScreen instanceof ChatScreen || mc.currentScreen instanceof EditSignScreen) return; updateKeyBindingState(pressedKeys); } } if (event instanceof EventPacket eventPacket) { if (bypass.get() && eventPacket.getPacket() instanceof CClickWindowPacket windowPacket && MovementUtils.isMoving() && mc.currentScreen instanceof InventoryScreen) { packet.add(windowPacket); eventPacket.setCancel(true); } } if (event instanceof EventInventoryClose eventInventoryClose) { if (bypass.get() && mc.currentScreen instanceof InventoryScreen && !packet.isEmpty() && MovementUtils.isMoving()) { new Thread(() -> { timerUtils.reset(); try { Thread.sleep(300); } catch (InterruptedException e) { throw new RuntimeException(e); } for (IPacket packet : packet) { mc.player.connection.sendPacket(packet); } packet.clear(); }).start(); eventInventoryClose.setCancel(true); } } } private void updateKeyBindingState(KeyBinding[] keyBindings) { for (KeyBinding keyBinding : keyBindings) { boolean isKeyPressed = InputMappings.isKeyDown(mw.getHandle(), keyBinding.getDefault().getKeyCode()); keyBinding.setPressed(isKeyPressed); } } }
package im.Exo.functions.impl.combat;
import com.google.common.eventbus.Subscribe;
import im.Exo.Exo;
import im.Exo.command.friends.FriendStorage;
import im.Exo.events.EventDisplay;
import im.Exo.events.EventInput;
import im.Exo.events.EventMotion;
import im.Exo.events.EventUpdate;
import im.Exo.functions.api.Category;
import im.Exo.functions.api.Function;
import im.Exo.functions.api.FunctionRegister;
import im.Exo.functions.settings.impl.BooleanSetting;
import im.Exo.functions.settings.impl.ModeListSetting;
import im.Exo.functions.settings.impl.ModeSetting;
import im.Exo.functions.settings.impl.SliderSetting;
import im.Exo.utils.client.ClientUtil;
import im.Exo.utils.math.SensUtils;
import im.Exo.utils.math.StopWatch;
import im.Exo.utils.math.VectorUtils;
import im.Exo.utils.player.InventoryUtil;
import im.Exo.utils.player.MouseUtil;
import im.Exo.utils.player.MoveUtils;
import lombok.Getter;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Hand;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
import static java.lang.Math.hypot;
import static net.minecraft.util.math.MathHelper.clamp;
import static net.minecraft.util.math.MathHelper.wrapDegrees;
@FunctionRegister(name = "KillAura", type = Category.Combat)
public class KillAura extends Function {
Getter
private final ModeSetting type = new ModeSetting("Тип", "Плавная", "Плавная", "Резкая","Новая");
private final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3f, 2f, 6f, 0.1f);
private final SliderSetting rotateDistance = new SliderSetting("Дистанция наводки", 1f,0f,3f,0.1f);
final ModeListSetting targets = new ModeListSetting("Таргеты",
new BooleanSetting("Игроки", true),
new BooleanSetting("Голые", true),
new BooleanSetting("Мобы", false),
new BooleanSetting("Животные", false),
new BooleanSetting("Друзья", false),
new BooleanSetting("Голые невидимки", true),
new BooleanSetting("Невидимки", true));
Getter
final ModeListSetting options = new ModeListSetting("Опции",
new BooleanSetting("Только Криты",true),
new BooleanSetting("Криты с пробелом",true),
new BooleanSetting("Ломать щит", true),
new BooleanSetting("Отжимать щит", true),
new BooleanSetting("Синхронизировать ТПС", false),
new BooleanSetting("Коррекция движения", true));
final ModeSetting sort = new ModeSetting("Сортировка", "По дистанции", "По всему", "По здоровью","По дистанции");
final ModeSetting crit = new ModeSetting("Крит хелперы","None","None","Grim all");
final ModeSetting correctionType = new ModeSetting("Тип коррекции", "Незаметный", "Незаметный", "Сфокусированный").setVisible(()-> options.getValueByName("Коррекция движения").get());
Getter
private final StopWatch stopWatch = new StopWatch();
private Vector2f rotateVector = new Vector2f(0, 0);
Getter
private LivingEntity target;
private Entity selected;
int ticks = 0;
boolean isRotated;
final AutoPotion autoPotion;
final AutoHeal autoHeal;
final Criticals criticals;
public KillAura(AutoPotion autoPotion,AutoHeal autoHeal,Criticals criticals) {
this.autoHeal = autoHeal;
this.criticals = criticals;
this.autoPotion = autoPotion;
addSettings(type,crit,attackRange,rotateDistance, targets,sort,options, correctionType);
}
@Subscribe
public void onInput(EventInput eventInput) {
if (eventInput != null && options.getValueByName("Коррекция движения").get() && correctionType.is("Незаметный")) {
MoveUtils.fixMovement(eventInput, rotateVector.x);
}
}
@Subscribe
public void onUpdate(EventUpdate e) {
updateTarget();
if (target != null && !(!autoPotion.isState() && autoPotion.isActive())) {
isRotated = false;
if (shouldPlayerFalling() && (stopWatch.hasTimeElapsed())) {
updateAttack();
ticks = 2;
}
if (type.is("Резкая")) {
if (ticks > 0) {
updateRotation(true, 180, 90);
ticks--;
} else {
reset();
}
}else{
if (!isRotated) {updateRotation(false, 80, 35);}
}
if (shouldPlayerFalling() && (stopWatch.hasTimeElapsed())) {
updateAttack();
ticks = 2;
}
if (type.is("Новая")) {
if (ticks > 0) {
updateRotation(true, 180, 90);
} else {
reset();
}
}
} else {
stopWatch.setLastMS(0);
reset();
}
if (crit.is("Grim all")) {
if (shouldPlayerFalling() && (stopWatch.hasTimeElapsed())) {
if (mc.player.isSprinting()) {
mc.player.setSprinting(false);
}
updateAttack();
ticks = 2;
}
}
}
@Subscribe
private void onWalking(EventMotion e) {
if (this.target != null) {
float yaw;
float pitch;
if (!this.autoHeal.isActive() && this.autoPotion.isState() && this.autoPotion.isActive()) {
yaw = this.rotateVector.x;
pitch = this.rotateVector.y;
e.setYaw(yaw);
e.setPitch(pitch);
mc.player.rotationYawHead = yaw;
mc.player.renderYawOffset = yaw;
mc.player.rotationPitchHead = pitch;
} else {
yaw = this.rotateVector.x;
pitch = this.rotateVector.y;
float headRot = mc.player.prevRotationYawHead;
float maxHeadRot = 40.0F;
float bodRot = mc.player.prevRotationYaw;
float bodYaw;
if (Math.abs(headRot - bodRot) > maxHeadRot) {
if (headRot > bodRot) {
bodYaw = headRot + ThreadLocalRandom.current().nextFloat(1.0F, 15.0F);
} else {
bodYaw = headRot - ThreadLocalRandom.current().nextFloat(1.0F, 15.0F);
}
} else {
bodYaw = bodRot;
}
float newBodYaw = Math.min(Math.max(bodYaw, 0.0F), 10.0F);
mc.player.renderYawOffset = bodYaw;
mc.player.rotationYawHead = yaw;
mc.player.rotationPitchHead = pitch;
e.setYaw(yaw);
e.setPitch(pitch);
}
}
}
private void updateTarget() {
List<LivingEntity> targets = new ArrayList<>();
for (Entity entity : mc.world.getAllEntities()) {
if (entity instanceof LivingEntity living && isValid(living)) {
targets.add(living);
}
}
if (targets.isEmpty()) {
target = null;
return;
}
if (targets.size() == 1) {
target = targets.get(0);
return;
}
if (targets.size() > 1) {
switch (sort.get()) {
case "По всему" -> {
targets.sort(Comparator.comparingDouble(target -> {
if (target instanceof PlayerEntity player) {
return -this.getEntityArmor(player);
}
if (target instanceof LivingEntity livingEntity) {
return -livingEntity.getTotalArmorValue();
}
return 0.0;
}).thenComparing((o, o1) -> {
double health = getEntityHealth((LivingEntity) o);
double health1 = getEntityHealth((LivingEntity) o1);
return Double.compare(health, health1);
}).thenComparing((object, object2) -> {
double d2 = getDistance((LivingEntity) object);
double d3 = getDistance((LivingEntity) object2);
return Double.compare(d2, d3);
}));
}
case "По дистанции" -> {
targets.sort(Comparator.comparingDouble(this::getDistance).thenComparingDouble(this::getEntityHealth));
}
case "По здоровью" -> {
targets.sort(Comparator.comparingDouble(this::getEntityHealth).thenComparingDouble(mc.player::getDistance));
}
}
}
target = targets.get(0);
}
float lastYaw, lastPitch;
private double getDistance(LivingEntity entity) {
return VectorUtils.getVector(entity).length();
}
private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
Vector3d vec = target.getPositionVec().add(0, clamp(mc.player.getPosYEye() - target.getPosY(), 0, target.getHeight() * (mc.player.getDistanceEyePos(target) / attackRange.get())), 0).subtract(mc.player.getEyePosition(1));
isRotated = true;
float yawToTarget = (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90);
float pitchToTarget = (float) (-Math.toDegrees(Math.atan2(vec.y, hypot(vec.x, vec.z))));
float yawDelta = (wrapDegrees(yawToTarget - rotateVector.x));
float pitchDelta = (wrapDegrees(pitchToTarget - rotateVector.y));
int roundedYaw = (int) yawDelta;
switch (type.get()) {
case "Плавная" -> {
float clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed);
float clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 1.1F), rotationPitchSpeed);
if (Math.abs(clampedYaw - this.lastYaw) <= 5.0f) {
clampedYaw = this.lastYaw + 5.1f;
}
float yaw = rotateVector.x + (yawDelta > 0 ? clampedYaw : -clampedYaw);
float pitch = clamp(rotateVector.y + (pitchDelta > 0 ? clampedPitch : -clampedPitch), -85.0F, 85.0F);
float gcd = SensUtils.getGCDValue();
yaw -= (yaw - rotateVector.x) % gcd;
pitch -= (pitch - rotateVector.y) % gcd;
rotateVector = new Vector2f(yaw, pitch);
lastYaw = clampedYaw;
lastPitch = clampedPitch;
if (options.getValueByName("Коррекция движения").get()) {
mc.player.rotationYawOffset = yaw;
}
}
case "Резкая" -> {
float yaw = rotateVector.x + roundedYaw;
float pitch = clamp(rotateVector.y + pitchDelta, -90, 90);
float gcd = SensUtils.getGCDValue();
yaw -= (yaw - rotateVector.x) % gcd;
pitch -= (pitch - rotateVector.y) % gcd;
rotateVector = new Vector2f(yaw, pitch);
if (options.getValueByName("Коррекция движения").get()) {
mc.player.rotationYawOffset = yaw;
}
}
case "Новая" -> {
float yaw = rotateVector.x + roundedYaw;
float pitch = clamp(rotateVector.y + pitchDelta, -85, 85);
float gcd = SensUtils.getGCDValue();
yaw -= (yaw - rotateVector.x) % gcd;
pitch -= (pitch - rotateVector.y) % gcd;
rotateVector = new Vector2f(yaw, pitch);
if (options.getValueByName("Коррекция движения").get()) {
mc.player.rotationYawOffset = yaw;
}
}
}
}
private void updateAttack() {
selected = MouseUtil.getMouseOver(target, rotateVector.x, rotateVector.y, attackRange.get());
if ((selected == null || selected != target) && !mc.player.isElytraFlying()) {
return;
}
if (mc.player.isBlocking() && options.getValueByName("Отжимать щит").get()) {
mc.playerController.onStoppedUsingItem(mc.player);
}
stopWatch.setLastMS(500);
if (criticals.isState()) {
Criticals.doCrit();
}
mc.playerController.attackEntity(mc.player, target);
mc.player.swingArm(Hand.MAIN_HAND);
if (target instanceof PlayerEntity player && options.getValueByName("Ломать щит").get()) {
breakShieldPlayer(player);
}
}
private boolean shouldPlayerFalling() {
boolean cancelReason = mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER) || mc.player.isInLava() || mc.player.isOnLadder() || mc.player.isPassenger() || mc.player.abilities.isFlying;
boolean onSpace = mc.player.isOnGround() && !mc.gameSettings.keyBindJump.isKeyDown();
float attackStrength = mc.player.getCooledAttackStrength(options.getValueByName("Синхронизировать ТПС").get()
? Exo.getInstance().getTpsCalc().getAdjustTicks() : 1.5f);
if (attackStrength < 0.93f) {
return false;
}
if (!cancelReason && options.getValueByName("Криты с пробелом").get()) {
return onSpace || !mc.player.isOnGround() && mc.player.fallDistance > 0.00000;
}
if (!cancelReason && options.getValueByName("Только Криты").get()) {
return !mc.player.isOnGround() && mc.player.fallDistance > 0.00000;
}
return true;
}
private boolean isValid(LivingEntity entity) {
if (entity instanceof ClientPlayerEntity) return false;
if (entity.ticksExisted < 0) return false;
if (mc.player.getDistanceEyePos(entity) > (double)attackRange.get() + (double)rotateDistance.get()) return false;;
if (entity instanceof PlayerEntity p) {
if (AntiBot.isBot(entity)) {
return false;
}
if (!targets.getValueByName("Друзья").get() && FriendStorage.isFriend(p.getName().getString())) {
return false;
}
if (p.getName().getString().equalsIgnoreCase(mc.player.getName().getString())) return false;
}
if (entity instanceof PlayerEntity && !targets.getValueByName("Игроки").get()) {
return false;
}
if (entity instanceof PlayerEntity && entity.getTotalArmorValue() == 0 && !targets.getValueByName("Голые").get()) {
return false;
}
if (entity instanceof PlayerEntity && entity.isInvisible() && entity.getTotalArmorValue() == 0 && !targets.getValueByName("Голые невидимки").get()) {
return false;
}
if (entity instanceof PlayerEntity && entity.isInvisible() && !targets.getValueByName("Невидимки").get()) {
return false;
}
if (entity instanceof MonsterEntity && !targets.getValueByName("Мобы").get()) {
return false;
}
if (entity instanceof AnimalEntity && !targets.getValueByName("Животные").get()) {
return false;
}
return !entity.isInvulnerable() && entity.isAlive() && !(entity instanceof ArmorStandEntity);
}
private void breakShieldPlayer(PlayerEntity entity) {
if (entity.isBlocking()) {
int invSlot = InventoryUtil.getInstance().getAxeInInventory(false);
int hotBarSlot = InventoryUtil.getInstance().getAxeInInventory(true);
if (hotBarSlot == -1 && invSlot != -1) {
int bestSlot = InventoryUtil.getInstance().findBestSlotInHotBar();
mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);
mc.player.connection.sendPacket(new CHeldItemChangePacket(bestSlot));
mc.playerController.attackEntity(mc.player, entity);
mc.player.swingArm(Hand.MAIN_HAND);
mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);
mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
}
if (hotBarSlot != -1) {
mc.player.connection.sendPacket(new CHeldItemChangePacket(hotBarSlot));
mc.playerController.attackEntity(mc.player, entity);
mc.player.swingArm(Hand.MAIN_HAND);
mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
}
}
}
private void reset() {
if (options.getValueByName("Коррекция движения").get()) {
mc.player.rotationYawOffset = Integer.MIN_VALUE;
}
rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
}
override
public boolean onEnable() {
super.onEnable();
reset();
target = null;
return false;
}
override
public void onDisable() {
super.onDisable();
reset();
stopWatch.setLastMS(0);
target = null;
}
private double getEntityArmor(PlayerEntity entityPlayer2) {
double d2 = 0.0;
for (int i2 = 0; i2 < 4; ++i2) {
ItemStack is = entityPlayer2.inventory.armorInventory.get(i2);
if (!(is.getItem() instanceof ArmorItem)) continue;
d2 += getProtectionLvl(is);
}
return d2;
}
private double getProtectionLvl(ItemStack stack) {
if (stack.getItem() instanceof ArmorItem i) {
double damageReduceAmount = i.getDamageReduceAmount();
if (stack.isEnchanted()) {
damageReduceAmount += (double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
}
return damageReduceAmount;
}
return 0;
}
private double getEntityHealth(LivingEntity ent) {
if (ent instanceof PlayerEntity player) {
return (double) (player.getHealth() + player.getAbsorptionAmount()) * (getEntityArmor(player) / 20.0);
}
return ent.getHealth() + ent.getAbsorptionAmount();
}
}
Последнее редактирование: