HitResult Crosshair Target Spoof
Minecraft Gameplay Impact
Directly constructs synthetic EntityHitResult objects and injects them into MinecraftClient.crosshairTarget, causing vanilla click handlers to register attacks on targets even when the crosshair points at empty space.
Functions & APIs Analyzed
EntityHitResult.<init>
Constructs raycast intersection result targeting an entity (class_3966).
MinecraftClient.crosshairTarget
Field holding current crosshair intersection object (field_1765).
Mod Implementation (Dev Source / Mapped)
// Developer Source (Fabric / Yarn mappings)
public class HitResultSpoofer {
public static void spoof(MinecraftClient client, Entity target) {
client.crosshairTarget = new EntityHitResult(target, target.getPos());
}
}
Decompiled Representation (Vineflower View)
// Decompiled with Vineflower 1.12 (Intermediary mappings)
public class HitResultSpoofer {
public static void spoof(class_310 client, class_1297 target) {
client.field_1765 = new class_3966(target, target.method_19538());
}
}
Bytecode Signature & Static Detection
Detects instantiation of EntityHitResult (class_3966) assigned directly to MinecraftClient.crosshairTarget (field_1765).