From 66f3c97ded35fee7cd90cacf8fb882d487e62bf5 Mon Sep 17 00:00:00 2001 From: blockparole <> Date: Sun, 27 Oct 2019 19:41:26 +0100 Subject: [PATCH 1/3] Auto32k Sphere fallback use (BlockPos : Sphere) as fallback for place target search also code cleanup --- .../kami/module/modules/combat/Auto32k.java | 228 ++++++++++-------- 1 file changed, 121 insertions(+), 107 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 39bc4250..64309fa2 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 @@ -5,7 +5,6 @@ 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; @@ -28,6 +27,8 @@ import java.text.DecimalFormat; import java.util.Arrays; import java.util.List; +import static me.zeroeightsix.kami.module.modules.combat.CrystalAura.getPlayerPos; + /** * Created by hub on 7 August 2019 * Updated by hub on 27 October 2019 @@ -35,7 +36,6 @@ import java.util.List; @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, @@ -55,9 +55,11 @@ public class Auto32k extends Module { Blocks.BLACK_SHULKER_BOX ); + private static final DecimalFormat df = new DecimalFormat("#.#"); + 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 (up and down)", 2)); + private Setting yOffset = register(Settings.i("Y Offset", 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)); @@ -66,44 +68,6 @@ public class Auto32k extends Module { 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() { @@ -125,7 +89,7 @@ public class Auto32k extends Module { break; } - ItemStack stack = Wrapper.getPlayer().inventory.getStackInSlot(i); + ItemStack stack = mc.player.inventory.getStackInSlot(i); if (stack == ItemStack.EMPTY || !(stack.getItem() instanceof ItemBlock)) { continue; @@ -162,8 +126,6 @@ public class Auto32k extends Module { } EnumFacing facingDirection; - BlockPos placeTestNextPos = basePos; - BlockPos placeTestSuccessfull = null; if (placeBehind.getValue()) { facingDirection = EnumFacing.fromAngle(mc.player.rotationYaw).getOpposite(); @@ -174,67 +136,23 @@ public class Auto32k extends Module { int range = (int) Math.ceil(placeRange.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 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++) { - - BlockPos placeTestNextPosOffsetY = placeTestNextPos.add(0, j, 0); - - boolean EntityLivingBaseOnTargetBlockPos = false; - 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(placeTestNextPosOffsetY).getMaterial().isReplaceable()) { - continue; // no space for hopper - } - - if (!Wrapper.getWorld().getBlockState(placeTestNextPosOffsetY.add(0, 1, 0)).getMaterial().isReplaceable()) { - continue; // no space for shulker - } - - if (Wrapper.getWorld().getBlockState(placeTestNextPosOffsetY.add(0, -1, 0)).getBlock() instanceof BlockAir) { - continue; // air below hopper - } - - if (Wrapper.getWorld().getBlockState(placeTestNextPosOffsetY.add(0, -1, 0)).getBlock() instanceof BlockLiquid) { - continue; // liquid below hopper - } - - if (mc.player.getPositionVector().distanceTo(new Vec3d(placeTestNextPosOffsetY)) > placeRange.getValue()) { - 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; + BlockPos placeTargetPos = findPlaceAreaInRow(basePos, yOffsetSanitized, range, facingDirection); + if (placeTargetPos == null) { + if (debugMessages.getValue()) { + Command.sendChatMessage("Not enough space to place optimal Hopper, searching for Blocks in a sphere."); + } + CrystalAura ca = (CrystalAura) ModuleManager.getModuleByName("CrystalAura"); + // TODO - sorting for optimal hopper placement (good kill possibility > bad kill possibility) goes here + for (BlockPos pos : ca.getSphere(getPlayerPos(), range, range, false, true, 0)) { + if (findPlaceArea(pos) != null) { + placeTargetPos = pos; + break; + } } - } - if (placeTestSuccessfull == null) { + if (placeTargetPos == null) { if (debugMessages.getValue()) { Command.sendChatMessage("Not enough space, disabling."); } @@ -242,28 +160,26 @@ public class Auto32k extends Module { 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; + mc.player.inventory.currentItem = hopperSlot; placeBlock(new BlockPos(placeTargetPos), spoofRotation.getValue()); - Wrapper.getPlayer().inventory.currentItem = shulkerSlot; + mc.player.inventory.currentItem = shulkerSlot; placeBlock(new BlockPos(placeTargetPos.add(0, 1, 0)), spoofRotation.getValue()); if (placeObi.getValue() && obiSlot != -1) { - Wrapper.getPlayer().inventory.currentItem = obiSlot; + mc.player.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; + mc.player.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; @@ -307,4 +223,102 @@ public class Auto32k extends Module { } + private BlockPos findPlaceAreaInRow(BlockPos placeTestNextPos, int yOffsetSanitized, int range, EnumFacing facingDirection) { + + for (int i = range; i > 0; i--) { + + placeTestNextPos = placeTestNextPos.add(facingDirection.getXOffset(), 0, facingDirection.getZOffset()); + + for (int j = (-1 * yOffsetSanitized); j < (1 + yOffsetSanitized); j++) { + + BlockPos testPos = findPlaceArea(placeTestNextPos.add(0, j, 0)); + if (testPos != null) { + return testPos; + } + + } + + } + + return null; + + } + + private BlockPos findPlaceArea(BlockPos blockPos) { + + for (Entity entity : mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(blockPos))) { + if (entity instanceof EntityLivingBase) { + return null; // entity on block + } + } + + if (!mc.world.getBlockState(blockPos).getMaterial().isReplaceable()) { + return null; // no space for hopper + } + + if (!mc.world.getBlockState(blockPos.add(0, 1, 0)).getMaterial().isReplaceable()) { + return null; // no space for shulker + } + + if (mc.world.getBlockState(blockPos.add(0, -1, 0)).getBlock() instanceof BlockAir) { + return null; // air below hopper + } + + if (mc.world.getBlockState(blockPos.add(0, -1, 0)).getBlock() instanceof BlockLiquid) { + return null; // liquid below hopper + } + + if (mc.player.getPositionVector().distanceTo(new Vec3d(blockPos)) > placeRange.getValue()) { + return null; // 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(blockPos), false, true, false); + if (!(result == null || result.getBlockPos().equals(blockPos))) { + return null; + } + } + + return blockPos; + + } + + private static void placeBlock(BlockPos pos, boolean spoofRotation) { + + if (!mc.world.getBlockState(pos).getMaterial().isReplaceable()) { + return; + } + + for (EnumFacing side : EnumFacing.values()) { + + BlockPos neighbor = pos.offset(side); + EnumFacing side2 = side.getOpposite(); + + if (!mc.world.getBlockState(neighbor).getBlock().canCollideCheck(mc.world.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(mc.player.posX, mc.player.posY + mc.player.getEyeHeight(), mc.player.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)); + mc.player.connection.sendPacket(new CPacketPlayer.Rotation(mc.player.rotationYaw + MathHelper.wrapDegrees(yaw - mc.player.rotationYaw), mc.player.rotationPitch + MathHelper.wrapDegrees(pitch - mc.player.rotationPitch), mc.player.onGround)); + } + + mc.playerController.processRightClickBlock(mc.player, mc.world, neighbor, side2, hitVec, EnumHand.MAIN_HAND); + mc.player.swingArm(EnumHand.MAIN_HAND); + mc.rightClickDelayTimer = 4; + + return; + + } + + } + } From b079794a0e65585a8d095bc64455ef9010e74cea Mon Sep 17 00:00:00 2001 From: blockparole <> Date: Sun, 27 Oct 2019 21:20:02 +0100 Subject: [PATCH 2/3] Auto32k calculate position based on enemy distance in a sphere --- .../kami/module/modules/combat/Auto32k.java | 154 ++++++++++-------- 1 file changed, 89 insertions(+), 65 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 64309fa2..040c2baa 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 @@ -5,12 +5,14 @@ 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.Friends; 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.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.inventory.ClickType; import net.minecraft.item.ItemBlock; @@ -24,8 +26,7 @@ import net.minecraft.util.math.*; import java.math.RoundingMode; import java.text.DecimalFormat; -import java.util.Arrays; -import java.util.List; +import java.util.*; import static me.zeroeightsix.kami.module.modules.combat.CrystalAura.getPlayerPos; @@ -36,6 +37,7 @@ import static me.zeroeightsix.kami.module.modules.combat.CrystalAura.getPlayerPo @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, @@ -55,13 +57,10 @@ public class Auto32k extends Module { Blocks.BLACK_SHULKER_BOX ); - private static final DecimalFormat df = new DecimalFormat("#.#"); - 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", 2)); - private Setting placeBehind = register(Settings.b("Place behind", true)); - private Setting placeObi = register(Settings.b("Obi on Top", true)); + private Setting placeCloseToEnemy = register(Settings.b("Place close to enemy", true)); + private Setting placeObiOnTop = register(Settings.b("Place 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)); @@ -107,8 +106,6 @@ public class Auto32k extends Module { } - BlockPos basePos = new BlockPos(mc.player.getPositionVector()); - if (hopperSlot == -1) { if (debugMessages.getValue()) { Command.sendChatMessage("Hopper missing, disabling."); @@ -125,62 +122,112 @@ public class Auto32k extends Module { return; } - EnumFacing facingDirection; + int range = (int) Math.ceil(placeRange.getValue()); - if (placeBehind.getValue()) { - facingDirection = EnumFacing.fromAngle(mc.player.rotationYaw).getOpposite(); - } else { - facingDirection = EnumFacing.fromAngle(mc.player.rotationYaw); + CrystalAura crystalAura = (CrystalAura) ModuleManager.getModuleByName("CrystalAura"); + List placeTargetList = crystalAura.getSphere(getPlayerPos(), range, range, false, true, 0); + Map placeTargetMap = new HashMap<>(); + + BlockPos placeTarget = null; + boolean useRangeSorting = false; + + for (BlockPos placeTargetTest : placeTargetList) { + for (Entity entity : mc.world.loadedEntityList) { + + if (!(entity instanceof EntityPlayer)) { + continue; + } + if (entity == mc.player) { + continue; + } + if (Friends.isFriend(entity.getName())) { + continue; + } + useRangeSorting = true; + if (isAreaPlaceable(placeTargetTest)) { + double distanceToEntity = entity.getDistance(placeTargetTest.x, placeTargetTest.y, placeTargetTest.z); + // Add distance to Map Value of placeTarget Key + placeTargetMap.put(placeTargetTest, placeTargetMap.containsKey(placeTargetTest) ? placeTargetMap.get(placeTargetTest) + distanceToEntity : distanceToEntity); + } + + } } - int range = (int) Math.ceil(placeRange.getValue()); - int yOffsetSanitized = yOffset.getValue() < 0 ? -1 * yOffset.getValue() : yOffset.getValue(); + if (placeTargetMap.size() > 0) { - BlockPos placeTargetPos = findPlaceAreaInRow(basePos, yOffsetSanitized, range, facingDirection); + placeTargetMap.forEach((k, v) -> { + if (!isAreaPlaceable(k)) { + placeTargetMap.remove(k); + } + }); - if (placeTargetPos == null) { - if (debugMessages.getValue()) { - Command.sendChatMessage("Not enough space to place optimal Hopper, searching for Blocks in a sphere."); + if (placeTargetMap.size() == 0) { + useRangeSorting = false; } - CrystalAura ca = (CrystalAura) ModuleManager.getModuleByName("CrystalAura"); - // TODO - sorting for optimal hopper placement (good kill possibility > bad kill possibility) goes here - for (BlockPos pos : ca.getSphere(getPlayerPos(), range, range, false, true, 0)) { - if (findPlaceArea(pos) != null) { - placeTargetPos = pos; + + } + + if (useRangeSorting) { + + if (placeCloseToEnemy.getValue()) { + if (debugMessages.getValue()) { + Command.sendChatMessage("Placing close to Enemy"); + } + // Get Key with lowest Value (closest to enemies) + placeTarget = Collections.min(placeTargetMap.entrySet(), Map.Entry.comparingByValue()).getKey(); + } else { + if (debugMessages.getValue()) { + Command.sendChatMessage("Placing far from Enemy"); + } + // Get Key with highest Value (furthest away from enemies) + placeTarget = Collections.max(placeTargetMap.entrySet(), Map.Entry.comparingByValue()).getKey(); + } + + } else { + + if (debugMessages.getValue()) { + Command.sendChatMessage("No enemy nearby, placing at first found"); + } + + // Use any place target position if no enemies are around + for (BlockPos pos : placeTargetList) { + if (isAreaPlaceable(pos)) { + placeTarget = pos; break; } } + } - if (placeTargetPos == null) { + if (placeTarget == null) { if (debugMessages.getValue()) { - Command.sendChatMessage("Not enough space, disabling."); + Command.sendChatMessage("No valid position in range to place."); } this.disable(); return; } if (debugMessages.getValue()) { - Command.sendChatMessage("Place Target: " + placeTargetPos.toString() + " Distance: " + df.format(mc.player.getPositionVector().distanceTo(new Vec3d(placeTargetPos)))); + Command.sendChatMessage("Place Target: " + placeTarget.toString() + " Distance: " + df.format(mc.player.getPositionVector().distanceTo(new Vec3d(placeTarget)))); } mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING)); mc.player.inventory.currentItem = hopperSlot; - placeBlock(new BlockPos(placeTargetPos), spoofRotation.getValue()); + placeBlock(new BlockPos(placeTarget), spoofRotation.getValue()); mc.player.inventory.currentItem = shulkerSlot; - placeBlock(new BlockPos(placeTargetPos.add(0, 1, 0)), spoofRotation.getValue()); + placeBlock(new BlockPos(placeTarget.add(0, 1, 0)), spoofRotation.getValue()); - if (placeObi.getValue() && obiSlot != -1) { + if (placeObiOnTop.getValue() && obiSlot != -1) { mc.player.inventory.currentItem = obiSlot; - placeBlock(new BlockPos(placeTargetPos.add(0, 2, 0)), spoofRotation.getValue()); + placeBlock(new BlockPos(placeTarget.add(0, 2, 0)), spoofRotation.getValue()); } mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); mc.player.inventory.currentItem = shulkerSlot; - BlockPos hopperPos = new BlockPos(placeTargetPos); + BlockPos hopperPos = new BlockPos(placeTarget); mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(hopperPos, EnumFacing.DOWN, EnumHand.MAIN_HAND, 0, 0, 0)); swordSlot = shulkerSlot + 32; @@ -223,63 +270,40 @@ public class Auto32k extends Module { } - private BlockPos findPlaceAreaInRow(BlockPos placeTestNextPos, int yOffsetSanitized, int range, EnumFacing facingDirection) { - - for (int i = range; i > 0; i--) { - - placeTestNextPos = placeTestNextPos.add(facingDirection.getXOffset(), 0, facingDirection.getZOffset()); - - for (int j = (-1 * yOffsetSanitized); j < (1 + yOffsetSanitized); j++) { - - BlockPos testPos = findPlaceArea(placeTestNextPos.add(0, j, 0)); - if (testPos != null) { - return testPos; - } - - } - - } - - return null; - - } - - private BlockPos findPlaceArea(BlockPos blockPos) { + private boolean isAreaPlaceable(BlockPos blockPos) { for (Entity entity : mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(blockPos))) { if (entity instanceof EntityLivingBase) { - return null; // entity on block + return false; // entity on block } } if (!mc.world.getBlockState(blockPos).getMaterial().isReplaceable()) { - return null; // no space for hopper + return false; // no space for hopper } if (!mc.world.getBlockState(blockPos.add(0, 1, 0)).getMaterial().isReplaceable()) { - return null; // no space for shulker + return false; // no space for shulker } if (mc.world.getBlockState(blockPos.add(0, -1, 0)).getBlock() instanceof BlockAir) { - return null; // air below hopper + return false; // air below hopper } if (mc.world.getBlockState(blockPos.add(0, -1, 0)).getBlock() instanceof BlockLiquid) { - return null; // liquid below hopper + return false; // liquid below hopper } if (mc.player.getPositionVector().distanceTo(new Vec3d(blockPos)) > placeRange.getValue()) { - return null; // out of range + return false; // 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(blockPos), false, true, false); - if (!(result == null || result.getBlockPos().equals(blockPos))) { - return null; - } + return result == null || result.getBlockPos().equals(blockPos); } - return blockPos; + return true; } From 2a8bff1ef705d06fa7bfa9b80a482a87848cfb8d Mon Sep 17 00:00:00 2001 From: blockparole <> Date: Mon, 28 Oct 2019 00:36:12 +0100 Subject: [PATCH 3/3] Auto32k sane default Settings --- .../me/zeroeightsix/kami/module/modules/combat/Auto32k.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 040c2baa..27a49b2b 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 @@ -59,10 +59,10 @@ 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 placeCloseToEnemy = register(Settings.b("Place close to enemy", true)); + private Setting placeCloseToEnemy = register(Settings.b("Place close to enemy", false)); private Setting placeObiOnTop = register(Settings.b("Place Obi on Top", true)); private Setting spoofRotation = register(Settings.b("Spoof Rotation", true)); - private Setting raytraceCheck = register(Settings.b("Raytrace Check", true)); + private Setting raytraceCheck = register(Settings.b("Raytrace Check", false)); private Setting debugMessages = register(Settings.b("Debug Messages", false)); private int swordSlot;