summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/affixes/FlatLifeHitAffix.java
blob: d11cc419d5ecaf3c712303da5f4219fffbf1d8b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package darkknight.jewelrycraft.affixes;

import darkknight.jewelrycraft.api.ModifierEffect;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingAttackEvent;

public class FlatLifeHitAffix extends ModifierEffect {
	private int amount;

	public FlatLifeHitAffix(int amount) {
		super(null);

		this.amount = amount;
	}

	@Override
	public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry,
			LivingAttackEvent event) {
		if (target instanceof EntityLiving) {
			player.heal(amount);
		}
	}
}