ProjectZombie/src/projectzombie/items/ItemHealthPotion.java

30 lines
673 B
Java
Executable File

package projectzombie.items;
import projectzombie.entity.player.EntityPlayer;
import projectzombie.init.Models;
import projectzombie.util.math.ItemStack;
import projectzombie.world.chunk.Chunk;
import projectzombie.world.layer.Layer;
public class ItemHealthPotion extends Item
{
public ItemHealthPotion() {
this.texture = Models.ITEM_HEALTH_POTION;
}
@Override
public String getName(short meta) {
return "Health Potion "+meta+" HP";
}
@Override
public void onPlayerAction(ItemStack stack, Layer layer, Chunk chunk, EntityPlayer player) {
super.onPlayerAction(stack, layer, chunk, player);
// Heal the player
player.addHealth(stack.meta);
}
}