Combat Proximity Control

About

Client-side Minecraft Fabric mod for version 1.21.11 that detects when a player holds a sword and is within 2.5 blocks of another player. While this condition is met, the mod intercepts forward movement input (W key) and remaps it to backward movement (S key), effectively reversing directional control. The effect activates at 2.5 blocks distance and deactivates at 3 blocks, creating a hysteresis buffer to prevent rapid toggling. The mod uses client-side input handling to modify movement packets sent to the server, ensuring seamless integration without server-side modifications. Key features include sword detection via main hand item check, distance calculation between player and nearest other player, and dynamic key remapping that restores normal controls when the distance threshold is exceeded.