本文整理匯總了Java中net.minecraft.entity.EntityLivingBase.removePotionEffect方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityLivingBase.removePotionEffect方法的具體用法?Java EntityLivingBase.removePotionEffect怎麽用?Java EntityLivingBase.removePotionEffect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.EntityLivingBase
的用法示例。
在下文中一共展示了EntityLivingBase.removePotionEffect方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onItemUse
import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@SubscribeEvent
public void onItemUse(LivingEntityUseItemEvent event)
{
EntityLivingBase living = event.getEntityLiving();
ItemStack stack = event.getItem();
PotionEffect effect = living.getActivePotionEffect(this);
if(ItemUtil.matchesOreDict(stack,"torch") && effect != null)
{
//TODO: Blow a cloud of fire out
if(effect.getDuration() > 10)
{
PotionEffect reducedEffect = new PotionEffect(this, effect.getDuration() - 5, effect.getAmplifier(), effect.getIsAmbient(), effect.doesShowParticles());
reducedEffect.setCurativeItems(effect.getCurativeItems());
living.addPotionEffect(reducedEffect);
}
else
{
living.removePotionEffect(this);
}
}
}
示例2: onWornTick
import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@Override
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
if (itemstack.getItemDamage() == 0 && player.ticksExisted % 40 == 0) {
if (player.getActivePotionEffect(MobEffects.UNLUCK) != null) {
player.removePotionEffect(MobEffects.UNLUCK);
}
}
}
示例3: onLivingUpdate
import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@SubscribeEvent
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
EntityLivingBase living = event.getEntityLiving();
if(living.equals(MC.player)) {
living.setInvisible(false);
living.removePotionEffect(MobEffects.NAUSEA);
living.removePotionEffect(MobEffects.INVISIBILITY);
living.removePotionEffect(MobEffects.BLINDNESS);
// removes particle effect
FastReflection.Methods.EntityLivingBase_resetPotionEffectMetadata.invoke(living);
} else if(no_particles.get()) {
living.setInvisible(false);
FastReflection.Methods.EntityLivingBase_resetPotionEffectMetadata.invoke(living);
}
}
示例4: apply
import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@Override
public boolean apply(Vec3d location, EntityLivingBase activator, AbilityContext context) {
if (context.getType() == AbilityType.ARMOR_PASSIVE) {
activator.removePotionEffect(this.potion);
activator.addPotionEffect(new PotionEffect(this.potion, this.ticks, this.amplifier, false, false));
} else if (context.getType() == AbilityType.ARMOR_ACTIVE) {
this.addEffect(context.getAttacker());
} else if (context.hasTarget()) {
this.addEffect(context.getTarget());
}
return true;
}
示例5: remove
import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@Override
public void remove(Vec3d location, EntityLivingBase activator, AbilityContext context) {
if (context.getType() == AbilityType.ARMOR_PASSIVE) {
activator.removePotionEffect(this.potion);
} else if (context.getType() == AbilityType.ARMOR_ACTIVE) {
context.getAttacker().removePotionEffect(this.potion);
} else if (context.hasTarget()) {
context.getTarget().removePotionEffect(this.potion);
}
}
示例6: addEffect
import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
private void addEffect(EntityLivingBase entity) {
entity.removePotionEffect(this.potion);
entity.addPotionEffect(new PotionEffect(this.potion, this.ticks, this.amplifier));
}
示例7: holster
import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@Override
public void holster(WeaponsCapability cap, ItemStack stack, EntityLivingBase living, World world) {
cap.setHealTarget(-1);
living.removePotionEffect(TF2weapons.uber);
super.holster(cap, stack, living, world);
}