本文整理汇总了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);
}