Skip to content

Commit

Permalink
use crosshairTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
hexadecimal233 committed Oct 16, 2022
1 parent 0e11ac8 commit 193eadd
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,10 @@ public void onGetBlockBreakingSpeed(BlockState block, CallbackInfoReturnable<Flo
float breakSpeed = cir.getReturnValue();
float breakSpeedMod = (float) (breakSpeed * module.modifier.get());

if (module.modifier.get() < 1) {
cir.setReturnValue(breakSpeedMod);
return;
}

HitResult result = mc.player.raycast(mc.interactionManager.getReachDistance(), 1f / 20f, false);
HitResult result = mc.crosshairTarget;
if (result.getType() == HitResult.Type.BLOCK) {
BlockPos pos = ((BlockHitResult) result).getBlockPos();
if (BlockUtils.canInstaBreak(pos, breakSpeed) == BlockUtils.canInstaBreak(pos, breakSpeedMod))
if (module.modifier.get() < 1 || (BlockUtils.canInstaBreak(pos, breakSpeed) == BlockUtils.canInstaBreak(pos, breakSpeedMod)))
cir.setReturnValue(breakSpeedMod);
else
cir.setReturnValue(BlockUtils.getMaxNonInstantBreakSpeed(pos));
Expand Down

0 comments on commit 193eadd

Please sign in to comment.