summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/curses/CurseVampireHunger.java
blob: 7d53f2a3beb0bdd8a530604dadfdd20c46e0330b (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
 * 
 */
package darkknight.jewelrycraft.curses;

import darkknight.jewelrycraft.api.Curse;
import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.util.Variables;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

/**
 * @author Sorin
 *
 */
public class CurseVampireHunger extends Curse {
	protected CurseVampireHunger(String name, int txtID, String texturepack) {
		super(name, txtID, texturepack);
	}

	public void attackedByPlayerAction(World world, EntityPlayer player, Entity target) {
		if (player.shouldHeal() && rand.nextBoolean())
			player.heal(1F);
	}

	@Override
	public void action(World world, EntityPlayer player) {
		if (!player.capabilities.isCreativeMode && world.isDaytime() && !world.isRaining()
				&& world.canBlockSeeTheSky(MathHelper.floor_double(player.posX),
						MathHelper.floor_double(player.posY + 1F), MathHelper.floor_double(player.posZ)))
			player.setFire(8);
	}

	@Override
	public String getDescription() {
		return StatCollector.translateToLocal("curse." + Variables.MODID + ".vampirehunger.description");
	}

	@Override
	public String getDisplayName() {
		return StatCollector.translateToLocal("curse." + Variables.MODID + ".vampirehunger");
	}

	@Override
	public boolean canCurseBeActivated() {
		return ConfigHandler.CURSE_VAMPIRE_HUNGER;
	}
}