mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 02:37:27 +00:00
MC's processUseEntity uses player.getDistanceSqToEntity(dome) for reach validation, which computes center-to-center distance. For domes with radius > 5, this always exceeds the 36-block threshold, making melee impossible regardless of how close the player is to the surface. Fix: server-side processMeleeHits() in onUpdate detects swinging players near the dome surface via ray-sphere intersection, then calls attackTargetEntityWithCurrentItem directly — bypassing MC's broken reach check while preserving full damage calculation (enchantments, crits, etc). Also adds adjustMeleeBoundingBox for client-side entity picking (places a small 2x2x2 BB at the nearest sphere surface point toward the player), and allows melee targeting from both inside and outside the dome. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>