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));
}
}
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);
}
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);
}
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);
}
}
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);
}
}
Aggregations