Java Code Examples for net.minecraft.entity.player.EntityPlayer.getActivePotionEffects()

The following are Jave code examples for showing how to use getActivePotionEffects() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Melodium   File: SongHunt.java   View Source Code Vote up 6 votes
@SubscribeEvent
public void handleBounty(LootingLevelEvent event) {
	EntityLivingBase target = event.getEntityLiving();
	EntityLivingBase attacker = target.getAttackingEntity();
	if (attacker instanceof EntityPlayer) {
		EntityPlayer player = (EntityPlayer) attacker;
		Collection<PotionEffect> potions = player.getActivePotionEffects();
		for (PotionEffect potion : potions) {
			if (potion.getPotion() instanceof PotionHunt) {
				PotionHunt huntPotion = (PotionHunt) potion.getPotion();
				if (huntPotion.appliesTo(target)) {
					event.setLootingLevel(event.getLootingLevel() + 2);

					return;
				}
			}
		}
	}
}