Search in sources :

Example 31 with StatusEffectInstance

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

the class AOEHelper method chainNearbyEntities.

// EXPLODING END
// CHAINING BEGIN
public static void chainNearbyEntities(LivingEntity user, LivingEntity target, float distance, int timeMultiplier) {
    StatusEffectInstance chained = new StatusEffectInstance(StatusEffects.SLOWNESS, 100 * timeMultiplier, 100);
    target.addStatusEffect(chained);
    for (LivingEntity nearbyEntity : getAoeTargets(target, user, distance)) {
        if (nearbyEntity != target) {
            pullTowards(nearbyEntity, target);
            nearbyEntity.addStatusEffect(chained);
        }
    }
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 32 with StatusEffectInstance

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

the class AOECloudHelper method spawnWeakeningCloud.

// Poison Cloud
public static void spawnWeakeningCloud(LivingEntity user, LivingEntity target, int amplifier) {
    AreaEffectCloudEntity areaEffectCloudEntity = new AreaEffectCloudEntity(target.world, target.getX(), target.getY(), target.getZ());
    areaEffectCloudEntity.setOwner(user);
    areaEffectCloudEntity.setRadius(5.0F);
    areaEffectCloudEntity.setRadiusOnUse(-0.5F);
    areaEffectCloudEntity.setWaitTime(10);
    areaEffectCloudEntity.setDuration(60);
    StatusEffectInstance weakening = new StatusEffectInstance(StatusEffects.WEAKNESS, 60, amplifier);
    areaEffectCloudEntity.addEffect(weakening);
    target.world.spawnEntity(areaEffectCloudEntity);
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 33 with StatusEffectInstance

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

the class AOECloudHelper method spawnRegenCloudAtPos.

// Regen Arrow
public static void spawnRegenCloudAtPos(LivingEntity user, boolean arrow, BlockPos blockPos, int amplifier) {
    int inGroundMitigator = arrow ? 1 : 0;
    AreaEffectCloudEntity areaEffectCloudEntity = new AreaEffectCloudEntity(user.world, blockPos.getX(), blockPos.getY() + inGroundMitigator, blockPos.getZ());
    areaEffectCloudEntity.setOwner(user);
    areaEffectCloudEntity.setRadius(5.0F);
    areaEffectCloudEntity.setRadiusOnUse(-0.5F);
    areaEffectCloudEntity.setWaitTime(10);
    areaEffectCloudEntity.setDuration(100);
    StatusEffectInstance regeneration = new StatusEffectInstance(StatusEffects.REGENERATION, 100, amplifier);
    areaEffectCloudEntity.addEffect(regeneration);
    user.world.spawnEntity(areaEffectCloudEntity);
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 34 with StatusEffectInstance

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

the class RushdownEnchantmentMixin method onRushdownEnchantmentKill.

@Inject(at = @At("HEAD"), method = "onDeath", cancellable = true)
private void onRushdownEnchantmentKill(DamageSource source, CallbackInfo ci) {
    if (!(source.getAttacker() instanceof PlayerEntity))
        return;
    LivingEntity user = (LivingEntity) source.getAttacker();
    ItemStack mainHandStack = null;
    if (user != null) {
        mainHandStack = user.getMainHandStack();
    }
    boolean uniqueWeaponFlag = false;
    if (McdwEnchantsConfig.getValue("rushdown")) {
        if (mainHandStack != null && (EnchantmentHelper.getLevel(EnchantsRegistry.RUSHDOWN, mainHandStack) >= 1)) {
            int level = EnchantmentHelper.getLevel(EnchantsRegistry.RUSHDOWN, mainHandStack);
            float rushdownRand = user.getRandom().nextFloat();
            if (rushdownRand <= 0.1F) {
                StatusEffectInstance rushdown = new StatusEffectInstance(StatusEffects.SPEED, level * 100, 2, false, false);
                user.addStatusEffect(rushdown);
            }
        }
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) ItemStack(net.minecraft.item.ItemStack) PlayerEntity(net.minecraft.entity.player.PlayerEntity) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 35 with StatusEffectInstance

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

the class StunningEnchantmentMixin method applyStunningEnchantmentDamage.

@Inject(method = "applyDamage(Lnet/minecraft/entity/damage/DamageSource;F)V", at = @At("HEAD"))
public void applyStunningEnchantmentDamage(DamageSource source, float amount, CallbackInfo info) {
    if (!(source.getAttacker() instanceof PlayerEntity))
        return;
    LivingEntity user = (LivingEntity) source.getAttacker();
    LivingEntity target = (LivingEntity) (Object) this;
    if (source.getSource() instanceof LivingEntity) {
        if (amount != 0.0F) {
            ItemStack mainHandStack = null;
            if (user != null) {
                mainHandStack = user.getMainHandStack();
            }
            boolean uniqueWeaponFlag = false;
            if (McdwEnchantsConfig.getValue("stunning")) {
                if (mainHandStack != null && (EnchantmentHelper.getLevel(EnchantsRegistry.STUNNING, mainHandStack) >= 1)) {
                    int level = EnchantmentHelper.getLevel(EnchantsRegistry.STUNNING, mainHandStack);
                    float chance = user.getRandom().nextFloat();
                    if (chance <= 0.2 + level * 0.15) {
                        target.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 60, 10));
                        target.addStatusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 60, 1));
                    // this.world.sendEntityStatus(this,(byte)35);
                    }
                }
            }
        }
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) ItemStack(net.minecraft.item.ItemStack) PlayerEntity(net.minecraft.entity.player.PlayerEntity) Inject(org.spongepowered.asm.mixin.injection.Inject)

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