Skip to content

Commit

Permalink
Fix no mining trace crashing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wide-Cat committed Aug 2, 2024
1 parent 6c714bf commit 23c87ce
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

@Mixin(GameRenderer.class)
Expand Down Expand Up @@ -120,11 +121,10 @@ private void onRenderWorldTail(CallbackInfo info) {
MeteorClient.EVENT_BUS.post(RenderAfterWorldEvent.get());
}

@Inject(method = "updateCrosshairTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;findCrosshairTarget(Lnet/minecraft/entity/Entity;DDF)Lnet/minecraft/util/hit/HitResult;"), cancellable = true)
private void onUpdateTargetedEntity(float tickDelta, CallbackInfo info) {
if (Modules.get().get(NoMiningTrace.class).canWork() && client.crosshairTarget.getType() == HitResult.Type.BLOCK) {
client.getProfiler().pop();
info.cancel();
@Inject(method = "findCrosshairTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/projectile/ProjectileUtil;raycast(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Box;Ljava/util/function/Predicate;D)Lnet/minecraft/util/hit/EntityHitResult;"), cancellable = true)
private void onUpdateTargetedEntity(Entity camera, double blockInteractionRange, double entityInteractionRange, float tickDelta, CallbackInfoReturnable<HitResult> cir, @Local HitResult hitResult) {
if (Modules.get().get(NoMiningTrace.class).canWork() && hitResult.getType() == HitResult.Type.BLOCK) {
cir.setReturnValue(hitResult);
}
}

Expand Down

0 comments on commit 23c87ce

Please sign in to comment.