Search in sources :

Example 76 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project bewitchment by MoriyaShiine.

the class PowerFortune method tick.

@Override
public boolean tick(ServerWorld world, PlayerEntity target) {
    if (target.getAttacker() != null) {
        target.addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 600));
        target.addStatusEffect(new StatusEffectInstance(StatusEffects.RESISTANCE, 600));
        return true;
    }
    return super.tick(world, target);
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 77 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project bewitchment by MoriyaShiine.

the class BottleOfBloodItem method finishUsing.

@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
    if (BewitchmentAPI.isVampire(user, true)) {
        BWComponents.BLOOD_COMPONENT.get(user).fillBlood(20, false);
    } else {
        user.addStatusEffect(new StatusEffectInstance(StatusEffects.POISON, 200));
        user.addStatusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 200));
    }
    return Items.POTION.finishUsing(stack, world, user);
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 78 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project bewitchment by MoriyaShiine.

the class CourageFortune method tick.

@Override
public boolean tick(ServerWorld world, PlayerEntity target) {
    if (target.getAttacker() != null) {
        target.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 600, 1));
        target.addStatusEffect(new StatusEffectInstance(StatusEffects.SPEED, 600, 1));
        return true;
    }
    return super.tick(world, target);
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 79 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project bewitchment by MoriyaShiine.

the class PurityStatusEffect method applyUpdateEffect.

@Override
public void applyUpdateEffect(LivingEntity entity, int amplifier) {
    if (!entity.world.isClient && entity.age % 20 == 0) {
        Registry.STATUS_EFFECT.stream().forEach(effect -> {
            if (effect.getCategory() == StatusEffectCategory.HARMFUL && entity.hasStatusEffect(effect)) {
                StatusEffectInstance currentPurity = entity.getStatusEffect(this);
                if (currentPurity != null) {
                    entity.removeStatusEffect(this);
                    if (currentPurity.getAmplifier() > 0) {
                        entity.addStatusEffect(new StatusEffectInstance(this, currentPurity.getDuration(), currentPurity.getAmplifier() - 1, currentPurity.isAmbient(), currentPurity.shouldShowParticles(), currentPurity.shouldShowIcon()));
                    }
                    StatusEffectInstance currentNegative = entity.getStatusEffect(effect);
                    entity.removeStatusEffect(effect);
                    if (currentNegative.getAmplifier() > 0) {
                        entity.addStatusEffect(new StatusEffectInstance(effect, currentNegative.getDuration(), currentNegative.getAmplifier() - 1, currentNegative.isAmbient(), currentNegative.shouldShowParticles(), currentNegative.shouldShowIcon()));
                    }
                }
            }
        });
    }
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 80 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project Therrassium by codeman1o1.

the class TherrassiumBlock method onUse.

@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
    if (!world.isClient) {
        player.addStatusEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 1200));
        player.addStatusEffect(new StatusEffectInstance(StatusEffects.SPEED, 1200));
        player.addStatusEffect(new StatusEffectInstance(StatusEffects.JUMP_BOOST, 1200));
        player.addStatusEffect(new StatusEffectInstance(StatusEffects.HASTE, 1200));
        player.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 1200));
        player.addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 1200));
    }
    return ActionResult.SUCCESS;
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Aggregations

StatusEffectInstance (net.minecraft.entity.effect.StatusEffectInstance)107 PlayerEntity (net.minecraft.entity.player.PlayerEntity)18 LivingEntity (net.minecraft.entity.LivingEntity)17 StatusEffect (net.minecraft.entity.effect.StatusEffect)14 ItemStack (net.minecraft.item.ItemStack)14 Inject (org.spongepowered.asm.mixin.injection.Inject)13 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)9 Sprite (net.minecraft.client.texture.Sprite)4 AreaEffectCloudEntity (net.minecraft.entity.AreaEffectCloudEntity)4 Entity (net.minecraft.entity.Entity)4 Box (net.minecraft.util.math.Box)4 List (java.util.List)3 StatusEffectSpriteManager (net.minecraft.client.texture.StatusEffectSpriteManager)3 ImmutableMap (com.google.common.collect.ImmutableMap)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 EventHandler (mathax.client.eventbus.EventHandler)2 StatusEffectInstanceAccessor (mathax.client.mixin.StatusEffectInstanceAccessor)2 HWGEntity (mod.azure.hwg.entity.HWGEntity)2 ThirstManager (net.dehydration.thirst.ThirstManager)2