Search in sources :

Example 21 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project WK by witches-kitchen.

the class DrunkStatusEffect method applyUpdateEffect.

// Todo: Increment to a max of level 4 if one drinks too much
@Override
public void applyUpdateEffect(LivingEntity entity, int amplifier) {
    if (amplifier == 1) {
        entity.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 2000, 1));
    }
    if (amplifier == 2) {
        entity.addStatusEffect(new StatusEffectInstance(StatusEffects.BLINDNESS, 4000, 2));
        entity.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 4000, 2));
    }
    if (amplifier >= 3) {
        entity.addStatusEffect(new StatusEffectInstance(StatusEffects.BLINDNESS, 6000, 3));
        entity.addStatusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 6000, 3));
        entity.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 6000, 3));
    }
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 22 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsArmors by chronosacaria.

the class EnchantmentEffects method applyReckless.

public static void applyReckless(ServerPlayerEntity player) {
    if (!Mcda.CONFIG.mcdaEnableEnchantAndEffectConfig.enableEnchantment.get(RECKLESS))
        return;
    int recklessLevel = EnchantmentHelper.getEquipmentLevel(EnchantsRegistry.enchants.get(RECKLESS), player);
    if (recklessLevel == 0)
        return;
    float recklessHealth = player.getMaxHealth() * 0.4F;
    if (player.getHealth() >= recklessHealth)
        player.setHealth(recklessHealth);
    StatusEffectInstance reckless = new StatusEffectInstance(StatusEffects.STRENGTH, 40, recklessLevel - 1, false, false);
    player.addStatusEffect(reckless);
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 23 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsArmors by chronosacaria.

the class EnchantmentEffects method applyPotionBarrier.

public static void applyPotionBarrier(PlayerEntity playerEntity) {
    if (!isInstantHealthPotion(playerEntity.getMainHandStack()))
        return;
    int potionBarrierLevel = EnchantmentHelper.getEquipmentLevel(EnchantsRegistry.enchants.get(POTION_BARRIER), playerEntity);
    if (potionBarrierLevel == 0)
        return;
    StatusEffectInstance resistance = new StatusEffectInstance(StatusEffects.RESISTANCE, 60 + (20 * potionBarrierLevel), 3);
    playerEntity.addStatusEffect(resistance);
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 24 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsArmors by chronosacaria.

the class EnchantmentEffects method applySwiftfooted.

public static void applySwiftfooted(ServerPlayerEntity player) {
    if (!Mcda.CONFIG.mcdaEnableEnchantAndEffectConfig.enableEnchantment.get(SWIFTFOOTED))
        return;
    int swiftfootedLevel = EnchantmentHelper.getEquipmentLevel(EnchantsRegistry.enchants.get(SWIFTFOOTED), player);
    if (swiftfootedLevel == 0)
        return;
    if (!player.isOnGround()) {
        StatusEffectInstance swiftfooted = new StatusEffectInstance(StatusEffects.SPEED, 60, swiftfootedLevel - 1, false, false);
        player.addStatusEffect(swiftfooted);
    }
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 25 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsArmors by chronosacaria.

the class EnchantmentEffects method applyFrenzied.

public static void applyFrenzied(ServerPlayerEntity player) {
    if (!Mcda.CONFIG.mcdaEnableEnchantAndEffectConfig.enableEnchantment.get(FRENZIED))
        return;
    if (player.getHealth() <= (0.5F * player.getMaxHealth())) {
        int frenziedLevel = EnchantmentHelper.getEquipmentLevel(EnchantsRegistry.enchants.get(FRENZIED), player);
        if (frenziedLevel == 0)
            return;
        StatusEffectInstance frenzied = new StatusEffectInstance(StatusEffects.HASTE, 40, frenziedLevel - 1, false, false);
        player.addStatusEffect(frenzied);
    }
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Aggregations

StatusEffectInstance (net.minecraft.entity.effect.StatusEffectInstance)128 LivingEntity (net.minecraft.entity.LivingEntity)25 PlayerEntity (net.minecraft.entity.player.PlayerEntity)20 StatusEffect (net.minecraft.entity.effect.StatusEffect)16 ItemStack (net.minecraft.item.ItemStack)15 Inject (org.spongepowered.asm.mixin.injection.Inject)13 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)10 TypedActionResult (net.minecraft.util.TypedActionResult)7 Sprite (net.minecraft.client.texture.Sprite)4 AreaEffectCloudEntity (net.minecraft.entity.AreaEffectCloudEntity)4 Entity (net.minecraft.entity.Entity)4 MobEntity (net.minecraft.entity.mob.MobEntity)4 Box (net.minecraft.util.math.Box)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 List (java.util.List)3 StatusEffectSpriteManager (net.minecraft.client.texture.StatusEffectSpriteManager)3 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 HWGEntity (mod.azure.hwg.entity.HWGEntity)2 ThirstManager (net.dehydration.thirst.ThirstManager)2