The Minecraft Joypad Mod (for Java Edition) natively supports Xbox 360 / Xbox One controllers (XInput). PS3 controllers (DualShock 3) use DirectInput/Bluetooth and are not directly recognized.
Some Forge/Fabric mods (e.g., Controllable, Gamepad Support) have broader controller support via SDL2/Gamepad API. Try those instead of Joypad Mod.
No guarantee any wrapper works perfectly. Native XInput controller is the only hassle-free solution.