Also you can use EntityPlayer#heal(int) to heal the player. Just make sure you do it server side.
I have an example of it being used in an item here.
1
Also you can use EntityPlayer#heal(int) to heal the player. Just make sure you do it server side.
I have an example of it being used in an item here.
1
well, first things first:
This code is a pain to read, upload it to Gist/GitHub or pastebin and link it here for proper formatting and syntax highlighting.
2nd:
in the Item#onItemRightClick() method either set the player's health directly or add a regeneration potion effect. You get the player as parameter from that method. Also add this as very first line to onITemRightClick():
if(world.isRemote) return;
It will make sure to only handle your code serverside, prevents i.e. chat messages from being displayed twice and also saves some resources on the client.
3rd:
Yeah, setMaxDamage() is for durability, but you have to damage the item by yourself using ItemStack#damageItem(int amount).
Oh and one last thing: Why are you still creating a mod for 1.7? It is outdated since about 2 years.
Also it'll be a pain to update to 1.8 or 1.9/1.10, believe me you don't wanna do that...
1
Hello, Im Leon. Moderator of the MCYT Server. The server is currently looking for a spigot 1.8 developer that can create a custom plugin for our server. In detail we are in need a a minigame plugin that can be easily configured from the server data base. We are on low money and we can not pay the full fund right away. But we promise we will pay 12$ before you start creating the plugin and another 12$ after the plugin is complete. once the plugin starts to make money on the server we will pay you another 12$. For more deatils and if you are interested please contact me via skype. Just a reminder we are looking for a trust worthy person that has had some sort of spigot plugin expirience. Skype: Atlantiskid