if (mc.gameSettings.keyBindAttack.pressed == true) {
if (mc.objectMouseOver.typeOfHit != null && mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {
double bX = mc.thePlayer.posX;
double bY = mc.thePlayer.posY - 1;
double bZ = mc.thePlayer.posZ;
BlockPos pb = new BlockPos(bX, bY, bZ);
MovingObjectPosition ray = rayTrace(500.0D);
if (ray == null) {
return;
}
if (mc.theWorld.getBlockState(pb).getBlock() != Blocks.air) {
double x_old;
double y_old;
double z_old;
double x_new;
double y_new;
double z_new;
x_old = mc.thePlayer.posX;
y_old = mc.thePlayer.posY;
z_old = mc.thePlayer.posZ;
x_new = mc.objectMouseOver.getBlockPos().getX() + 0.5D;
y_new = mc.objectMouseOver.getBlockPos().getY() + 1;
z_new = mc.objectMouseOver.getBlockPos().getZ();
double distance = mc.thePlayer.getDistance(x_new, y_new, z_new);
for (double d = 0.0D; d < distance; d += 2.0D) {
setPos(mc.thePlayer.posX
+ (x_new - mc.thePlayer.getHorizontalFacing().getFrontOffsetX() - mc.thePlayer.posX) * d
/ distance,
mc.thePlayer.posY + (y_new - mc.thePlayer.posY) * d / distance,
mc.thePlayer.posZ + (z_new - mc.thePlayer.getHorizontalFacing().getFrontOffsetZ()
- mc.thePlayer.posZ) * d / distance);
}
setPos(x_new, y_new, z_new);
mc.renderGlobal.loadRenderers();
}
}
}