Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Box;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand Down Expand Up @@ -133,4 +134,19 @@ private double modifyBlockInteractionRange(double original) {
private double modifyEntityInteractionRange(double original) {
return Math.max(0, original + Modules.get().get(Reach.class).entityReach());
}

@Inject(method = "canAttackEntityIn", at = @At("HEAD"), cancellable = true)
private void canReachAttackIn(Box box, double additionalRange, CallbackInfoReturnable<Boolean> cir) {
if (Modules.get().get(Reach.class).isActive()) cir.setReturnValue(true);
}

@Inject(method = "canInteractWithEntityIn", at = @At("HEAD"), cancellable = true)
private void canReachEntityIn(Box box, double additionalRange, CallbackInfoReturnable<Boolean> cir) {
if (Modules.get().get(Reach.class).isActive()) cir.setReturnValue(true);
}

@Inject(method = "canInteractWithBlockAt", at = @At("HEAD"), cancellable = true)
private void canReachBlock(BlockPos pos, double additionalRange, CallbackInfoReturnable<Boolean> cir) {
if (Modules.get().get(Reach.class).isActive()) cir.setReturnValue(true);
}
}