[JS] HmXixAura 0.1
-
///engine_flags=--language=es6 var scriptName = "HmXixAura"; var scriptVersion = 0.1; var scriptAuthor = "mumy++"; var Color = Java.type("java.awt.Color"); var LiquidBounce = Java.type("net.ccbluex.liquidbounce.LiquidBounce"); var AttackEvent = Java.type("net.ccbluex.liquidbounce.event.AttackEvent"); var EventState = Java.type("net.ccbluex.liquidbounce.event.EventState"); var AntiBot = Java.type("net.ccbluex.liquidbounce.features.module.modules.misc.AntiBot"); var EntityUtils = Java.type("net.ccbluex.liquidbounce.utils.EntityUtils"); var RotationUtils = Java.type("net.ccbluex.liquidbounce.utils.RotationUtils"); var ColorUtils = Java.type("net.ccbluex.liquidbounce.utils.render.ColorUtils"); var RenderUtils = Java.type("net.ccbluex.liquidbounce.utils.render.RenderUtils"); var MSTimer = Java.type("net.ccbluex.liquidbounce.utils.timer.MSTimer"); var BoolValue = Java.type("net.ccbluex.liquidbounce.value.BoolValue"); var FloatValue = Java.type("net.ccbluex.liquidbounce.value.FloatValue"); var IntegerValue = Java.type("net.ccbluex.liquidbounce.value.IntegerValue"); var ListValue = Java.type("net.ccbluex.liquidbounce.value.ListValue"); var TextValue = Java.type("net.ccbluex.liquidbounce.value.TextValue"); var GlStateManager = Java.type("net.minecraft.client.renderer.GlStateManager"); var GameSettings = Java.type("net.minecraft.client.settings.GameSettings"); var KeyBinding = Java.type("net.minecraft.client.settings.KeyBinding"); var EntityLivingBase = Java.type("net.minecraft.entity.EntityLivingBase"); var EntityDragon = Java.type("net.minecraft.entity.boss.EntityDragon"); var EntityGhast = Java.type("net.minecraft.entity.monster.EntityGhast"); var EntityGolem = Java.type("net.minecraft.entity.monster.EntityGolem"); var EntityMob = Java.type("net.minecraft.entity.monster.EntityMob"); var EntitySlime = Java.type("net.minecraft.entity.monster.EntitySlime"); var EntityAnimal = Java.type("net.minecraft.entity.passive.EntityAnimal"); var EntityBat = Java.type("net.minecraft.entity.passive.EntityBat"); var EntitySquid = Java.type("net.minecraft.entity.passive.EntitySquid"); var EntityVillager = Java.type("net.minecraft.entity.passive.EntityVillager"); var EntityPlayer = Java.type("net.minecraft.entity.player.EntityPlayer"); var ItemSword = Java.type("net.minecraft.item.ItemSword"); var C02PacketUseEntity = Java.type("net.minecraft.network.play.client.C02PacketUseEntity"); var C07PacketPlayerDigging = Java.type("net.minecraft.network.play.client.C07PacketPlayerDigging"); var C08PacketPlayerBlockPlacement = Java.type("net.minecraft.network.play.client.C08PacketPlayerBlockPlacement"); var AxisAlignedBB = Java.type("net.minecraft.util.AxisAlignedBB"); var BlockPos = Java.type("net.minecraft.util.BlockPos"); var EnumFacing = Java.type("net.minecraft.util.EnumFacing"); var Vec3 = Java.type("net.minecraft.util.Vec3"); var GL11 = Java.type("org.lwjgl.opengl.GL11"); function HmXixAura() { const setting = { float: function (name, def, min, max, object) { return object == null ? value.createFloat(name, def, min, max) : new _AdaptedValue(new (Java.extend(FloatValue, object))(name, def, min, max)); }, integer: function (name, def, min, max, object) { return object == null ? value.createInteger(name, def, min, max) : new _AdaptedValue(new (Java.extend(IntegerValue, object))(name, def, min, max)); }, boolean: function (name, def, object) { return object == null ? value.createBoolean(name, def) : new _AdaptedValue(new (Java.extend(BoolValue, object))(name, def)); }, list: function (name, values, def, object) { return object == null ? value.createList(name, values, def) : new _AdaptedValue(new (Java.extend(ListValue, object))(name, values, def)); }, text: function (name, def, object) { return object == null ? value.createText(name, def) : new _AdaptedValue(new (Java.extend(TextValue, object))(name, def)); } }; const settings = { maxDelay: setting.integer("MaxDelay", 100, 0, 1000, { onChanged: function (oldValue, newValue) { const i = settings.minDelay.get(); if (i > newValue) { settings.maxDelay.set(i); } } }), minDelay: setting.integer("MinDelay", 80, 0, 1000, { onChanged: function (oldValue, newValue) { const i = settings.maxDelay.get(); if (i < newValue) { settings.minDelay.set(i); } } }), hurtTime: setting.integer("HurtTime", 20, 0, 20), range: setting.float("Range", 8, 0, 10), blockRange: setting.float("BlockRange", 10, 0, 10), priority: setting.list("Priority", ["Armor", "Direction", "Distance", "Health", "HurtTime", "LivingTime"], "HurtTime"), throughWalls: setting.boolean("ThroughWalls", true), autoBlock: setting.boolean("AutoBlock", true), rotation: setting.list("Rotation", ["Off", "Strict", "Silent"], "Silent"), mark: setting.boolean("Mark", true) }; let target; let targetList = []; let attackDelay = 0; const attackTimer = new MSTimer(); const autoBlock = new AutoBlock(); const waitStateColor = new Color(126, 126, 126, 70); const attackStateColor = new Color(37, 126, 255, 70); this.getName = function () { return "HmXixAura"; } this.getDescription = function () { return "HmXixAura-Module, By-mumy"; } this.getCategory = function () { return "Misc"; } this.onEnable = function () { target = null; targetList = []; } this.onDisable = function () { this.onEnable(); autoBlock.reset(); } this.onUpdate = function () { if (mc.thePlayer.isRiding()) { update(); runAttack(); } } this.onMotion = function (event) { if (mc.thePlayer.isRiding()) { return; } if (event.getEventState() === EventState.PRE) { update(); } else { runAttack(); } } this.onRender3D = function (event) { if (settings.mark.get()) { for (let i = 0; i < targetList.length; ++i) { const entity = targetList[i]; RenderUtils.drawPlatform(entity, entity === target ? attackStateColor : waitStateColor); } } } this.onWorld = function (event) { moduleManager.getModule(this.getName()).setState(false); } this.addValues = function (values) { for (let i in settings) { values.add(settings[i]); } } function runAttack() { if (target == null) { return; } if (attackTimer.hasTimePassed(attackDelay)) { attackEntity(target); attackTimer.reset(); attackDelay = settings.minDelay.get() + Math.floor(Math.random() * (settings.maxDelay.get() - settings.minDelay.get())); } } function attackEntity(entity) { autoBlock.checkAndStop(); LiquidBounce.eventManager.callEvent(new AttackEvent(entity)); mc.thePlayer.swingItem(); mc.getNetHandler().addToSendQueue(new C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK)); if (settings.autoBlock.get() || autoBlock.isPlayerBlocking()) { autoBlock.checkAndStart(); } } function update() { updateTarget(); if (targetList.length === 0) { autoBlock.reset(); return; } if (target == null && settings.autoBlock.get()) { autoBlock.checkAndStart(); } autoBlock.checkAndUpdate(); } function updateTarget() { target = null; targetList = []; const player = mc.thePlayer; const entityList = mc.theWorld.loadedEntityList; const hurtTime = settings.hurtTime.get(); const range = settings.range.get(); const blockRange = settings.blockRange.get(); const throughWalls = settings.throughWalls.get(); for (let i = 0; i < entityList.length; ++i) { const entity = entityList[i]; if (!(entity.hurtResistantTime > hurtTime) && isEnemy(entity) && (player.canEntityBeSeen(entity) ? getDistanceToEntityBox(entity) < Math.max(blockRange, range) : throughWalls && getDistanceToEntityPosition(entity) < 3)) { targetList.push(entity); } } if (targetList.length === 0) { return; } switch (settings.priority.get()) { case "Armor": targetList.sort(function (a, b) { return a.getTotalArmorValue() - b.getTotalArmorValue(); }); break; case "HurtTime": targetList.sort(function (a, b) { return a.hurtResistantTime - b.hurtResistantTime; }); break; case "Health": targetList.sort(function (a, b) { return a.getHealth() - b.getHealth(); }); break; case "Distance": targetList.sort(function (a, b) { return getDistanceToEntityBox(a) - getDistanceToEntityBox(b); }); break; case "Direction": targetList.sort(function (a, b) { return RotationUtils.getRotationDifference(a) - RotationUtils.getRotationDifference(b); }); break; case "LivingTime": targetList.sort(function (a, b) { return b.ticksExisted - a.ticksExisted; }); break; } for (let i = 0; i < targetList.length; ++i) { const entity = targetList[i]; if (getDistanceToEntityBox(entity) < range && updateRotation(entity)) { target = entity; return; } } } function updateRotation(entity) { if (settings.rotation.get() === "Off") { return true; } const player = mc.thePlayer; const eyes = new Vec3(player.posX, player.posY + player.getEyeHeight(), player.posZ); const size = entity.getCollisionBorderSize(); const bb = entity.getEntityBoundingBox().expand(size, size, size) let vec = new Vec3( Math.max(bb.minX + (bb.maxX - bb.minX) * 0.05, Math.min(eyes.xCoord, bb.minX + (bb.maxX - bb.minX) * 0.95)), Math.max(bb.minY + (bb.maxY - bb.minY) * 0.05, Math.min(eyes.yCoord, bb.minY + (bb.maxY - bb.minY) * 0.95)), Math.max(bb.minZ + (bb.maxZ - bb.minZ) * 0.05, Math.min(eyes.zCoord, bb.minZ + (bb.maxZ - bb.minZ) * 0.95))); if (vec.xCoord === eyes.xCoord && vec.yCoord === eyes.yCoord && vec.zCoord === eyes.zCoord) { vec = new Vec3(bb.minX + (bb.maxX - bb.minX) * 0.5, eyes.yCoord, bb.minZ + (bb.maxZ - bb.minZ) * 0.5); } const rotation = RotationUtils.toRotation(vec, false); const gameSettings = mc.gameSettings; const mouseSensitivity = gameSettings.mouseSensitivity; const limitedRotation = RotationUtils.limitAngleChange(RotationUtils.serverRotation, rotation, 180); gameSettings.mouseSensitivity = 0; if (settings.rotation.get() === "Silent") { RotationUtils.setTargetRotation(rotation, 15); } else { limitedRotation.toPlayer(mc.thePlayer); } gameSettings.mouseSensitivity = mouseSensitivity; return true; } function isEnemy(entity) { if (entity instanceof EntityLivingBase && (EntityUtils.targetDead || entity.isEntityAlive() && entity.getHealth() > 0) && entity !== mc.thePlayer) { if (!EntityUtils.targetInvisible && entity.isInvisible()) { return false } if (EntityUtils.targetPlayer && entity instanceof EntityPlayer) { if (entity.isSpectator() || AntiBot.isBot(entity)) { return false } if (isFriend(entity) && !moduleManager.getModule("NoFriends").getState()) { return false; } const teams = LiquidBounce.moduleManager.getModule("Teams"); return !teams.getState() || !teams.isInYourTeam(entity); } return EntityUtils.targetMobs && isMob(entity) || EntityUtils.targetAnimals && isAnimal(entity); } return false; function isAnimal(entity) { return entity instanceof EntityAnimal || entity instanceof EntitySquid || entity instanceof EntityGolem || entity instanceof EntityBat; } function isFriend(entity) { return entity instanceof EntityPlayer && entity.getName() != null && LiquidBounce.fileManager.friendsConfig.isFriend(ColorUtils.stripColor(entity.getName())); } function isMob(entity) { return entity instanceof EntityMob || entity instanceof EntityVillager || entity instanceof EntitySlime || entity instanceof EntityGhast || entity instanceof EntityDragon; } } function getDistanceToEntityBox(entity) { const player = mc.thePlayer; const size = entity.getCollisionBorderSize(); const bb = entity.getEntityBoundingBox().expand(size, size, size); const eyeX = player.posX; const eyeY = player.posY + player.getEyeHeight(); const eyeZ = player.posZ; const xDist = eyeX - Math.max(bb.minX, Math.min(eyeX, bb.maxX)); const yDist = eyeY - Math.max(bb.minY, Math.min(eyeY, bb.maxY)); const zDist = eyeZ - Math.max(bb.minZ, Math.min(eyeZ, bb.maxZ)); return Math.sqrt(xDist * xDist + yDist * yDist + zDist * zDist); } function getDistanceToEntityPosition(entity) { const player = mc.thePlayer; const xDist = player.posX - entity.posX; const yDist = player.posY - entity.posY; const zDist = player.posZ - entity.posZ; return Math.sqrt(xDist * xDist + yDist * yDist + zDist * zDist); } function AutoBlock() { this.change = false; this.status = false; const blockPos = new BlockPos(-1, -1, -1); this.start = function () { this.change = true; this.status = true; const player = mc.thePlayer; player.setItemInUse(player.inventory.getCurrentItem(), 51213); mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(blockPos, 255, player.inventory.getCurrentItem(), 0, 0, 0)); KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), true); } this.stop = function () { this.change = true; this.status = false; mc.getNetHandler().addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, blockPos, EnumFacing.DOWN)); mc.thePlayer.stopUsingItem(); KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), false); } this.checkAndStop = function () { if (mc.thePlayer.isBlocking()) { this.stop(); } } this.checkAndStart = function () { if (!mc.thePlayer.isBlocking() && itemIsSword()) { this.start(); } } this.checkAndUpdate = function () { if (this.status && !itemIsSword() && !GameSettings.isKeyDown(mc.gameSettings.keyBindUseItem)) { this.stop(); } } this.reset = function () { if (!this.change) { return; } if (this.status && !GameSettings.isKeyDown(mc.gameSettings.keyBindUseItem)) { this.stop(); } this.change = false; } this.isPlayerBlocking = function () { return GameSettings.isKeyDown(mc.gameSettings.keyBindUseItem) && itemIsSword(); } function itemIsSword() { const heldItem = mc.thePlayer.getHeldItem(); return heldItem != null && heldItem.getItem() instanceof ItemSword; } } } let client; function onLoad() {} function onEnable() { client = moduleManager.registerModule(new HmXixAura()); } function onDisable() { moduleManager.unregisterModule(client); }
By mumy
-
@cookiechinese What anticheat does HmXix use?
-
-