This mod is for FABRIC, it's not going to be ported to Forge. If you want to port this to Forge, go ahead and fork the project.
This mod will not be backported to old versions.
Parry
Overview
Parry is a Fabric mod that brings sword parrying (AKA sword blocking) to modern Minecraft from pre-1.9 versions.
To parry, hold right-click with a sword. Doing so will only let you take 50% of the damage inflicted.
This value can be configured in the ".minecraft/config/parry.json" file:
{
   "default_multiplier": 0.6,
  "consume_animation": false,
   "prioritize_shield": true,
   "overrides": [
    {
      "item": "minecraft:iron_sword",
      "multiplier": 2.5
    },
    {
      "item": "minecraft:gold_sword",
      "multiplier": 10.0
    }
  ]
}
This example states that the player should take 60% of the inflicted damage when parrying. It also presents two exceptions: Iron swords will instead allow the player to inflict 250% the damage inflicted, and gold swords will allow 1000%. Along with this, the parry animation will be instant, instead of having the quick "bob" animation. Lastly, shields are prioritized in this config example, meaning that your shield will block instead of your sword if it's in your offhand.
By default, there are no overrides, the default damage multiplier is 0.5, the consume animation is on, and shields are not prioritized.
The information below is likely going to become redundant in a later update.
To add compatibility with this mod and your sword-adding mod:
All sword items will have the ability to parry with this mod installed. However, they will not display a first-person model change. To add this model change:
Create a "parrying" model file, which should be identical to your original sword model file, but with the parent changed from "item/handheld" to "item/handheld_parry".
Add an override to your sword model file.
"overrides": [{"predicate": {"parrying": 1},"model": "modid:item/my_sword_parry"}]
You may add this mod to your modpack.