Hi,
This is my first complete plugin. Of course I'm open to suggestions and if you find any errors please let me know and I'll fix them. I will update the plugin whenever there is a good new idea or if I have to fix a bug. (But I'm pretty sure my plugin will work flawless).
The plugin works both in Singleplayer and Multiplayer on Servers.
The download link is in the attachment. Just unzip the folder into your plugins folder. Make sure the folder structure is "plugins/AnimalFarming/AnimalFarming.jar".
Download: Download the .zip file from the attachment at the bottom of the post.
Installation: How to install/run a plugin
Source Code (1.0.1): https://pastebin.com/knYNwEXp
So what can this plugin do?
Farmable Animals
You can lure and breed the following animals:
Cows, Pigs, Chickens, Goats, Rabbits, Deers and Sheep
Luring Animals
To lure an animal you have to hold a carrot equipped in your hand, stand in front of the animal, look at the animal and press the Interaction Key ("F" by default, the same key used for sheering sheep or collecting plants). The animal wont eat your carrot, but it will move to the location you were standing when you pressed F. In practice you need to look at the animal standing in interaction range (same as sheering sheep) and move backwards while keep pressing F on the animal so it will move to your locations. Just try in the game and you'll notice that it's pretty self-explaining.
Breeding Animals
To breed an animal you have to have 64 corncobs anywhere in your inventory/slotbar. Hold a corncob in your hand and press F (Interaction Key) on the animal. The plugin will search your inventory and slotbar for all corncobs and remove 64 of them. All the other corncobs will stay untouched. (The stack size or position of the corncobs in your inventory doesn't matter, it will just remove 64 of them whereever they are, just in case if your are worrying about bugs. I made sure everything works fine.)
Screenshots
1) Luring an animal with a carrot by pressing F
2) Just cloned/bred a second cow with a corncob in my hand and pressing F, while having 64 corncobs in my inventory.