From 8fc5e1d366aa7f5e7784e91436c362e42509987b Mon Sep 17 00:00:00 2001 From: blockparole <48992448+blockparole@users.noreply.github.com> Date: Thu, 21 Nov 2019 18:47:57 +0100 Subject: [PATCH 01/12] Add BlockInteractionHelper Util Class --- .../kami/module/modules/combat/Auto32k.java | 66 +------ .../kami/module/modules/player/Scaffold.java | 147 +-------------- .../kami/util/BlockInteractionHelper.java | 170 ++++++++++++++++++ 3 files changed, 179 insertions(+), 204 deletions(-) create mode 100644 src/main/java/me/zeroeightsix/kami/util/BlockInteractionHelper.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 index bad3569a..355970e7 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 @@ -27,56 +27,27 @@ import net.minecraft.util.math.Vec3d; import java.math.RoundingMode; import java.text.DecimalFormat; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import static me.zeroeightsix.kami.module.modules.combat.CrystalAura.getPlayerPos; -import static me.zeroeightsix.kami.module.modules.player.Scaffold.faceVectorPacketInstant; +import static me.zeroeightsix.kami.util.BlockInteractionHelper.*; /** * Created by hub on 7 August 2019 - * Updated by hub on 31 October 2019 + * Updated by hub on 21 November 2019 */ @Module.Info(name = "Auto32k", category = Module.Category.COMBAT, description = "Do not use with any AntiGhostBlock Mod!") public class Auto32k extends Module { - private static final List blackList = Arrays.asList( - Blocks.ENDER_CHEST, - Blocks.CHEST, - Blocks.TRAPPED_CHEST, - Blocks.CRAFTING_TABLE, - Blocks.ANVIL, - Blocks.BREWING_STAND, - Blocks.HOPPER, - Blocks.DROPPER, - Blocks.DISPENSER, - Blocks.TRAPDOOR - ); - - 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 static final DecimalFormat df = new DecimalFormat("#.#"); private Setting moveToHotbar = register(Settings.b("Move 32k to Hotbar", true)); private Setting autoEnableHitAura = register(Settings.b("Auto enable Hit Aura", true)); private Setting placeRange = register(Settings.d("Place Range", 4.0d)); - private Setting yOffset = register(Settings.i("Y Offset (Hopper)", 2)); + private Setting yOffset = register(Settings.i("Y Offset (Hopper)", 1)); private Setting placeCloseToEnemy = register(Settings.b("Place close to enemy", false)); private Setting placeObiOnTop = register(Settings.b("Place Obi on Top", true)); private Setting debugMessages = register(Settings.b("Debug Messages", false)); @@ -376,27 +347,4 @@ public class Auto32k extends Module { } - private static boolean checkForNeighbours(BlockPos blockPos) { - if (!hasNeighbour(blockPos)) { - for (EnumFacing side : EnumFacing.values()) { - BlockPos neighbour = blockPos.offset(side); - if (hasNeighbour(neighbour)) { - return true; - } - } - return false; - } - return true; - } - - private static boolean hasNeighbour(BlockPos blockPos) { - for (EnumFacing side : EnumFacing.values()) { - BlockPos neighbour = blockPos.offset(side); - if (!mc.world.getBlockState(neighbour).getMaterial().isReplaceable()) { - return true; - } - } - return false; - } - } diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/player/Scaffold.java b/src/main/java/me/zeroeightsix/kami/module/modules/player/Scaffold.java index 879ab0ac..59ce3a5c 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/player/Scaffold.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/player/Scaffold.java @@ -1,59 +1,26 @@ package me.zeroeightsix.kami.module.modules.player; -import com.google.common.collect.Lists; -import me.zeroeightsix.kami.command.Command; -import me.zeroeightsix.kami.event.events.RenderEvent; 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.setting.builder.SettingBuilder; import me.zeroeightsix.kami.util.EntityUtil; -import me.zeroeightsix.kami.util.GeometryMasks; -import me.zeroeightsix.kami.util.KamiTessellator; import me.zeroeightsix.kami.util.Wrapper; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockFalling; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.PlayerControllerMP; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import net.minecraft.network.play.client.CPacketPlayer; -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 org.lwjgl.opengl.GL11; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +import static me.zeroeightsix.kami.util.BlockInteractionHelper.*; @Module.Info(name = "Scaffold", category = Module.Category.PLAYER) public class Scaffold extends Module { - private List blackList = Arrays.asList(new Block[] { - Blocks.ENDER_CHEST, - Blocks.CHEST, - Blocks.TRAPPED_CHEST, - }); - private Setting future = register(Settings.integerBuilder("Ticks").withMinimum(0).withMaximum(60).withValue(2)); - private boolean hasNeighbour(BlockPos blockPos) { - for (EnumFacing side : EnumFacing.values()) { - BlockPos neighbour = blockPos.offset(side); - if(!Wrapper.getWorld().getBlockState(neighbour).getMaterial().isReplaceable()) - return true; - } - return false; - } - @Override public void onUpdate() { if (isDisabled() || mc.player == null || ModuleManager.isModuleEnabled("Freecam")) return; @@ -104,15 +71,7 @@ public class Scaffold extends Module { Wrapper.getPlayer().inventory.currentItem = newSlot; // check if we don't have a block adjacent to blockpos - A: if (!hasNeighbour(blockPos)) { - // find air adjacent to blockpos that does have a block adjacent to it, let's fill this first as to form a bridge between the player and the original blockpos. necessary if the player is going diagonal. - for (EnumFacing side : EnumFacing.values()) { - BlockPos neighbour = blockPos.offset(side); - if (hasNeighbour(neighbour)) { - blockPos = neighbour; - break A; - } - } + if (!checkForNeighbours(blockPos)) { return; } @@ -123,107 +82,5 @@ public class Scaffold extends Module { Wrapper.getPlayer().inventory.currentItem = oldSlot; } - public static boolean placeBlockScaffold(BlockPos pos) { - Vec3d eyesPos = new Vec3d(Wrapper.getPlayer().posX, - Wrapper.getPlayer().posY + Wrapper.getPlayer().getEyeHeight(), - Wrapper.getPlayer().posZ); - - for(EnumFacing side : EnumFacing.values()) - { - BlockPos neighbor = pos.offset(side); - EnumFacing side2 = side.getOpposite(); - - // check if side is visible (facing away from player) - if(eyesPos.squareDistanceTo( - new Vec3d(pos).add(0.5, 0.5, 0.5)) >= eyesPos - .squareDistanceTo( - new Vec3d(neighbor).add(0.5, 0.5, 0.5))) - continue; - - // check if neighbor can be right clicked - if(!canBeClicked(neighbor)) - continue; - - Vec3d hitVec = new Vec3d(neighbor).add(0.5, 0.5, 0.5) - .add(new Vec3d(side2.getDirectionVec()).scale(0.5)); - - // check if hitVec is within range (4.25 blocks) - if(eyesPos.squareDistanceTo(hitVec) > 18.0625) - continue; - - // place block - faceVectorPacketInstant(hitVec); - processRightClickBlock(neighbor, side2, hitVec); - Wrapper.getPlayer().swingArm(EnumHand.MAIN_HAND); - mc.rightClickDelayTimer = 4; - - return true; - } - - return false; - } - - private static PlayerControllerMP getPlayerController() - { - return Minecraft.getMinecraft().playerController; - } - - public static void processRightClickBlock(BlockPos pos, EnumFacing side, - Vec3d hitVec) - { - getPlayerController().processRightClickBlock(Wrapper.getPlayer(), - mc.world, pos, side, hitVec, EnumHand.MAIN_HAND); - } - - public static IBlockState getState(BlockPos pos) - { - return Wrapper.getWorld().getBlockState(pos); - } - - public static Block getBlock(BlockPos pos) - { - return getState(pos).getBlock(); - } - - public static boolean canBeClicked(BlockPos pos) - { - return getBlock(pos).canCollideCheck(getState(pos), false); - } - - public static void faceVectorPacketInstant(Vec3d vec) - { - float[] rotations = getNeededRotations2(vec); - - Wrapper.getPlayer().connection.sendPacket(new CPacketPlayer.Rotation(rotations[0], - rotations[1], Wrapper.getPlayer().onGround)); - } - - private static float[] getNeededRotations2(Vec3d vec) - { - Vec3d eyesPos = getEyesPos(); - - double diffX = vec.x - eyesPos.x; - double diffY = vec.y - eyesPos.y; - double diffZ = vec.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)); - - return new float[]{ - Wrapper.getPlayer().rotationYaw - + MathHelper.wrapDegrees(yaw - Wrapper.getPlayer().rotationYaw), - Wrapper.getPlayer().rotationPitch + MathHelper - .wrapDegrees(pitch - Wrapper.getPlayer().rotationPitch)}; - } - - public static Vec3d getEyesPos() - { - return new Vec3d(Wrapper.getPlayer().posX, - Wrapper.getPlayer().posY + Wrapper.getPlayer().getEyeHeight(), - Wrapper.getPlayer().posZ); - } - } diff --git a/src/main/java/me/zeroeightsix/kami/util/BlockInteractionHelper.java b/src/main/java/me/zeroeightsix/kami/util/BlockInteractionHelper.java new file mode 100644 index 00000000..e7150b05 --- /dev/null +++ b/src/main/java/me/zeroeightsix/kami/util/BlockInteractionHelper.java @@ -0,0 +1,170 @@ +package me.zeroeightsix.kami.util; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.init.Blocks; +import net.minecraft.network.play.client.CPacketPlayer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; + +import java.util.Arrays; +import java.util.List; + +/** + * Created by hub on 15 June 2019 + * Last Updated 16 June 2019 by hub + */ +public class BlockInteractionHelper { + + public static final List blackList = Arrays.asList( + Blocks.ENDER_CHEST, + Blocks.CHEST, + Blocks.TRAPPED_CHEST, + Blocks.CRAFTING_TABLE, + Blocks.ANVIL, + Blocks.BREWING_STAND, + Blocks.HOPPER, + Blocks.DROPPER, + Blocks.DISPENSER, + Blocks.TRAPDOOR + ); + + public 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 static final Minecraft mc = Minecraft.getMinecraft(); + + public static void placeBlockScaffold(BlockPos pos) { + Vec3d eyesPos = new Vec3d(Wrapper.getPlayer().posX, + Wrapper.getPlayer().posY + Wrapper.getPlayer().getEyeHeight(), + Wrapper.getPlayer().posZ); + + for (EnumFacing side : EnumFacing.values()) { + BlockPos neighbor = pos.offset(side); + EnumFacing side2 = side.getOpposite(); + + // check if neighbor can be right clicked + if (!canBeClicked(neighbor)) { + continue; + } + + Vec3d hitVec = new Vec3d(neighbor).add(0.5, 0.5, 0.5) + .add(new Vec3d(side2.getDirectionVec()).scale(0.5)); + + // check if hitVec is within range (4.25 blocks) + if (eyesPos.squareDistanceTo(hitVec) > 18.0625) { + continue; + } + + // place block + faceVectorPacketInstant(hitVec); + processRightClickBlock(neighbor, side2, hitVec); + Wrapper.getPlayer().swingArm(EnumHand.MAIN_HAND); + mc.rightClickDelayTimer = 4; + + return; + } + + } + + private static float[] getLegitRotations(Vec3d vec) { + Vec3d eyesPos = getEyesPos(); + + double diffX = vec.x - eyesPos.x; + double diffY = vec.y - eyesPos.y; + double diffZ = vec.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)); + + return new float[]{ + Wrapper.getPlayer().rotationYaw + + MathHelper.wrapDegrees(yaw - Wrapper.getPlayer().rotationYaw), + Wrapper.getPlayer().rotationPitch + MathHelper + .wrapDegrees(pitch - Wrapper.getPlayer().rotationPitch)}; + } + + private static Vec3d getEyesPos() { + return new Vec3d(Wrapper.getPlayer().posX, + Wrapper.getPlayer().posY + Wrapper.getPlayer().getEyeHeight(), + Wrapper.getPlayer().posZ); + } + + public static void faceVectorPacketInstant(Vec3d vec) { + float[] rotations = getLegitRotations(vec); + + Wrapper.getPlayer().connection.sendPacket(new CPacketPlayer.Rotation(rotations[0], + rotations[1], Wrapper.getPlayer().onGround)); + } + + private static void processRightClickBlock(BlockPos pos, EnumFacing side, + Vec3d hitVec) { + getPlayerController().processRightClickBlock(Wrapper.getPlayer(), + mc.world, pos, side, hitVec, EnumHand.MAIN_HAND); + } + + public static boolean canBeClicked(BlockPos pos) { + return getBlock(pos).canCollideCheck(getState(pos), false); + } + + private static Block getBlock(BlockPos pos) { + return getState(pos).getBlock(); + } + + private static PlayerControllerMP getPlayerController() { + return Minecraft.getMinecraft().playerController; + } + + private static IBlockState getState(BlockPos pos) { + return Wrapper.getWorld().getBlockState(pos); + } + + public static boolean checkForNeighbours(BlockPos blockPos) { + // check if we don't have a block adjacent to blockpos + if (!hasNeighbour(blockPos)) { + // find air adjacent to blockpos that does have a block adjacent to it, let's fill this first as to form a bridge between the player and the original blockpos. necessary if the player is going diagonal. + for (EnumFacing side : EnumFacing.values()) { + BlockPos neighbour = blockPos.offset(side); + if (hasNeighbour(neighbour)) { + return true; + } + } + return false; + } + return true; + } + + public static boolean hasNeighbour(BlockPos blockPos) { + for (EnumFacing side : EnumFacing.values()) { + BlockPos neighbour = blockPos.offset(side); + if (!Wrapper.getWorld().getBlockState(neighbour).getMaterial().isReplaceable()) { + return true; + } + } + return false; + } + +} From b18fd6ecc0426192b77398f03dfacb8a047088ad Mon Sep 17 00:00:00 2001 From: blockparole <48992448+blockparole@users.noreply.github.com> Date: Thu, 21 Nov 2019 18:49:18 +0100 Subject: [PATCH 02/12] AutoFeetPlace --- .../module/modules/combat/AutoFeetPlace.java | 249 ++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java new file mode 100644 index 00000000..a8fb57d5 --- /dev/null +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java @@ -0,0 +1,249 @@ +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.BlockInteractionHelper; +import me.zeroeightsix.kami.util.Wrapper; +import net.minecraft.block.Block; +import net.minecraft.block.BlockObsidian; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.CPacketEntityAction; +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.Vec3d; + +import static me.zeroeightsix.kami.util.BlockInteractionHelper.*; + +/** + * Created 13 August 2019 by hub + * Updated 31 October 2019 by hub + */ +@Module.Info(name = "AutoFeetPlace", category = Module.Category.COMBAT) +public class AutoFeetPlace extends Module { + + private final Vec3d[] surroundTargets = { + new Vec3d(1, 0, 0), + new Vec3d(0, 0, 1), + new Vec3d(-1, 0, 0), + new Vec3d(0, 0, -1), + new Vec3d(1, -1, 0), + new Vec3d(0, -1, 1), + new Vec3d(-1, -1, 0), + new Vec3d(0, -1, -1), + new Vec3d(0, -1, 0) + }; + + private Setting triggerable = register(Settings.b("Triggerable", true)); + private Setting triggerableTimeoutTicks = register(Settings.i("Triggerable Timeout (Ticks)", 20)); + private Setting blockPerTick = register(Settings.i("Blocks per Tick", 4)); + private Setting announceUsage = register(Settings.b("Announce Usage", false)); + private Setting debugMessages = register(Settings.b("Debug Messages", false)); + + private int playerHotbarSlot = -1; + private int lastHotbarSlot = -1; + private int offsetStep = 0; + + private int totalTickRuns = 0; + + private boolean isSneaking = false; + + @Override + protected void onEnable() { + + if (mc.player == null) { + this.disable(); + return; + } + + // save initial player hand + playerHotbarSlot = Wrapper.getPlayer().inventory.currentItem; + lastHotbarSlot = -1; + + if (announceUsage.getValue()) { + Command.sendChatMessage("[AutoFeetPlace] Enabled!"); + } + + } + + @Override + protected void onDisable() { + + if (mc.player == null) { + return; + } + + // load initial player hand + if (lastHotbarSlot != playerHotbarSlot && playerHotbarSlot != -1) { + Wrapper.getPlayer().inventory.currentItem = playerHotbarSlot; + } + + if (isSneaking) { + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); + isSneaking = false; + } + + playerHotbarSlot = -1; + lastHotbarSlot = -1; + + if (announceUsage.getValue()) { + Command.sendChatMessage("[AutoFeetPlace] Disabled!"); + } + + } + + @Override + public void onUpdate() { + + if (mc.player == null || ModuleManager.isModuleEnabled("Freecam")) { + return; + } + + if (triggerable.getValue() && totalTickRuns >= triggerableTimeoutTicks.getValue()) { + if (debugMessages.getValue()) { + Command.sendChatMessage("[AutoFeetPlace] Timeout reached."); + } + totalTickRuns = 0; + this.disable(); + return; + } + + int blocksPlaced = 0; + + while (blocksPlaced < blockPerTick.getValue()) { + + if (offsetStep >= surroundTargets.length) { + offsetStep = 0; + break; + } + + BlockPos offsetPos = new BlockPos(surroundTargets[offsetStep]); + BlockPos targetPos = new BlockPos(mc.player.getPositionVector()).add(offsetPos.x, offsetPos.y, offsetPos.z); + + boolean shouldTryToPlace = true; + + // check if block is already placed + if (!Wrapper.getWorld().getBlockState(targetPos).getMaterial().isReplaceable()) { + shouldTryToPlace = false; + } + + // check if living entity is on block + for (Entity entity : mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(targetPos))) { + if (entity instanceof EntityLivingBase) { + shouldTryToPlace = false; + break; + } + } + + if (shouldTryToPlace) { + if (placeBlock(targetPos)) { + blocksPlaced++; + } + } + + offsetStep++; + + } + + if (blocksPlaced > 0) { + + if (lastHotbarSlot != playerHotbarSlot && playerHotbarSlot != -1) { + Wrapper.getPlayer().inventory.currentItem = playerHotbarSlot; + lastHotbarSlot = playerHotbarSlot; + } + + } + + totalTickRuns++; + + } + + private boolean placeBlock(BlockPos pos) { + + // check if block at pos is replaceable + if (!mc.world.getBlockState(pos).getMaterial().isReplaceable()) { + return false; + } + + // check if we have a block adjacent to blockpos to click at + if (!checkForNeighbours(pos)) { + return false; + } + + for (EnumFacing side : EnumFacing.values()) { + + BlockPos neighbor = pos.offset(side); + EnumFacing side2 = side.getOpposite(); + + // check if neighbor can be right clicked + if (!canBeClicked(neighbor)) { + continue; + } + + int obiSlot = findObiInHotbar(); + + // check if any blocks were found + if (obiSlot == -1) { + this.disable(); + return false; + } + + if (lastHotbarSlot != obiSlot) { + Wrapper.getPlayer().inventory.currentItem = obiSlot; + lastHotbarSlot = obiSlot; + } + + Block neighborPos = mc.world.getBlockState(neighbor).getBlock(); + if (BlockInteractionHelper.blackList.contains(neighborPos) || BlockInteractionHelper.shulkerList.contains(neighborPos)) { + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING)); + isSneaking = true; + } + + Vec3d hitVec = new Vec3d(neighbor).add(0.5, 0.5, 0.5).add(new Vec3d(side2.getDirectionVec()).scale(0.5)); + + // place block + faceVectorPacketInstant(hitVec); + mc.playerController.processRightClickBlock(mc.player, mc.world, neighbor, side2, hitVec, EnumHand.MAIN_HAND); + mc.player.swingArm(EnumHand.MAIN_HAND); + + return true; + + } + + return false; + + } + + private int findObiInHotbar() { + + // search blocks in hotbar + int slot = -1; + for (int i = 0; i < 9; i++) { + + // filter out non-block items + ItemStack stack = Wrapper.getPlayer().inventory.getStackInSlot(i); + + if (stack == ItemStack.EMPTY || !(stack.getItem() instanceof ItemBlock)) { + continue; + } + + Block block = ((ItemBlock) stack.getItem()).getBlock(); + if (block instanceof BlockObsidian) { + slot = i; + break; + } + + } + + return slot; + + } + +} From 56b74198d679ae6d2516416c2190af72fc62e9d9 Mon Sep 17 00:00:00 2001 From: blockparole <48992448+blockparole@users.noreply.github.com> Date: Thu, 21 Nov 2019 21:44:53 +0100 Subject: [PATCH 03/12] AutoFeetPlace rotation setting and better entity detection --- .../module/modules/combat/AutoFeetPlace.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java index a8fb57d5..f414284d 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java @@ -10,7 +10,8 @@ import me.zeroeightsix.kami.util.Wrapper; import net.minecraft.block.Block; import net.minecraft.block.BlockObsidian; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.network.play.client.CPacketEntityAction; @@ -24,7 +25,7 @@ import static me.zeroeightsix.kami.util.BlockInteractionHelper.*; /** * Created 13 August 2019 by hub - * Updated 31 October 2019 by hub + * Updated 21 November 2019 by hub */ @Module.Info(name = "AutoFeetPlace", category = Module.Category.COMBAT) public class AutoFeetPlace extends Module { @@ -44,6 +45,7 @@ public class AutoFeetPlace extends Module { private Setting triggerable = register(Settings.b("Triggerable", true)); private Setting triggerableTimeoutTicks = register(Settings.i("Triggerable Timeout (Ticks)", 20)); private Setting blockPerTick = register(Settings.i("Blocks per Tick", 4)); + private Setting rotate = register(Settings.b("Rotate", true)); private Setting announceUsage = register(Settings.b("Announce Usage", false)); private Setting debugMessages = register(Settings.b("Debug Messages", false)); @@ -134,9 +136,9 @@ public class AutoFeetPlace extends Module { shouldTryToPlace = false; } - // check if living entity is on block + // check if entity blocks placing for (Entity entity : mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(targetPos))) { - if (entity instanceof EntityLivingBase) { + if (!(entity instanceof EntityItem) && !(entity instanceof EntityXPOrb)) { shouldTryToPlace = false; break; } @@ -208,8 +210,12 @@ public class AutoFeetPlace extends Module { Vec3d hitVec = new Vec3d(neighbor).add(0.5, 0.5, 0.5).add(new Vec3d(side2.getDirectionVec()).scale(0.5)); + // fake rotation + if (rotate.getValue()) { + faceVectorPacketInstant(hitVec); + } + // place block - faceVectorPacketInstant(hitVec); mc.playerController.processRightClickBlock(mc.player, mc.world, neighbor, side2, hitVec, EnumHand.MAIN_HAND); mc.player.swingArm(EnumHand.MAIN_HAND); From 5f6f12b0fb0c1ba66ca5e66194cbea93c0c2747c Mon Sep 17 00:00:00 2001 From: blockparole <48992448+blockparole@users.noreply.github.com> Date: Sun, 24 Nov 2019 16:57:17 +0100 Subject: [PATCH 04/12] AFP min max values --- .../zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java index f414284d..cb747a3d 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java @@ -44,7 +44,7 @@ public class AutoFeetPlace extends Module { private Setting triggerable = register(Settings.b("Triggerable", true)); private Setting triggerableTimeoutTicks = register(Settings.i("Triggerable Timeout (Ticks)", 20)); - private Setting blockPerTick = register(Settings.i("Blocks per Tick", 4)); + private Setting blockPerTick = register(Settings.integerBuilder("Blocks per Tick").withMinimum(1).withValue(4).withMaximum(9).build()); private Setting rotate = register(Settings.b("Rotate", true)); private Setting announceUsage = register(Settings.b("Announce Usage", false)); private Setting debugMessages = register(Settings.b("Debug Messages", false)); From 4684ed8d82b1b8ff14b637baa80abb4a7007a148 Mon Sep 17 00:00:00 2001 From: blockparole <48992448+blockparole@users.noreply.github.com> Date: Sun, 24 Nov 2019 16:59:08 +0100 Subject: [PATCH 05/12] AFP remove announcer and debug messages --- .../module/modules/combat/AutoFeetPlace.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java index cb747a3d..e4767ddd 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java @@ -1,6 +1,5 @@ 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; @@ -25,7 +24,7 @@ import static me.zeroeightsix.kami.util.BlockInteractionHelper.*; /** * Created 13 August 2019 by hub - * Updated 21 November 2019 by hub + * Updated 24 November 2019 by hub */ @Module.Info(name = "AutoFeetPlace", category = Module.Category.COMBAT) public class AutoFeetPlace extends Module { @@ -46,8 +45,6 @@ public class AutoFeetPlace extends Module { private Setting triggerableTimeoutTicks = register(Settings.i("Triggerable Timeout (Ticks)", 20)); private Setting blockPerTick = register(Settings.integerBuilder("Blocks per Tick").withMinimum(1).withValue(4).withMaximum(9).build()); private Setting rotate = register(Settings.b("Rotate", true)); - private Setting announceUsage = register(Settings.b("Announce Usage", false)); - private Setting debugMessages = register(Settings.b("Debug Messages", false)); private int playerHotbarSlot = -1; private int lastHotbarSlot = -1; @@ -69,10 +66,6 @@ public class AutoFeetPlace extends Module { playerHotbarSlot = Wrapper.getPlayer().inventory.currentItem; lastHotbarSlot = -1; - if (announceUsage.getValue()) { - Command.sendChatMessage("[AutoFeetPlace] Enabled!"); - } - } @Override @@ -95,10 +88,6 @@ public class AutoFeetPlace extends Module { playerHotbarSlot = -1; lastHotbarSlot = -1; - if (announceUsage.getValue()) { - Command.sendChatMessage("[AutoFeetPlace] Disabled!"); - } - } @Override @@ -109,9 +98,6 @@ public class AutoFeetPlace extends Module { } if (triggerable.getValue() && totalTickRuns >= triggerableTimeoutTicks.getValue()) { - if (debugMessages.getValue()) { - Command.sendChatMessage("[AutoFeetPlace] Timeout reached."); - } totalTickRuns = 0; this.disable(); return; From fd42105f7f05261073145a0030659fb1472d6e61 Mon Sep 17 00:00:00 2001 From: blockparole <48992448+blockparole@users.noreply.github.com> Date: Sun, 24 Nov 2019 17:02:39 +0100 Subject: [PATCH 06/12] AFP min max values and visibility predicate for timeout ticks --- .../kami/module/modules/combat/AutoFeetPlace.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java index e4767ddd..bc7cf26b 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java @@ -42,8 +42,8 @@ public class AutoFeetPlace extends Module { }; private Setting triggerable = register(Settings.b("Triggerable", true)); - private Setting triggerableTimeoutTicks = register(Settings.i("Triggerable Timeout (Ticks)", 20)); - private Setting blockPerTick = register(Settings.integerBuilder("Blocks per Tick").withMinimum(1).withValue(4).withMaximum(9).build()); + private Setting timeoutTicks = register(Settings.integerBuilder("TimeoutTicks").withMinimum(1).withValue(20).withMaximum(100).withVisibility(b -> triggerable.getValue()).build()); + private Setting blocksPerTick = register(Settings.integerBuilder("Blocks per Tick").withMinimum(1).withValue(4).withMaximum(9).build()); private Setting rotate = register(Settings.b("Rotate", true)); private int playerHotbarSlot = -1; @@ -97,7 +97,7 @@ public class AutoFeetPlace extends Module { return; } - if (triggerable.getValue() && totalTickRuns >= triggerableTimeoutTicks.getValue()) { + if (triggerable.getValue() && totalTickRuns >= timeoutTicks.getValue()) { totalTickRuns = 0; this.disable(); return; @@ -105,7 +105,7 @@ public class AutoFeetPlace extends Module { int blocksPlaced = 0; - while (blocksPlaced < blockPerTick.getValue()) { + while (blocksPlaced < blocksPerTick.getValue()) { if (offsetStep >= surroundTargets.length) { offsetStep = 0; From ac9e373fed90ba418d7e20312664c3d2897cce83 Mon Sep 17 00:00:00 2001 From: blockparole <48992448+blockparole@users.noreply.github.com> Date: Sat, 30 Nov 2019 02:27:27 +0100 Subject: [PATCH 07/12] AutoFeetPlace --- .../module/modules/combat/AutoFeetPlace.java | 275 +++++++++++------- 1 file changed, 177 insertions(+), 98 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java index bc7cf26b..9eccb070 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java @@ -1,13 +1,17 @@ package me.zeroeightsix.kami.module.modules.combat; +import com.mojang.realmsclient.gui.ChatFormatting; +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.BlockInteractionHelper; -import me.zeroeightsix.kami.util.Wrapper; import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; +import net.minecraft.block.BlockLiquid; import net.minecraft.block.BlockObsidian; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityXPOrb; @@ -20,40 +24,56 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; -import static me.zeroeightsix.kami.util.BlockInteractionHelper.*; +import static me.zeroeightsix.kami.util.BlockInteractionHelper.canBeClicked; +import static me.zeroeightsix.kami.util.BlockInteractionHelper.faceVectorPacketInstant; /** - * Created 13 August 2019 by hub - * Updated 24 November 2019 by hub + * @author hub + * @since 2019-8-13 */ @Module.Info(name = "AutoFeetPlace", category = Module.Category.COMBAT) public class AutoFeetPlace extends Module { - private final Vec3d[] surroundTargets = { - new Vec3d(1, 0, 0), - new Vec3d(0, 0, 1), - new Vec3d(-1, 0, 0), - new Vec3d(0, 0, -1), - new Vec3d(1, -1, 0), - new Vec3d(0, -1, 1), - new Vec3d(-1, -1, 0), - new Vec3d(0, -1, -1), - new Vec3d(0, -1, 0) - }; - + private Setting mode = register(Settings.e("Mode", Mode.FULL)); private Setting triggerable = register(Settings.b("Triggerable", true)); - private Setting timeoutTicks = register(Settings.integerBuilder("TimeoutTicks").withMinimum(1).withValue(20).withMaximum(100).withVisibility(b -> triggerable.getValue()).build()); - private Setting blocksPerTick = register(Settings.integerBuilder("Blocks per Tick").withMinimum(1).withValue(4).withMaximum(9).build()); + private Setting timeoutTicks = register(Settings.integerBuilder("TimeoutTicks").withMinimum(1).withValue(40).withMaximum(100).withVisibility(b -> triggerable.getValue()).build()); + private Setting blocksPerTick = register(Settings.integerBuilder("BlocksPerTick").withMinimum(1).withValue(4).withMaximum(9).build()); + private Setting tickDelay = register(Settings.integerBuilder("TickDelay").withMinimum(0).withValue(0).withMaximum(10).build()); private Setting rotate = register(Settings.b("Rotate", true)); + private Setting infoMessage = register(Settings.b("InfoMessage", false)); + + private int offsetStep = 0; + private int delayStep = 0; private int playerHotbarSlot = -1; private int lastHotbarSlot = -1; - private int offsetStep = 0; - - private int totalTickRuns = 0; - private boolean isSneaking = false; + private int totalTicksRunning = 0; + private boolean firstRun; + private boolean missingObiDisable = false; + + private static EnumFacing getPlaceableSide(BlockPos pos) { + + for (EnumFacing side : EnumFacing.values()) { + + BlockPos neighbour = pos.offset(side); + + if (!mc.world.getBlockState(neighbour).getBlock().canCollideCheck(mc.world.getBlockState(neighbour), false)) { + continue; + } + + IBlockState blockState = mc.world.getBlockState(neighbour); + if (!blockState.getMaterial().isReplaceable()) { + return side; + } + + } + + return null; + + } + @Override protected void onEnable() { @@ -62,8 +82,10 @@ public class AutoFeetPlace extends Module { return; } + firstRun = true; + // save initial player hand - playerHotbarSlot = Wrapper.getPlayer().inventory.currentItem; + playerHotbarSlot = mc.player.inventory.currentItem; lastHotbarSlot = -1; } @@ -77,7 +99,7 @@ public class AutoFeetPlace extends Module { // load initial player hand if (lastHotbarSlot != playerHotbarSlot && playerHotbarSlot != -1) { - Wrapper.getPlayer().inventory.currentItem = playerHotbarSlot; + mc.player.inventory.currentItem = playerHotbarSlot; } if (isSneaking) { @@ -88,6 +110,8 @@ public class AutoFeetPlace extends Module { playerHotbarSlot = -1; lastHotbarSlot = -1; + missingObiDisable = false; + } @Override @@ -97,43 +121,52 @@ public class AutoFeetPlace extends Module { return; } - if (triggerable.getValue() && totalTickRuns >= timeoutTicks.getValue()) { - totalTickRuns = 0; + if (triggerable.getValue() && totalTicksRunning >= timeoutTicks.getValue()) { + totalTicksRunning = 0; this.disable(); return; } + if (!firstRun) { + if (delayStep < tickDelay.getValue()) { + delayStep++; + return; + } else { + delayStep = 0; + } + } + + if (firstRun) { + firstRun = false; + } + int blocksPlaced = 0; while (blocksPlaced < blocksPerTick.getValue()) { - if (offsetStep >= surroundTargets.length) { + Vec3d[] offsetPattern = new Vec3d[0]; + int maxSteps = 0; + + if (mode.getValue().equals(Mode.FULL)) { + offsetPattern = Offsets.FULL; + maxSteps = Offsets.FULL.length; + } + + if (mode.getValue().equals(Mode.SURROUND)) { + offsetPattern = Offsets.SURROUND; + maxSteps = Offsets.SURROUND.length; + } + + if (offsetStep >= maxSteps) { offsetStep = 0; break; } - BlockPos offsetPos = new BlockPos(surroundTargets[offsetStep]); + BlockPos offsetPos = new BlockPos(offsetPattern[offsetStep]); BlockPos targetPos = new BlockPos(mc.player.getPositionVector()).add(offsetPos.x, offsetPos.y, offsetPos.z); - boolean shouldTryToPlace = true; - - // check if block is already placed - if (!Wrapper.getWorld().getBlockState(targetPos).getMaterial().isReplaceable()) { - shouldTryToPlace = false; - } - - // check if entity blocks placing - for (Entity entity : mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(targetPos))) { - if (!(entity instanceof EntityItem) && !(entity instanceof EntityXPOrb)) { - shouldTryToPlace = false; - break; - } - } - - if (shouldTryToPlace) { - if (placeBlock(targetPos)) { - blocksPlaced++; - } + if (placeBlock(targetPos)) { + blocksPlaced++; } offsetStep++; @@ -143,73 +176,88 @@ public class AutoFeetPlace extends Module { if (blocksPlaced > 0) { if (lastHotbarSlot != playerHotbarSlot && playerHotbarSlot != -1) { - Wrapper.getPlayer().inventory.currentItem = playerHotbarSlot; + mc.player.inventory.currentItem = playerHotbarSlot; lastHotbarSlot = playerHotbarSlot; } + if (isSneaking) { + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); + isSneaking = false; + } + } - totalTickRuns++; + totalTicksRunning++; + + if (missingObiDisable) { + missingObiDisable = false; + if (infoMessage.getValue()) { + Command.sendChatMessage("[AutoFeetPlace] " + ChatFormatting.RED + "Disabled" + ChatFormatting.RESET + ", Obsidian missing!"); + } + this.disable(); + } } private boolean placeBlock(BlockPos pos) { - // check if block at pos is replaceable - if (!mc.world.getBlockState(pos).getMaterial().isReplaceable()) { + // check if block is already placed + Block block = mc.world.getBlockState(pos).getBlock(); + if (!(block instanceof BlockAir) && !(block instanceof BlockLiquid)) { return false; } - // check if we have a block adjacent to blockpos to click at - if (!checkForNeighbours(pos)) { - return false; - } - - for (EnumFacing side : EnumFacing.values()) { - - BlockPos neighbor = pos.offset(side); - EnumFacing side2 = side.getOpposite(); - - // check if neighbor can be right clicked - if (!canBeClicked(neighbor)) { - continue; - } - - int obiSlot = findObiInHotbar(); - - // check if any blocks were found - if (obiSlot == -1) { - this.disable(); + // check if entity blocks placing + for (Entity entity : mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(pos))) { + if (!(entity instanceof EntityItem) && !(entity instanceof EntityXPOrb)) { return false; } - - if (lastHotbarSlot != obiSlot) { - Wrapper.getPlayer().inventory.currentItem = obiSlot; - lastHotbarSlot = obiSlot; - } - - Block neighborPos = mc.world.getBlockState(neighbor).getBlock(); - if (BlockInteractionHelper.blackList.contains(neighborPos) || BlockInteractionHelper.shulkerList.contains(neighborPos)) { - mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING)); - isSneaking = true; - } - - Vec3d hitVec = new Vec3d(neighbor).add(0.5, 0.5, 0.5).add(new Vec3d(side2.getDirectionVec()).scale(0.5)); - - // fake rotation - if (rotate.getValue()) { - faceVectorPacketInstant(hitVec); - } - - // place block - mc.playerController.processRightClickBlock(mc.player, mc.world, neighbor, side2, hitVec, EnumHand.MAIN_HAND); - mc.player.swingArm(EnumHand.MAIN_HAND); - - return true; - } - return false; + EnumFacing side = getPlaceableSide(pos); + + // check if we have a block adjacent to blockpos to click at + if (side == null) { + return false; + } + + BlockPos neighbour = pos.offset(side); + EnumFacing opposite = side.getOpposite(); + + // check if neighbor can be right clicked + if (!canBeClicked(neighbour)) { + return false; + } + + Vec3d hitVec = new Vec3d(neighbour).add(0.5, 0.5, 0.5).add(new Vec3d(opposite.getDirectionVec()).scale(0.5)); + Block neighbourBlock = mc.world.getBlockState(neighbour).getBlock(); + + int obiSlot = findObiInHotbar(); + + if (obiSlot == -1) { + missingObiDisable = true; + return false; + } + + if (lastHotbarSlot != obiSlot) { + mc.player.inventory.currentItem = obiSlot; + lastHotbarSlot = obiSlot; + } + + if (!isSneaking && BlockInteractionHelper.blackList.contains(neighbourBlock) || BlockInteractionHelper.shulkerList.contains(neighbourBlock)) { + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING)); + isSneaking = true; + } + + if (rotate.getValue()) { + faceVectorPacketInstant(hitVec); + } + + mc.playerController.processRightClickBlock(mc.player, mc.world, neighbour, opposite, hitVec, EnumHand.MAIN_HAND); + mc.player.swingArm(EnumHand.MAIN_HAND); + mc.rightClickDelayTimer = 4; + + return true; } @@ -220,7 +268,7 @@ public class AutoFeetPlace extends Module { for (int i = 0; i < 9; i++) { // filter out non-block items - ItemStack stack = Wrapper.getPlayer().inventory.getStackInSlot(i); + ItemStack stack = mc.player.inventory.getStackInSlot(i); if (stack == ItemStack.EMPTY || !(stack.getItem() instanceof ItemBlock)) { continue; @@ -238,4 +286,35 @@ public class AutoFeetPlace extends Module { } + private enum Mode { + SURROUND, FULL + } + + private static class Offsets { + + private static final Vec3d[] SURROUND = { + new Vec3d(1, 0, 0), + new Vec3d(0, 0, 1), + new Vec3d(-1, 0, 0), + new Vec3d(0, 0, -1), + new Vec3d(1, -1, 0), + new Vec3d(0, -1, 1), + new Vec3d(-1, -1, 0), + new Vec3d(0, -1, -1) + }; + + private static final Vec3d[] FULL = { + new Vec3d(1, 0, 0), + new Vec3d(0, 0, 1), + new Vec3d(-1, 0, 0), + new Vec3d(0, 0, -1), + new Vec3d(1, -1, 0), + new Vec3d(0, -1, 1), + new Vec3d(-1, -1, 0), + new Vec3d(0, -1, -1), + new Vec3d(0, -1, 0) + }; + + } + } From 466e75b314ff23091a0381ffa9f51c7543364084 Mon Sep 17 00:00:00 2001 From: blockparole <48992448+blockparole@users.noreply.github.com> Date: Sat, 30 Nov 2019 02:36:54 +0100 Subject: [PATCH 08/12] also warn on first run --- .../zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java index 9eccb070..5a7a428d 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java @@ -138,6 +138,9 @@ public class AutoFeetPlace extends Module { if (firstRun) { firstRun = false; + if (findObiInHotbar() == -1) { + missingObiDisable = true; + } } int blocksPlaced = 0; From b474cd8629823828fe40aec066b0d3b4786a60ad Mon Sep 17 00:00:00 2001 From: blockparole <48992448+blockparole@users.noreply.github.com> Date: Sat, 30 Nov 2019 02:37:58 +0100 Subject: [PATCH 09/12] cleanup --- .../module/modules/combat/AutoFeetPlace.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java index 5a7a428d..f9ea8434 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/AutoFeetPlace.java @@ -143,23 +143,23 @@ public class AutoFeetPlace extends Module { } } + Vec3d[] offsetPattern = new Vec3d[0]; + int maxSteps = 0; + + if (mode.getValue().equals(Mode.FULL)) { + offsetPattern = Offsets.FULL; + maxSteps = Offsets.FULL.length; + } + + if (mode.getValue().equals(Mode.SURROUND)) { + offsetPattern = Offsets.SURROUND; + maxSteps = Offsets.SURROUND.length; + } + int blocksPlaced = 0; while (blocksPlaced < blocksPerTick.getValue()) { - Vec3d[] offsetPattern = new Vec3d[0]; - int maxSteps = 0; - - if (mode.getValue().equals(Mode.FULL)) { - offsetPattern = Offsets.FULL; - maxSteps = Offsets.FULL.length; - } - - if (mode.getValue().equals(Mode.SURROUND)) { - offsetPattern = Offsets.SURROUND; - maxSteps = Offsets.SURROUND.length; - } - if (offsetStep >= maxSteps) { offsetStep = 0; break; From 85e2f6dd4e96114fc07b55351c4f228905dd8ca0 Mon Sep 17 00:00:00 2001 From: blockparole <48992448+blockparole@users.noreply.github.com> Date: Tue, 3 Dec 2019 23:34:30 +0100 Subject: [PATCH 10/12] caura canPlaceCrystal add entity check for boost2 --- .../kami/module/modules/combat/CrystalAura.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/CrystalAura.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/CrystalAura.java index 4b297c90..c48e50db 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/CrystalAura.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/CrystalAura.java @@ -232,14 +232,12 @@ public class CrystalAura extends Module { private boolean canPlaceCrystal(BlockPos blockPos) { BlockPos boost = blockPos.add(0, 1, 0); BlockPos boost2 = blockPos.add(0, 2, 0); - if ((mc.world.getBlockState(blockPos).getBlock() != Blocks.BEDROCK - && mc.world.getBlockState(blockPos).getBlock() != Blocks.OBSIDIAN) - || mc.world.getBlockState(boost).getBlock() != Blocks.AIR - || mc.world.getBlockState(boost2).getBlock() != Blocks.AIR - || !mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost)).isEmpty()) { - return false; - } - return true; + return (mc.world.getBlockState(blockPos).getBlock() == Blocks.BEDROCK + || mc.world.getBlockState(blockPos).getBlock() == Blocks.OBSIDIAN) + && mc.world.getBlockState(boost).getBlock() == Blocks.AIR + && mc.world.getBlockState(boost2).getBlock() == Blocks.AIR + && mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost)).isEmpty() + && mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost2)).isEmpty(); } public static BlockPos getPlayerPos() { From 8ec71f25948607046506cfd5fd332df36f108b29 Mon Sep 17 00:00:00 2001 From: blockparole <48992448+blockparole@users.noreply.github.com> Date: Tue, 3 Dec 2019 23:35:48 +0100 Subject: [PATCH 11/12] comment --- .../me/zeroeightsix/kami/module/modules/combat/CrystalAura.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/CrystalAura.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/CrystalAura.java index c48e50db..c38cc69c 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/CrystalAura.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/CrystalAura.java @@ -39,7 +39,7 @@ import static me.zeroeightsix.kami.util.EntityUtil.calculateLookAt; /** * Created by 086 on 28/12/2017. - * Last Updated 29 June 2019 by hub + * Updated 3 December 2019 by hub */ @Module.Info(name = "CrystalAura", category = Module.Category.COMBAT) public class CrystalAura extends Module { From e476184e4135d2aa6bb37c308fd0cae50295f99c Mon Sep 17 00:00:00 2001 From: Bella Date: Tue, 3 Dec 2019 23:04:16 -0500 Subject: [PATCH 12/12] add entity check for crystalaura --- .../kami/module/modules/combat/CrystalAura.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/combat/CrystalAura.java b/src/main/java/me/zeroeightsix/kami/module/modules/combat/CrystalAura.java index 4b297c90..c38cc69c 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/combat/CrystalAura.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/combat/CrystalAura.java @@ -39,7 +39,7 @@ import static me.zeroeightsix.kami.util.EntityUtil.calculateLookAt; /** * Created by 086 on 28/12/2017. - * Last Updated 29 June 2019 by hub + * Updated 3 December 2019 by hub */ @Module.Info(name = "CrystalAura", category = Module.Category.COMBAT) public class CrystalAura extends Module { @@ -232,14 +232,12 @@ public class CrystalAura extends Module { private boolean canPlaceCrystal(BlockPos blockPos) { BlockPos boost = blockPos.add(0, 1, 0); BlockPos boost2 = blockPos.add(0, 2, 0); - if ((mc.world.getBlockState(blockPos).getBlock() != Blocks.BEDROCK - && mc.world.getBlockState(blockPos).getBlock() != Blocks.OBSIDIAN) - || mc.world.getBlockState(boost).getBlock() != Blocks.AIR - || mc.world.getBlockState(boost2).getBlock() != Blocks.AIR - || !mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost)).isEmpty()) { - return false; - } - return true; + return (mc.world.getBlockState(blockPos).getBlock() == Blocks.BEDROCK + || mc.world.getBlockState(blockPos).getBlock() == Blocks.OBSIDIAN) + && mc.world.getBlockState(boost).getBlock() == Blocks.AIR + && mc.world.getBlockState(boost2).getBlock() == Blocks.AIR + && mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost)).isEmpty() + && mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost2)).isEmpty(); } public static BlockPos getPlayerPos() {