From 19573c88826407516e41b4bbda4e4ce686da414c Mon Sep 17 00:00:00 2001 From: blockparole <> Date: Sun, 27 Oct 2019 14:42:54 +0100 Subject: [PATCH 1/8] "32k Only" Setting for Aura --- .../kami/module/modules/combat/Aura.java | 70 ++++++++++++------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Aura.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Aura.java index 2d67da49..d53e457c 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Aura.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Aura.java @@ -23,7 +23,7 @@ import java.util.Iterator; /** * Created by 086 on 12/12/2017. - * Last Updated 5 August 2019 by hub + * Updated by hub on 25 October 2019 */ @Module.Info(name = "Aura", category = Module.Category.COMBAT, description = "Hits entities around you") public class Aura extends Module { @@ -34,13 +34,16 @@ public class Aura extends Module { private Setting range = register(Settings.d("Range", 5.5d)); private Setting wait = register(Settings.b("Wait", true)); private Setting walls = register(Settings.b("Walls", false)); - private Setting sharpness = register(Settings.b("32k Switch", false)); + private Setting switchTo32k = register(Settings.b("32k Switch", false)); + private Setting onlyUse32k = register(Settings.b("32k Only", false)); @Override public void onUpdate() { + if (mc.player.isDead) { return; } + boolean shield = mc.player.getHeldItemOffhand().getItem().equals(Items.SHIELD) && mc.player.getActiveHand() == EnumHand.OFF_HAND; if (mc.player.isHandActive() && !shield) { return; @@ -80,7 +83,10 @@ public class Aura extends Module { return; } else { if (EntityUtil.isPassive(target) ? animals.getValue() : (EntityUtil.isMobAggressive(target) && mobs.getValue())) { - if (ModuleManager.isModuleEnabled("AutoTool")) { + // We want to skip this if switchTo32k.getValue() is true, + // because it only accounts for tools and weapons. + // Maybe someone could refactor this later? :3 + if (!switchTo32k.getValue() && ModuleManager.isModuleEnabled("AutoTool")) { AutoTool.equipBestWeapon(); } attack(target); @@ -88,6 +94,7 @@ public class Aura extends Module { } } } + } private boolean checkSharpness(ItemStack stack) { @@ -97,17 +104,20 @@ public class Aura extends Module { } NBTTagList enchants = (NBTTagList) stack.getTagCompound().getTag("ench"); - - if (enchants == null) { - return false; - } - + + // IntelliJ marks (enchants == null) as always false but this is not correct. + // In case of a Hotbar Slot without any Enchantment on the Stack it contains, + // this will throw a NullPointerException if not accounted for! + //noinspection ConstantConditions + if (enchants == null) { + return false; + } for (int i = 0; i < enchants.tagCount(); i++) { - NBTTagCompound enchant = ((NBTTagList) enchants).getCompoundTagAt(i); + NBTTagCompound enchant = enchants.getCompoundTagAt(i); if (enchant.getInteger("id") == 16) { int lvl = enchant.getInteger("lvl"); - if (lvl >= 16) { + if (lvl >= 42) { // dia sword against full prot 5 armor is deadly somehere >= 34 sharpness iirc return true; } break; @@ -120,29 +130,36 @@ public class Aura extends Module { private void attack(Entity e) { - if (sharpness.getValue()) { + boolean holding32k = false; - if (!checkSharpness(mc.player.getHeldItemMainhand())) { + if (checkSharpness(mc.player.getHeldItemMainhand())) { + holding32k = true; + } - int newSlot = -1; + if (switchTo32k.getValue() && !holding32k) { - for (int i = 0; i < 9; i++) { - ItemStack stack = mc.player.inventory.getStackInSlot(i); - if (stack == ItemStack.EMPTY) { - continue; - } - if (checkSharpness(stack)) { - newSlot = i; - break; - } + int newSlot = -1; + + for (int i = 0; i < 9; i++) { + ItemStack stack = mc.player.inventory.getStackInSlot(i); + if (stack == ItemStack.EMPTY) { + continue; } - - if (newSlot != -1) { - mc.player.inventory.currentItem = newSlot; + if (checkSharpness(stack)) { + newSlot = i; + break; } - } + if (newSlot != -1) { + mc.player.inventory.currentItem = newSlot; + holding32k = true; + } + + } + + if (onlyUse32k.getValue() && !holding32k) { + return; } mc.playerController.attackEntity(mc.player, e); @@ -160,4 +177,5 @@ public class Aura extends Module { private boolean canEntityFeetBeSeen(Entity entityIn) { return mc.world.rayTraceBlocks(new Vec3d(mc.player.posX, mc.player.posX + mc.player.getEyeHeight(), mc.player.posZ), new Vec3d(entityIn.posX, entityIn.posY, entityIn.posZ), false, true, false) == null; } + } From ead6e279fae56bce2744c5a581f253fde9f3cbbf Mon Sep 17 00:00:00 2001 From: blockparole <> Date: Sun, 27 Oct 2019 15:34:46 +0100 Subject: [PATCH 2/8] Auto32k --- .../kami/module/modules/combat/Auto32k.java | 278 ++++++++++++++++++ 1 file changed, 278 insertions(+) create mode 100644 src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java new file mode 100644 index 00000000..2dd3bc24 --- /dev/null +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java @@ -0,0 +1,278 @@ +package me.zeroeightsix.kami.module.modules.combat; + +import me.zeroeightsix.kami.command.Command; +import me.zeroeightsix.kami.module.Module; +import me.zeroeightsix.kami.module.ModuleManager; +import me.zeroeightsix.kami.setting.Setting; +import me.zeroeightsix.kami.setting.Settings; +import me.zeroeightsix.kami.util.Wrapper; +import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; +import net.minecraft.block.BlockLiquid; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.ClickType; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.CPacketEntityAction; +import net.minecraft.network.play.client.CPacketPlayer; +import net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; + +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.util.Arrays; +import java.util.List; + +/** + * Created by hub on 7 August 2019 + * Updated by hub on 25 October 2019 + */ +@Module.Info(name = "Auto32k", category = Module.Category.COMBAT) +public class Auto32k extends Module { + + private static final DecimalFormat df = new DecimalFormat("#.#"); + private static final List shulkerList = Arrays.asList( + Blocks.WHITE_SHULKER_BOX, + Blocks.ORANGE_SHULKER_BOX, + Blocks.MAGENTA_SHULKER_BOX, + Blocks.LIGHT_BLUE_SHULKER_BOX, + Blocks.YELLOW_SHULKER_BOX, + Blocks.LIME_SHULKER_BOX, + Blocks.PINK_SHULKER_BOX, + Blocks.GRAY_SHULKER_BOX, + Blocks.SILVER_SHULKER_BOX, + Blocks.CYAN_SHULKER_BOX, + Blocks.PURPLE_SHULKER_BOX, + Blocks.BLUE_SHULKER_BOX, + Blocks.BROWN_SHULKER_BOX, + Blocks.GREEN_SHULKER_BOX, + Blocks.RED_SHULKER_BOX, + Blocks.BLACK_SHULKER_BOX + ); + + private Setting moveToHotbar = register(Settings.b("Move 32k to Hotbar", true)); + private Setting placeRange = register(Settings.d("Place Range", 4.0d)); + private Setting placeClose = register(Settings.b("Place close to Player", false)); + private Setting placeBehind = register(Settings.b("Place behind", true)); + private Setting placeObi = register(Settings.b("Obi on Top", true)); + private Setting spoofRotation = register(Settings.b("Spoof Rotation", true)); + private Setting debugMessages = register(Settings.b("Debug Messages", false)); + + private int swordSlot; + + private static void placeBlock(BlockPos pos, boolean spoofRotation) { + + if (!Wrapper.getWorld().getBlockState(pos).getMaterial().isReplaceable()) { + return; + } + + for (EnumFacing side : EnumFacing.values()) { + + BlockPos neighbor = pos.offset(side); + EnumFacing side2 = side.getOpposite(); + + if (!Wrapper.getWorld().getBlockState(neighbor).getBlock().canCollideCheck(Wrapper.getWorld().getBlockState(neighbor), false)) { + continue; + } + + Vec3d hitVec = new Vec3d(neighbor).add(0.5, 0.5, 0.5).add(new Vec3d(side2.getDirectionVec()).scale(0.5)); + + if (spoofRotation) { + Vec3d eyesPos = new Vec3d(Wrapper.getPlayer().posX, Wrapper.getPlayer().posY + Wrapper.getPlayer().getEyeHeight(), Wrapper.getPlayer().posZ); + double diffX = hitVec.x - eyesPos.x; + double diffY = hitVec.y - eyesPos.y; + double diffZ = hitVec.z - eyesPos.z; + double diffXZ = Math.sqrt(diffX * diffX + diffZ * diffZ); + float yaw = (float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90F; + float pitch = (float) -Math.toDegrees(Math.atan2(diffY, diffXZ)); + Wrapper.getPlayer().connection.sendPacket(new CPacketPlayer.Rotation(Wrapper.getPlayer().rotationYaw + MathHelper.wrapDegrees(yaw - Wrapper.getPlayer().rotationYaw), Wrapper.getPlayer().rotationPitch + MathHelper.wrapDegrees(pitch - Wrapper.getPlayer().rotationPitch), Wrapper.getPlayer().onGround)); + } + + mc.playerController.processRightClickBlock(Wrapper.getPlayer(), mc.world, neighbor, side2, hitVec, EnumHand.MAIN_HAND); + Wrapper.getPlayer().swingArm(EnumHand.MAIN_HAND); + mc.rightClickDelayTimer = 4; + + return; + + } + + } + + @Override + protected void onEnable() { + + if (isDisabled() || mc.player == null || ModuleManager.isModuleEnabled("Freecam")) { + this.disable(); + return; + } + + df.setRoundingMode(RoundingMode.CEILING); + + int hopperSlot = -1; + int shulkerSlot = -1; + int obiSlot = -1; + swordSlot = -1; + + for (int i = 0; i < 9; i++) { + + if (hopperSlot != -1 && shulkerSlot != -1 && obiSlot != -1) { + break; + } + + ItemStack stack = Wrapper.getPlayer().inventory.getStackInSlot(i); + + if (stack == ItemStack.EMPTY || !(stack.getItem() instanceof ItemBlock)) { + continue; + } + + Block block = ((ItemBlock) stack.getItem()).getBlock(); + + if (block == Blocks.HOPPER) { + hopperSlot = i; + } else if (shulkerList.contains(block)) { + shulkerSlot = i; + } else if (block == Blocks.OBSIDIAN) { + obiSlot = i; + } + + } + + BlockPos basePos = new BlockPos(mc.player.getPositionVector()); + + if (hopperSlot == -1) { + if (debugMessages.getValue()) { + Command.sendChatMessage("Hopper missing, disabling."); + } + this.disable(); + return; + } + + if (shulkerSlot == -1) { + if (debugMessages.getValue()) { + Command.sendChatMessage("Shulker missing, disabling."); + } + this.disable(); + return; + } + + EnumFacing facingDirection; + BlockPos placeTestNextPos = basePos; + BlockPos placeTestSuccessfull = null; + + if (placeBehind.getValue()) { + facingDirection = EnumFacing.fromAngle(mc.player.rotationYaw).getOpposite(); + } else { + facingDirection = EnumFacing.fromAngle(mc.player.rotationYaw); + } + + int range = (int) Math.ceil(placeRange.getValue()); + + // searching placeable area in front / behind the player in a straight line + // we could test interations on both sides of the player while range - n (where n is iterations) + // but i think this would not work in most cases cause of raytrace checks on click + for (int i = range; i > 0; i--) { + placeTestNextPos = placeTestNextPos.add(facingDirection.getXOffset(), 0, facingDirection.getZOffset()); + if (!mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(placeTestNextPos)).isEmpty()) { + continue; // entity on block + } + if (!Wrapper.getWorld().getBlockState(placeTestNextPos).getMaterial().isReplaceable()) { + continue; // no space for hopper + } + if (!Wrapper.getWorld().getBlockState(placeTestNextPos.add(0, 1, 0)).getMaterial().isReplaceable()) { + continue; // no space for shulker + } + if (Wrapper.getWorld().getBlockState(placeTestNextPos.add(0, -1, 0)).getBlock() instanceof BlockAir) { + continue; // air below hopper + } + if (Wrapper.getWorld().getBlockState(placeTestNextPos.add(0, -1, 0)).getBlock() instanceof BlockLiquid) { + continue; // liquid below hopper + } + if (mc.player.getPositionVector().distanceTo(new Vec3d(placeTestNextPos)) > placeRange.getValue()) { + continue; // out of range + } + placeTestSuccessfull = placeTestNextPos; + if (placeClose.getValue()) { + break; + } + } + + if (placeTestSuccessfull == null) { + if (debugMessages.getValue()) { + Command.sendChatMessage("Not enough space, disabling."); + } + this.disable(); + return; + } + + BlockPos placeTargetPos = placeTestSuccessfull; + + if (debugMessages.getValue()) { + Command.sendChatMessage("Place Target: " + placeTargetPos.toString() + " Distance: " + df.format(mc.player.getPositionVector().distanceTo(new Vec3d(placeTargetPos)))); + } + + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING)); + + Wrapper.getPlayer().inventory.currentItem = hopperSlot; + placeBlock(new BlockPos(placeTargetPos), spoofRotation.getValue()); + + Wrapper.getPlayer().inventory.currentItem = shulkerSlot; + placeBlock(new BlockPos(placeTargetPos.add(0, 1, 0)), spoofRotation.getValue()); + + if (placeObi.getValue() && obiSlot != -1) { + Wrapper.getPlayer().inventory.currentItem = obiSlot; + placeBlock(new BlockPos(placeTargetPos.add(0, 2, 0)), spoofRotation.getValue()); + } + + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); + + Wrapper.getPlayer().inventory.currentItem = shulkerSlot; + BlockPos hopperPos = new BlockPos(placeTargetPos); + mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(hopperPos, EnumFacing.DOWN, EnumHand.MAIN_HAND, 0, 0, 0)); + swordSlot = shulkerSlot + 32; + + } + + @Override + public void onUpdate() { + + if (isDisabled() || mc.player == null || ModuleManager.isModuleEnabled("Freecam")) { + return; + } + + if (!(mc.currentScreen instanceof GuiContainer)) { + return; + } + + if (!moveToHotbar.getValue()) { + this.disable(); + return; + } + + if (swordSlot == -1) { + return; + } + + boolean swapReady = true; + + if (((GuiContainer) mc.currentScreen).inventorySlots.getSlot(0).getStack().isEmpty) { + swapReady = false; + } + + if (!((GuiContainer) mc.currentScreen).inventorySlots.getSlot(swordSlot).getStack().isEmpty) { + swapReady = false; + } + + if (swapReady) { + mc.playerController.windowClick(((GuiContainer) mc.currentScreen).inventorySlots.windowId, 0, swordSlot - 32, ClickType.SWAP, mc.player); + this.disable(); + } + + } + +} From ed7919f686c4462e9437b1afb66c9804c2363bdd Mon Sep 17 00:00:00 2001 From: blockparole <> Date: Sun, 27 Oct 2019 15:54:36 +0100 Subject: [PATCH 3/8] Auto32k Y Offset --- .../kami/module/modules/combat/Auto32k.java | 57 ++++++++++++------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java index 2dd3bc24..6307322f 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java @@ -10,6 +10,9 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockAir; import net.minecraft.block.BlockLiquid; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.entity.RenderEntityItem; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; import net.minecraft.inventory.ClickType; import net.minecraft.item.ItemBlock; @@ -177,28 +180,38 @@ public class Auto32k extends Module { // we could test interations on both sides of the player while range - n (where n is iterations) // but i think this would not work in most cases cause of raytrace checks on click for (int i = range; i > 0; i--) { - placeTestNextPos = placeTestNextPos.add(facingDirection.getXOffset(), 0, facingDirection.getZOffset()); - if (!mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(placeTestNextPos)).isEmpty()) { - continue; // entity on block - } - if (!Wrapper.getWorld().getBlockState(placeTestNextPos).getMaterial().isReplaceable()) { - continue; // no space for hopper - } - if (!Wrapper.getWorld().getBlockState(placeTestNextPos.add(0, 1, 0)).getMaterial().isReplaceable()) { - continue; // no space for shulker - } - if (Wrapper.getWorld().getBlockState(placeTestNextPos.add(0, -1, 0)).getBlock() instanceof BlockAir) { - continue; // air below hopper - } - if (Wrapper.getWorld().getBlockState(placeTestNextPos.add(0, -1, 0)).getBlock() instanceof BlockLiquid) { - continue; // liquid below hopper - } - if (mc.player.getPositionVector().distanceTo(new Vec3d(placeTestNextPos)) > placeRange.getValue()) { - continue; // out of range - } - placeTestSuccessfull = placeTestNextPos; - if (placeClose.getValue()) { - break; + // max y Offset is 2 Blocks (3 iterations) + for (int yOffset = 0; yOffset < 3; yOffset++) { + placeTestNextPos = placeTestNextPos.add(facingDirection.getXOffset(), -1 * yOffset, facingDirection.getZOffset()); + boolean EntityLivingBaseOnTargetBlockPos = false; + for (Entity entity : mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(placeTestNextPos))) { + if (entity instanceof EntityLivingBase) { + EntityLivingBaseOnTargetBlockPos = true; + break; + } + } + if (EntityLivingBaseOnTargetBlockPos) { + continue; // entity on block + } + if (!Wrapper.getWorld().getBlockState(placeTestNextPos).getMaterial().isReplaceable()) { + continue; // no space for hopper + } + if (!Wrapper.getWorld().getBlockState(placeTestNextPos.add(0, 1, 0)).getMaterial().isReplaceable()) { + continue; // no space for shulker + } + if (Wrapper.getWorld().getBlockState(placeTestNextPos.add(0, -1, 0)).getBlock() instanceof BlockAir) { + continue; // air below hopper + } + if (Wrapper.getWorld().getBlockState(placeTestNextPos.add(0, -1, 0)).getBlock() instanceof BlockLiquid) { + continue; // liquid below hopper + } + if (mc.player.getPositionVector().distanceTo(new Vec3d(placeTestNextPos)) > placeRange.getValue()) { + continue; // out of range + } + placeTestSuccessfull = placeTestNextPos; + if (placeClose.getValue()) { + break; + } } } From 749947579aac5902ede98803beeac694332e744d Mon Sep 17 00:00:00 2001 From: blockparole <> Date: Sun, 27 Oct 2019 16:43:11 +0100 Subject: [PATCH 4/8] Auto32k Y Offset Bugfix --- .../kami/module/modules/combat/Auto32k.java | 41 ++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java index 6307322f..522a1d89 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java @@ -10,7 +10,6 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockAir; import net.minecraft.block.BlockLiquid; import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.entity.RenderEntityItem; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; @@ -61,7 +60,7 @@ public class Auto32k extends Module { private Setting moveToHotbar = register(Settings.b("Move 32k to Hotbar", true)); private Setting placeRange = register(Settings.d("Place Range", 4.0d)); - private Setting placeClose = register(Settings.b("Place close to Player", false)); + private Setting yOffset = register(Settings.i("Y Offset (both directions)", 2)); private Setting placeBehind = register(Settings.b("Place behind", true)); private Setting placeObi = register(Settings.b("Obi on Top", true)); private Setting spoofRotation = register(Settings.b("Spoof Rotation", true)); @@ -175,44 +174,58 @@ public class Auto32k extends Module { } int range = (int) Math.ceil(placeRange.getValue()); + //int yOffsetSanitized = yOffset.getValue() < 0 ? -1 * yOffset.getValue() : yOffset.getValue(); + int yOffsetSanitized = yOffset.getValue(); // searching placeable area in front / behind the player in a straight line // we could test interations on both sides of the player while range - n (where n is iterations) // but i think this would not work in most cases cause of raytrace checks on click for (int i = range; i > 0; i--) { + + placeTestNextPos = placeTestNextPos.add(facingDirection.getXOffset(), 0, facingDirection.getZOffset()); + // max y Offset is 2 Blocks (3 iterations) - for (int yOffset = 0; yOffset < 3; yOffset++) { - placeTestNextPos = placeTestNextPos.add(facingDirection.getXOffset(), -1 * yOffset, facingDirection.getZOffset()); + for (int j = -1 * yOffsetSanitized; j < (1 + yOffsetSanitized); j++) { + + BlockPos placeTestNextPosOffsetY = placeTestNextPos.add(0, j, 0); + boolean EntityLivingBaseOnTargetBlockPos = false; - for (Entity entity : mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(placeTestNextPos))) { + for (Entity entity : mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(placeTestNextPosOffsetY))) { if (entity instanceof EntityLivingBase) { EntityLivingBaseOnTargetBlockPos = true; break; } } + if (EntityLivingBaseOnTargetBlockPos) { continue; // entity on block } - if (!Wrapper.getWorld().getBlockState(placeTestNextPos).getMaterial().isReplaceable()) { + + if (!Wrapper.getWorld().getBlockState(placeTestNextPosOffsetY).getMaterial().isReplaceable()) { continue; // no space for hopper } - if (!Wrapper.getWorld().getBlockState(placeTestNextPos.add(0, 1, 0)).getMaterial().isReplaceable()) { + + if (!Wrapper.getWorld().getBlockState(placeTestNextPosOffsetY.add(0, 1, 0)).getMaterial().isReplaceable()) { continue; // no space for shulker } - if (Wrapper.getWorld().getBlockState(placeTestNextPos.add(0, -1, 0)).getBlock() instanceof BlockAir) { + + if (Wrapper.getWorld().getBlockState(placeTestNextPosOffsetY.add(0, -1, 0)).getBlock() instanceof BlockAir) { continue; // air below hopper } - if (Wrapper.getWorld().getBlockState(placeTestNextPos.add(0, -1, 0)).getBlock() instanceof BlockLiquid) { + + if (Wrapper.getWorld().getBlockState(placeTestNextPosOffsetY.add(0, -1, 0)).getBlock() instanceof BlockLiquid) { continue; // liquid below hopper } - if (mc.player.getPositionVector().distanceTo(new Vec3d(placeTestNextPos)) > placeRange.getValue()) { + + if (mc.player.getPositionVector().distanceTo(new Vec3d(placeTestNextPosOffsetY)) > placeRange.getValue()) { continue; // out of range } - placeTestSuccessfull = placeTestNextPos; - if (placeClose.getValue()) { - break; - } + + placeTestSuccessfull = placeTestNextPosOffsetY; + break; + } + } if (placeTestSuccessfull == null) { From 9b917890e5c43a6e4635444de7040507a755fa60 Mon Sep 17 00:00:00 2001 From: blockparole <> Date: Sun, 27 Oct 2019 17:02:27 +0100 Subject: [PATCH 5/8] Auto32k Raytrace Check --- .../kami/module/modules/combat/Auto32k.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java index 522a1d89..5feef27f 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java @@ -21,10 +21,7 @@ import net.minecraft.network.play.client.CPacketPlayer; import net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.*; import java.math.RoundingMode; import java.text.DecimalFormat; @@ -60,10 +57,11 @@ public class Auto32k extends Module { private Setting moveToHotbar = register(Settings.b("Move 32k to Hotbar", true)); private Setting placeRange = register(Settings.d("Place Range", 4.0d)); - private Setting yOffset = register(Settings.i("Y Offset (both directions)", 2)); + private Setting yOffset = register(Settings.i("Y Offset (up and down)", 2)); private Setting placeBehind = register(Settings.b("Place behind", true)); private Setting placeObi = register(Settings.b("Obi on Top", true)); private Setting spoofRotation = register(Settings.b("Spoof Rotation", true)); + private Setting raytraceCheck = register(Settings.b("Raytrace Check", true)); private Setting debugMessages = register(Settings.b("Debug Messages", false)); private int swordSlot; @@ -221,6 +219,13 @@ public class Auto32k extends Module { continue; // out of range } + if (raytraceCheck.getValue()) { + RayTraceResult result = mc.world.rayTraceBlocks(new Vec3d(mc.player.posX, mc.player.posY + mc.player.getEyeHeight(), mc.player.posZ), new Vec3d(placeTestNextPosOffsetY), false, true, false); + if (!(result == null || result.getBlockPos().equals(placeTestNextPosOffsetY))) { + continue; + } + } + placeTestSuccessfull = placeTestNextPosOffsetY; break; From c895b89e0e0737049c9c6bb27090eadf6758a33d Mon Sep 17 00:00:00 2001 From: blockparole <> Date: Sun, 27 Oct 2019 17:04:02 +0100 Subject: [PATCH 6/8] Aura Raytrace Bugfix --- .../java/me/zeroeightsix/kami/module/modules/combat/Aura.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Aura.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Aura.java index d53e457c..79a017a1 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Aura.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Aura.java @@ -23,7 +23,7 @@ import java.util.Iterator; /** * Created by 086 on 12/12/2017. - * Updated by hub on 25 October 2019 + * Updated by hub on 27 October 2019 */ @Module.Info(name = "Aura", category = Module.Category.COMBAT, description = "Hits entities around you") public class Aura extends Module { @@ -175,7 +175,7 @@ public class Aura extends Module { } private boolean canEntityFeetBeSeen(Entity entityIn) { - return mc.world.rayTraceBlocks(new Vec3d(mc.player.posX, mc.player.posX + mc.player.getEyeHeight(), mc.player.posZ), new Vec3d(entityIn.posX, entityIn.posY, entityIn.posZ), false, true, false) == null; + return mc.world.rayTraceBlocks(new Vec3d(mc.player.posX, mc.player.posY + mc.player.getEyeHeight(), mc.player.posZ), new Vec3d(entityIn.posX, entityIn.posY, entityIn.posZ), false, true, false) == null; } } From 286446c5b5b1a7712f15ae5baa8806a003f106a6 Mon Sep 17 00:00:00 2001 From: blockparole <> Date: Sun, 27 Oct 2019 17:08:10 +0100 Subject: [PATCH 7/8] =?UTF-8?q?=F0=9F=8E=85=F0=9F=8F=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../me/zeroeightsix/kami/module/modules/combat/Auto32k.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java index 5feef27f..a4e81be1 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java @@ -30,7 +30,7 @@ import java.util.List; /** * Created by hub on 7 August 2019 - * Updated by hub on 25 October 2019 + * Updated by hub on 27 October 2019 */ @Module.Info(name = "Auto32k", category = Module.Category.COMBAT) public class Auto32k extends Module { From fee61e7ca260e2351d1a1ad3a5bd0594b7b11c94 Mon Sep 17 00:00:00 2001 From: blockparole <> Date: Sun, 27 Oct 2019 17:48:45 +0100 Subject: [PATCH 8/8] forgot this sanitization, also clarified some comments --- .../kami/module/modules/combat/Auto32k.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java index a4e81be1..39bc4250 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/Auto32k.java @@ -172,18 +172,19 @@ public class Auto32k extends Module { } int range = (int) Math.ceil(placeRange.getValue()); - //int yOffsetSanitized = yOffset.getValue() < 0 ? -1 * yOffset.getValue() : yOffset.getValue(); - int yOffsetSanitized = yOffset.getValue(); + int yOffsetSanitized = yOffset.getValue() < 0 ? -1 * yOffset.getValue() : yOffset.getValue(); - // searching placeable area in front / behind the player in a straight line - // we could test interations on both sides of the player while range - n (where n is iterations) - // but i think this would not work in most cases cause of raytrace checks on click + // Searching placeable area in front / behind the player in a straight line + // We could test iterations on both sides of the player while range - n (where n is iteration count). + // Just realized i also could reuse getSphere() from CrystalAura, but it would need a sorting for optimal + // placement of the hopper and i dont really have time for that right now. + // Also i think this would not work in most cases cause of raytrace checks on click. for (int i = range; i > 0; i--) { placeTestNextPos = placeTestNextPos.add(facingDirection.getXOffset(), 0, facingDirection.getZOffset()); // max y Offset is 2 Blocks (3 iterations) - for (int j = -1 * yOffsetSanitized; j < (1 + yOffsetSanitized); j++) { + for (int j = (-1 * yOffsetSanitized); j < (1 + yOffsetSanitized); j++) { BlockPos placeTestNextPosOffsetY = placeTestNextPos.add(0, j, 0);