Java Code Examples for net.minecraft.util.math.Vec3d#squaredDistanceTo()
The following examples show how to use
net.minecraft.util.math.Vec3d#squaredDistanceTo() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShapeDispatcher.java From fabric-carpet with MIT License | 6 votes |
public static int drawParticleLine(List<ServerPlayerEntity> players, ParticleEffect particle, Vec3d from, Vec3d to, double density) { if (isStraight(from, to, density)) return drawOptimizedParticleLine(players, particle, from, to, density); double lineLengthSq = from.squaredDistanceTo(to); if (lineLengthSq == 0) return 0; Vec3d incvec = to.subtract(from).multiply(2*density/MathHelper.sqrt(lineLengthSq)); int pcount = 0; for (Vec3d delta = new Vec3d(0.0,0.0,0.0); delta.lengthSquared()<lineLengthSq; delta = delta.add(incvec.multiply(Expression.randomizer.nextFloat()))) { for (ServerPlayerEntity player : players) { player.getServerWorld().spawnParticles(player, particle, true, delta.x+from.x, delta.y+from.y, delta.z+from.z, 1, 0.0, 0.0, 0.0, 0.0); pcount ++; } } return pcount; }
Example 2
Source File: BonemealAuraHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private boolean rightClickBlockSimple(BlockPos pos) { Vec3d eyesPos = RotationUtils.getEyesPos(); Vec3d posVec = Vec3d.ofCenter(pos); double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec); for(Direction side : Direction.values()) { Vec3d hitVec = posVec.add(Vec3d.of(side.getVector()).multiply(0.5)); double distanceSqHitVec = eyesPos.squaredDistanceTo(hitVec); // check if hitVec is within range (6 blocks) if(distanceSqHitVec > 36) continue; // check if side is facing towards player if(distanceSqHitVec >= distanceSqPosVec) continue; // place block IMC.getInteractionManager().rightClickBlock(pos, side, hitVec); return true; } return false; }
Example 3
Source File: ParticleDisplay.java From fabric-carpet with MIT License | 5 votes |
public static void drawParticleLine(ServerPlayerEntity player, Vec3d from, Vec3d to, String main, String accent, int count, double spread) { ParticleEffect accentParticle = getEffect(accent); ParticleEffect mainParticle = getEffect(main); if (accentParticle != null) ((ServerWorld)player.world).spawnParticles( player, accentParticle, true, to.x, to.y, to.z, count, spread, spread, spread, 0.0); double lineLengthSq = from.squaredDistanceTo(to); if (lineLengthSq == 0) return; Vec3d incvec = to.subtract(from).normalize();// multiply(50/sqrt(lineLengthSq)); int pcount = 0; for (Vec3d delta = new Vec3d(0.0,0.0,0.0); delta.lengthSquared()<lineLengthSq; delta = delta.add(incvec.multiply(player.world.random.nextFloat()))) { ((ServerWorld)player.world).spawnParticles( player, mainParticle, true, delta.x+from.x, delta.y+from.y, delta.z+from.z, 1, 0.0, 0.0, 0.0, 0.0); } }
Example 4
Source File: BuildRandomHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private boolean placeBlockSimple_old(BlockPos pos) { Vec3d eyesPos = RotationUtils.getEyesPos(); Vec3d posVec = Vec3d.ofCenter(pos); for(Direction side : Direction.values()) { BlockPos neighbor = pos.offset(side); // check if neighbor can be right clicked if(!BlockUtils.canBeClicked(neighbor)) continue; Vec3d hitVec = posVec.add(Vec3d.of(side.getVector()).multiply(0.5)); // check if hitVec is within range (6 blocks) if(eyesPos.squaredDistanceTo(hitVec) > 36) continue; // place block IMC.getInteractionManager().rightClickBlock(neighbor, side.getOpposite(), hitVec); return true; } return false; }
Example 5
Source File: AutoBuildHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
private void buildInstantly() { Vec3d eyesPos = RotationUtils.getEyesPos(); IClientPlayerInteractionManager im = IMC.getInteractionManager(); double rangeSq = Math.pow(range.getValue(), 2); for(BlockPos pos : remainingBlocks) { if(!BlockUtils.getState(pos).getMaterial().isReplaceable()) continue; Vec3d posVec = Vec3d.ofCenter(pos); for(Direction side : Direction.values()) { BlockPos neighbor = pos.offset(side); // check if neighbor can be right-clicked if(!BlockUtils.canBeClicked(neighbor)) continue; Vec3d sideVec = Vec3d.of(side.getVector()); Vec3d hitVec = posVec.add(sideVec.multiply(0.5)); // check if hitVec is within range if(eyesPos.squaredDistanceTo(hitVec) > rangeSq) continue; // place block im.rightClickBlock(neighbor, side.getOpposite(), hitVec); break; } } remainingBlocks.clear(); }
Example 6
Source File: BarrowFeature.java From the-hallow with MIT License | 5 votes |
private boolean generate(IWorld world, Random rand, BlockPos pos, CoordinateFunction<SurfaceConfig> configFunction) { int centreX = pos.getX() + rand.nextInt(16) - 8; int centreZ = pos.getZ() + rand.nextInt(16) - 8; int lowY = pos.getY() - 3; int radius = rand.nextInt(6) + 7; int height = rand.nextInt(4) + 6; double radiusSquared = radius * radius; Vec3d origin = new Vec3d(centreX, 0, centreZ); BlockPos.Mutable posMutable = new BlockPos.Mutable(); for (int xOffset = -radius; xOffset <= radius; ++xOffset) { int x = centreX + xOffset; for (int zOffset = -radius; zOffset <= radius; ++zOffset) { int z = centreZ + zOffset; Vec3d position = new Vec3d(x, 0, z); double sqrDistTo = position.squaredDistanceTo(origin); if (sqrDistTo <= radiusSquared) { double progress = MathHelper.perlinFade(sqrDistTo / radiusSquared); int heightOffset = (int) MathHelper.lerp(progress, height, 0); heightOffset += (int) MathHelper.lerp(progress, offsetNoise.sample(x, z), 0); posMutable.setX(x); posMutable.setZ(z); this.generateBarrowColumn(world, rand, lowY, heightOffset, posMutable, configFunction.get(posMutable)); } } } return true; }
Example 7
Source File: AutoBuildHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
@Override public void onRender(float partialTicks) { if(status != Status.BUILDING) return; double scale = 1D * 7D / 8D; double offset = (1D - scale) / 2D; Vec3d eyesPos = RotationUtils.getEyesPos(); double rangeSq = Math.pow(range.getValue(), 2); // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(2F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor4f(0F, 0F, 0F, 0.5F); GL11.glPushMatrix(); RenderUtils.applyRenderOffset(); int blocksDrawn = 0; for(Iterator<BlockPos> itr = remainingBlocks.iterator(); itr.hasNext() && blocksDrawn < 1024;) { BlockPos pos = itr.next(); if(!BlockUtils.getState(pos).getMaterial().isReplaceable()) continue; GL11.glPushMatrix(); GL11.glTranslated(pos.getX(), pos.getY(), pos.getZ()); GL11.glTranslated(offset, offset, offset); GL11.glScaled(scale, scale, scale); Vec3d posVec = Vec3d.ofCenter(pos); if(eyesPos.squaredDistanceTo(posVec) <= rangeSq) drawGreenBox(); else RenderUtils.drawOutlinedBox(); GL11.glPopMatrix(); blocksDrawn++; } GL11.glPopMatrix(); // GL resets GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glColor4f(1, 1, 1, 1); }
Example 8
Source File: Tracer.java From fabric-carpet with MIT License | 4 votes |
public static EntityHitResult rayTraceEntities(Entity source, Vec3d start, Vec3d end, Box box, Predicate<Entity> predicate, double maxSqDistance) { World world = source.world; double targetDistance = maxSqDistance; Entity target = null; Vec3d targetHitPos = null; for (Entity current : world.getEntities(source, box, predicate)) { Box currentBox = current.getBoundingBox().expand(current.getTargetingMargin()); Optional<Vec3d> currentHit = currentBox.rayTrace(start, end); if (currentBox.contains(start)) { if (targetDistance >= 0) { target = current; targetHitPos = currentHit.orElse(start); targetDistance = 0; } } else if (currentHit.isPresent()) { Vec3d currentHitPos = currentHit.get(); double currentDistance = start.squaredDistanceTo(currentHitPos); if (currentDistance < targetDistance || targetDistance == 0) { if (current.getRootVehicle() == source.getRootVehicle()) { if (targetDistance == 0) { target = current; targetHitPos = currentHitPos; } } else { target = current; targetHitPos = currentHitPos; targetDistance = currentDistance; } } } } if (target == null) return null; return new EntityHitResult(target, targetHitPos); }
Example 9
Source File: TunnellerHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
private boolean breakBlockSimple(BlockPos pos) { Direction side = null; Direction[] sides = Direction.values(); Vec3d eyesPos = RotationUtils.getEyesPos(); Vec3d relCenter = BlockUtils.getBoundingBox(pos) .offset(-pos.getX(), -pos.getY(), -pos.getZ()).getCenter(); Vec3d center = Vec3d.of(pos).add(relCenter); Vec3d[] hitVecs = new Vec3d[sides.length]; for(int i = 0; i < sides.length; i++) { Vec3i dirVec = sides[i].getVector(); Vec3d relHitVec = new Vec3d(relCenter.x * dirVec.getX(), relCenter.y * dirVec.getY(), relCenter.z * dirVec.getZ()); hitVecs[i] = center.add(relHitVec); } for(int i = 0; i < sides.length; i++) { // check line of sight if(MC.world .rayTrace(new RayTraceContext(eyesPos, hitVecs[i], RayTraceContext.ShapeType.COLLIDER, RayTraceContext.FluidHandling.NONE, MC.player)) .getType() != HitResult.Type.MISS) continue; side = sides[i]; break; } if(side == null) { double distanceSqToCenter = eyesPos.squaredDistanceTo(center); for(int i = 0; i < sides.length; i++) { // check if side is facing towards player if(eyesPos.squaredDistanceTo(hitVecs[i]) >= distanceSqToCenter) continue; side = sides[i]; break; } } if(side == null) throw new RuntimeException( "How could none of the sides be facing towards the player?!"); // face block WURST.getRotationFaker().faceVectorPacket(hitVecs[side.ordinal()]); // damage block if(!MC.interactionManager.updateBlockBreakingProgress(pos, side)) return false; // swing arm MC.player.networkHandler .sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); return true; }
Example 10
Source File: TunnellerHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
private void placeBlockSimple(BlockPos pos) { Direction side = null; Direction[] sides = Direction.values(); Vec3d eyesPos = RotationUtils.getEyesPos(); Vec3d posVec = Vec3d.ofCenter(pos); double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec); Vec3d[] hitVecs = new Vec3d[sides.length]; for(int i = 0; i < sides.length; i++) hitVecs[i] = posVec.add(Vec3d.of(sides[i].getVector()).multiply(0.5)); for(int i = 0; i < sides.length; i++) { // check if neighbor can be right clicked BlockPos neighbor = pos.offset(sides[i]); if(!BlockUtils.canBeClicked(neighbor)) continue; // check line of sight BlockState neighborState = BlockUtils.getState(neighbor); VoxelShape neighborShape = neighborState.getOutlineShape(MC.world, neighbor); if(MC.world.rayTraceBlock(eyesPos, hitVecs[i], neighbor, neighborShape, neighborState) != null) continue; side = sides[i]; break; } if(side == null) for(int i = 0; i < sides.length; i++) { // check if neighbor can be right clicked if(!BlockUtils.canBeClicked(pos.offset(sides[i]))) continue; // check if side is facing away from player if(distanceSqPosVec > eyesPos.squaredDistanceTo(hitVecs[i])) continue; side = sides[i]; break; } if(side == null) return; Vec3d hitVec = hitVecs[side.ordinal()]; // face block WURST.getRotationFaker().faceVectorPacket(hitVec); if(RotationUtils.getAngleToLastReportedLookVec(hitVec) > 1) return; // check timer if(IMC.getItemUseCooldown() > 0) return; // place block IMC.getInteractionManager().rightClickBlock(pos.offset(side), side.getOpposite(), hitVec); // swing arm MC.player.networkHandler .sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); // reset timer IMC.setItemUseCooldown(4); }
Example 11
Source File: NukerLegitHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
private boolean breakBlockExtraLegit(BlockPos pos) { Vec3d eyesPos = RotationUtils.getEyesPos(); Vec3d posVec = Vec3d.ofCenter(pos); double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec); for(Direction side : Direction.values()) { Vec3d hitVec = posVec.add(Vec3d.of(side.getVector()).multiply(0.5)); double distanceSqHitVec = eyesPos.squaredDistanceTo(hitVec); // check if hitVec is within range (4.25 blocks) if(distanceSqHitVec > 18.0625) continue; // check if side is facing towards player if(distanceSqHitVec >= distanceSqPosVec) continue; // check line of sight if(MC.world .rayTrace(new RayTraceContext(eyesPos, hitVec, RayTraceContext.ShapeType.COLLIDER, RayTraceContext.FluidHandling.NONE, MC.player)) .getType() != HitResult.Type.MISS) continue; // face block WURST.getRotationFaker().faceVectorClient(hitVec); if(currentBlock != null) WURST.getHax().autoToolHack.equipIfEnabled(currentBlock); // if attack key is down but nothing happens, release it for one // tick if(MC.options.keyAttack.isPressed() && !MC.interactionManager.isBreakingBlock()) { MC.options.keyAttack.setPressed(false); return true; } // damage block MC.options.keyAttack.setPressed(true); return true; } return false; }
Example 12
Source File: InstantBunkerHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
private void placeBlockSimple(BlockPos pos) { Direction side = null; Direction[] sides = Direction.values(); Vec3d eyesPos = RotationUtils.getEyesPos(); Vec3d posVec = Vec3d.ofCenter(pos); double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec); Vec3d[] hitVecs = new Vec3d[sides.length]; for(int i = 0; i < sides.length; i++) hitVecs[i] = posVec.add(Vec3d.of(sides[i].getVector()).multiply(0.5)); for(int i = 0; i < sides.length; i++) { // check if neighbor can be right clicked BlockPos neighbor = pos.offset(sides[i]); if(!BlockUtils.canBeClicked(neighbor)) continue; // check line of sight BlockState neighborState = BlockUtils.getState(neighbor); VoxelShape neighborShape = neighborState.getOutlineShape(MC.world, neighbor); if(MC.world.rayTraceBlock(eyesPos, hitVecs[i], neighbor, neighborShape, neighborState) != null) continue; side = sides[i]; break; } if(side == null) for(int i = 0; i < sides.length; i++) { // check if neighbor can be right clicked if(!BlockUtils.canBeClicked(pos.offset(sides[i]))) continue; // check if side is facing away from player if(distanceSqPosVec > eyesPos.squaredDistanceTo(hitVecs[i])) continue; side = sides[i]; break; } if(side == null) return; Vec3d hitVec = hitVecs[side.ordinal()]; // face block // WURST.getRotationFaker().faceVectorPacket(hitVec); // if(RotationUtils.getAngleToLastReportedLookVec(hitVec) > 1) // return; // check timer // if(IMC.getItemUseCooldown() > 0) // return; // place block IMC.getInteractionManager().rightClickBlock(pos.offset(side), side.getOpposite(), hitVec); // swing arm MC.player.networkHandler .sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); // reset timer IMC.setItemUseCooldown(4); }
Example 13
Source File: BonemealAuraHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
private boolean rightClickBlockLegit(BlockPos pos) { Vec3d eyesPos = RotationUtils.getEyesPos(); Vec3d posVec = Vec3d.ofCenter(pos); double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec); for(Direction side : Direction.values()) { Vec3d hitVec = posVec.add(Vec3d.of(side.getVector()).multiply(0.5)); double distanceSqHitVec = eyesPos.squaredDistanceTo(hitVec); // check if hitVec is within range (4.25 blocks) if(distanceSqHitVec > 18.0625) continue; // check if side is facing towards player if(distanceSqHitVec >= distanceSqPosVec) continue; // check line of sight if(MC.world .rayTrace(new RayTraceContext(eyesPos, hitVec, RayTraceContext.ShapeType.COLLIDER, RayTraceContext.FluidHandling.NONE, MC.player)) .getType() != HitResult.Type.MISS) continue; // face block WURST.getRotationFaker().faceVectorPacket(hitVec); // place block IMC.getInteractionManager().rightClickBlock(pos, side, hitVec); MC.player.swingHand(Hand.MAIN_HAND); IMC.setItemUseCooldown(4); return true; } return false; }
Example 14
Source File: AutoFarmHack.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
private void placeBlockSimple(BlockPos pos) { Direction side = null; Direction[] sides = Direction.values(); Vec3d eyesPos = RotationUtils.getEyesPos(); Vec3d posVec = Vec3d.ofCenter(pos); double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec); Vec3d[] hitVecs = new Vec3d[sides.length]; for(int i = 0; i < sides.length; i++) hitVecs[i] = posVec.add(Vec3d.of(sides[i].getVector()).multiply(0.5)); for(int i = 0; i < sides.length; i++) { // check if neighbor can be right clicked BlockPos neighbor = pos.offset(sides[i]); if(!BlockUtils.canBeClicked(neighbor)) continue; // check line of sight BlockState neighborState = BlockUtils.getState(neighbor); VoxelShape neighborShape = neighborState.getOutlineShape(MC.world, neighbor); if(MC.world.rayTraceBlock(eyesPos, hitVecs[i], neighbor, neighborShape, neighborState) != null) continue; side = sides[i]; break; } if(side == null) for(int i = 0; i < sides.length; i++) { // check if neighbor can be right clicked if(!BlockUtils.canBeClicked(pos.offset(sides[i]))) continue; // check if side is facing away from player if(distanceSqPosVec > eyesPos.squaredDistanceTo(hitVecs[i])) continue; side = sides[i]; break; } if(side == null) return; Vec3d hitVec = hitVecs[side.ordinal()]; // face block WURST.getRotationFaker().faceVectorPacket(hitVec); if(RotationUtils.getAngleToLastReportedLookVec(hitVec) > 1) return; // check timer if(IMC.getItemUseCooldown() > 0) return; // place block IMC.getInteractionManager().rightClickBlock(pos.offset(side), side.getOpposite(), hitVec); // swing arm MC.player.networkHandler .sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); // reset timer IMC.setItemUseCooldown(4); }
Example 15
Source File: AutoBuildHack.java From Wurst7 with GNU General Public License v3.0 | 3 votes |
private boolean tryToPlace(BlockPos pos, Vec3d eyesPos, double rangeSq) { Vec3d posVec = Vec3d.ofCenter(pos); double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec); for(Direction side : Direction.values()) { BlockPos neighbor = pos.offset(side); // check if neighbor can be right clicked if(!BlockUtils.canBeClicked(neighbor) || BlockUtils.getState(neighbor).getMaterial().isReplaceable()) continue; Vec3d dirVec = Vec3d.of(side.getVector()); Vec3d hitVec = posVec.add(dirVec.multiply(0.5)); // check if hitVec is within range if(eyesPos.squaredDistanceTo(hitVec) > rangeSq) continue; // check if side is visible (facing away from player) if(distanceSqPosVec > eyesPos.squaredDistanceTo(posVec.add(dirVec))) continue; // check line of sight if(checkLOS.isChecked() && MC.world .rayTrace(new RayTraceContext(eyesPos, hitVec, RayTraceContext.ShapeType.COLLIDER, RayTraceContext.FluidHandling.NONE, MC.player)) .getType() != HitResult.Type.MISS) continue; // face block Rotation rotation = RotationUtils.getNeededRotations(hitVec); PlayerMoveC2SPacket.LookOnly packet = new PlayerMoveC2SPacket.LookOnly(rotation.getYaw(), rotation.getPitch(), MC.player.isOnGround()); MC.player.networkHandler.sendPacket(packet); // place block IMC.getInteractionManager().rightClickBlock(neighbor, side.getOpposite(), hitVec); MC.player.swingHand(Hand.MAIN_HAND); IMC.setItemUseCooldown(4); return true; } return false; }
Example 16
Source File: BuildRandomHack.java From Wurst7 with GNU General Public License v3.0 | 3 votes |
private boolean placeBlockLegit(BlockPos pos) { Vec3d eyesPos = RotationUtils.getEyesPos(); Vec3d posVec = Vec3d.ofCenter(pos); double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec); for(Direction side : Direction.values()) { BlockPos neighbor = pos.offset(side); // check if neighbor can be right clicked if(!BlockUtils.canBeClicked(neighbor)) continue; Vec3d dirVec = Vec3d.of(side.getVector()); Vec3d hitVec = posVec.add(dirVec.multiply(0.5)); // check if hitVec is within range (4.25 blocks) if(eyesPos.squaredDistanceTo(hitVec) > 18.0625) continue; // check if side is visible (facing away from player) if(distanceSqPosVec > eyesPos.squaredDistanceTo(posVec.add(dirVec))) continue; // check line of sight if(MC.world .rayTrace(new RayTraceContext(eyesPos, hitVec, RayTraceContext.ShapeType.COLLIDER, RayTraceContext.FluidHandling.NONE, MC.player)) .getType() != HitResult.Type.MISS) continue; // face block Rotation rotation = RotationUtils.getNeededRotations(hitVec); PlayerMoveC2SPacket.LookOnly packet = new PlayerMoveC2SPacket.LookOnly(rotation.getYaw(), rotation.getPitch(), MC.player.isOnGround()); MC.player.networkHandler.sendPacket(packet); // place block IMC.getInteractionManager().rightClickBlock(neighbor, side.getOpposite(), hitVec); MC.player.swingHand(Hand.MAIN_HAND); IMC.setItemUseCooldown(4); return true; } return false; }
Example 17
Source File: ScaffoldWalkHack.java From Wurst7 with GNU General Public License v3.0 | 1 votes |
private boolean placeBlock(BlockPos pos) { Vec3d eyesPos = new Vec3d(MC.player.getX(), MC.player.getY() + MC.player.getEyeHeight(MC.player.getPose()), MC.player.getZ()); for(Direction side : Direction.values()) { BlockPos neighbor = pos.offset(side); Direction side2 = side.getOpposite(); // check if side is visible (facing away from player) if(eyesPos.squaredDistanceTo(Vec3d.ofCenter(pos)) >= eyesPos .squaredDistanceTo(Vec3d.ofCenter(neighbor))) continue; // check if neighbor can be right clicked if(!BlockUtils.canBeClicked(neighbor)) continue; Vec3d hitVec = Vec3d.ofCenter(neighbor) .add(Vec3d.of(side2.getVector()).multiply(0.5)); // check if hitVec is within range (4.25 blocks) if(eyesPos.squaredDistanceTo(hitVec) > 18.0625) continue; // place block Rotation rotation = RotationUtils.getNeededRotations(hitVec); PlayerMoveC2SPacket.LookOnly packet = new PlayerMoveC2SPacket.LookOnly(rotation.getYaw(), rotation.getPitch(), MC.player.isOnGround()); MC.player.networkHandler.sendPacket(packet); IMC.getInteractionManager().rightClickBlock(neighbor, side2, hitVec); MC.player.swingHand(Hand.MAIN_HAND); IMC.setItemUseCooldown(4); return true; } return false; }