From 8909120940953d11db1315d5cda506e4ab7edc26 Mon Sep 17 00:00:00 2001 From: Wks JanStudio <37088203+MrsRina@users.noreply.github.com> Date: Fri, 1 Jul 2022 00:44:02 -0300 Subject: [PATCH] CA calcs improved. --- .../ModuleAutoCrystalRewrite.java | 47 +++++++++++++------ .../render/ModuleAutoCrystalRender.java | 5 ++ 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/main/java/rina/onepop/club/client/module/combat/autocrystalrewrite/ModuleAutoCrystalRewrite.java b/src/main/java/rina/onepop/club/client/module/combat/autocrystalrewrite/ModuleAutoCrystalRewrite.java index ffc7549..da1892a 100644 --- a/src/main/java/rina/onepop/club/client/module/combat/autocrystalrewrite/ModuleAutoCrystalRewrite.java +++ b/src/main/java/rina/onepop/club/client/module/combat/autocrystalrewrite/ModuleAutoCrystalRewrite.java @@ -212,6 +212,7 @@ public void onPacketReceive(PacketEvent.Receive event) { this.placeCount.remove(pos); this.placeDelayMS.reset(); + this.breakDelayMS.reset(); } } @@ -230,6 +231,11 @@ public void onPacketReceive(PacketEvent.Receive event) { } } } + + if (hitList) { + this.placeCount.clear(); + this.hitCount.clear(); + } } } } @@ -297,7 +303,7 @@ public void onClientTickEvent(ClientTickEvent event) { } protected void update() { - if (this.breakDelayMS.isPassedMS(settingBreakDelay.getValue().floatValue()) && !settingPredict.getValue()) { + if (this.breakDelayMS.isPassedMS(settingBreakDelay.getValue().floatValue())) { this.entityID = this.findCrystalBreak(); if (this.entityID != -1) { @@ -410,23 +416,36 @@ protected BlockPos findCrystalPlace() { return null; } - BlockPos position = null; + final BlockPos selfPos = new BlockPos(mc.player.posX, mc.player.posY, mc.player.posZ); + float range = settingPlaceRange.getValue().floatValue(); - for (BlockPos places : CrystalUtil.getSphereCrystalPlace(settingPlaceRange.getValue().floatValue(), settingPlace113.getValue(), true)) { - float entityDamage = CrystalUtil.calculateDamage(places, this.entity); - float selfDamage = CrystalUtil.calculateDamage(places, mc.player); + for (int x = (int) (selfPos.x - range); x <= selfPos.x + range; x++) { + for (int z = (int) (selfPos.z - range); z <= selfPos.z + range; z++) { + for (int y = (int) (selfPos.y - range); y <= selfPos.y + range; y++) { + double dist = (selfPos.x - x) * (selfPos.x - x) + (selfPos.z - z) * (selfPos.z - z) + (selfPos.y - y) * (selfPos.y - y); - if (this.entity.getDistance(places.x, places.y, places.z) >= 6.0f) { - continue; - } + if (dist < range * range) { + BlockPos block = new BlockPos(x, y, z); - if (settingWallCheck.getValue() && mc.player.getDistance(places.x, places.y, places.z) > settingWallRange.getValue().floatValue() && mc.world.rayTraceBlocks(new Vec3d(mc.player.posX, mc.player.posY + (double) mc.player.getEyeHeight(), mc.player.posZ), new Vec3d(places.getX() + 0.5f, places.getY() - settingFacingY.getValue().floatValue(), places.getZ() + 0.5f), false, true, false) != null) { - continue; - } + if (CrystalUtil.isCrystalPlaceable(block, settingPlace113.getValue(), true)) { + float entityDamage = CrystalUtil.calculateDamage(block, this.entity); + float selfDamage = CrystalUtil.calculateDamage(block, mc.player); - if (entityDamage > settingMinimumDamage.getValue().floatValue() && entityDamage > damage && selfDamage < settingSelfDamage.getValue().floatValue()) { - damage = entityDamage; - position = places; + if (this.entity.getDistance(block.x, block.y, block.z) >= 6.0f) { + continue; + } + + if (settingWallCheck.getValue() && mc.player.getDistance(block.x, block.y, block.z) > settingWallRange.getValue().floatValue() && mc.world.rayTraceBlocks(new Vec3d(mc.player.posX, mc.player.posY + (double) mc.player.getEyeHeight(), mc.player.posZ), new Vec3d(block.getX() + 0.5f, block.getY() - settingFacingY.getValue().floatValue(), block.getZ() + 0.5f), false, true, false) != null) { + continue; + } + + if (entityDamage > settingMinimumDamage.getValue().floatValue() && entityDamage > damage && selfDamage < settingSelfDamage.getValue().floatValue()) { + damage = entityDamage; + position = block; + } + } + } + } } } diff --git a/src/main/java/rina/onepop/club/client/module/render/ModuleAutoCrystalRender.java b/src/main/java/rina/onepop/club/client/module/render/ModuleAutoCrystalRender.java index 929b7ca..b4ddcb1 100644 --- a/src/main/java/rina/onepop/club/client/module/render/ModuleAutoCrystalRender.java +++ b/src/main/java/rina/onepop/club/client/module/render/ModuleAutoCrystalRender.java @@ -69,6 +69,11 @@ public ModuleAutoCrystalRender() { INSTANCE = this; } + @Override + public void onEnable() { + this.renderList.clear(); + } + @Listener public void onPacketReceive(PacketEvent.Receive event) { if (event.getPacket() instanceof SPacketSpawnObject) {