The Animal Net mod allows you to capture mobs with a net to easily store in your inventory. The nets come in varying sizes depending on how large or small the mob is. Smaller mobs can escape from larger nets and larger mobs won’t fit in the smaller ones. And once crafted you simply right-click on the mob and they automatically land in your inventory.
You can even capture enemies to transport or even simply evade attack.
And NPCs can also be captured with the NPC net.
Mobs can be stored indefinitely and they can also be re-released anywhere you like!