Search in sources :

Example 46 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project Biome-Makeover by Lemonszz.

the class WitchEntityMixin method tickMovement.

@Inject(at = @At("TAIL"), method = "tickMovement")
public void tickMovement(CallbackInfo cbi) {
    if (!isDrinking()) {
        if (random.nextFloat() < 0.10) {
            boolean found = false;
            for (StatusEffectInstance effect : getStatusEffects()) if (((StatusEffectAccess) effect.getEffectType()).bm_getType() == StatusEffectType.HARMFUL) {
                found = true;
                break;
            }
            if (found) {
                this.equipStack(EquipmentSlot.MAINHAND, PotionUtil.setPotion(new ItemStack(Items.POTION), BMPotions.ANTIDOTE_POT));
                this.drinkTimeLeft = this.getMainHandStack().getMaxUseTime();
                this.setDrinking(true);
                if (!this.isSilent()) {
                    this.world.playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
                }
                EntityAttributeInstance entityAttributeInstance = this.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED);
                entityAttributeInstance.removeModifier(DRINKING_SPEED_PENALTY_MODIFIER);
                entityAttributeInstance.addTemporaryModifier(DRINKING_SPEED_PENALTY_MODIFIER);
            }
        }
    }
}
Also used : StatusEffectAccess(party.lemons.biomemakeover.util.access.StatusEffectAccess) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) ItemStack(net.minecraft.item.ItemStack) EntityAttributeInstance(net.minecraft.entity.attribute.EntityAttributeInstance) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 47 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project Biome-Makeover by Lemonszz.

the class GlowfishBucketSaveCriterion method computeFallDamage.

protected int computeFallDamage(ServerPlayerEntity playerEntity) {
    StatusEffectInstance statusEffectInstance = playerEntity.getStatusEffect(StatusEffects.JUMP_BOOST);
    float f = statusEffectInstance == null ? 0.0F : (float) (statusEffectInstance.getAmplifier() + 1);
    return MathHelper.ceil((playerEntity.fallDistance - 3.0F - f) * 1);
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 48 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project Biome-Makeover by Lemonszz.

the class EnchantedTotemItem method activateTotem.

@Override
public void activateTotem(LivingEntity entity, ItemStack stack) {
    if (stack != null) {
        if (entity instanceof ServerPlayerEntity) {
            ((ServerPlayerEntity) entity).incrementStat(Stats.USED.getOrCreateStat(Items.TOTEM_OF_UNDYING));
            Criteria.USED_TOTEM.trigger((ServerPlayerEntity) entity, stack);
        }
        entity.setHealth(entity.getMaxHealth() / 2F);
        entity.clearStatusEffects();
        entity.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 500, 1));
        entity.addStatusEffect(new StatusEffectInstance(StatusEffects.ABSORPTION, 1200, 3));
        entity.addStatusEffect(new StatusEffectInstance(StatusEffects.FIRE_RESISTANCE, 2000, 0));
        entity.addStatusEffect(new StatusEffectInstance(StatusEffects.RESISTANCE, 2000, 0));
        entity.world.sendEntityStatus(entity, (byte) 35);
    }
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity)

Example 49 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project friends-and-foes by Faboslav.

the class IceologerIceChunkEntity method damage.

private void damage(LivingEntity hitEntity) {
    LivingEntity livingEntity = this.getOwner();
    if (hitEntity.isAlive() == false || hitEntity.isInvulnerable() == true || hitEntity == livingEntity || (livingEntity != null && livingEntity.isTeammate(hitEntity))) {
        return;
    }
    hitEntity.damage(DamageSource.MAGIC, 12.0F);
    hitEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 80));
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 50 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project friends-and-foes by Faboslav.

the class IllusionerEntityMixin method createIllusions.

private void createIllusions() {
    this.setWasAttacked(true);
    this.setTicksUntilCanCreateIllusions(ILLUSION_LIFETIME_TICKS);
    this.playMirrorSound();
    Vec3d illusionerPosition = this.getPos();
    float slice = 2.0F * (float) Math.PI / MAX_ILLUSIONS_COUNT;
    int radius = 9;
    int randomPoint = RandomGenerator.generateInt(0, MAX_ILLUSIONS_COUNT - 1);
    for (int point = 0; point < MAX_ILLUSIONS_COUNT; ++point) {
        float angle = slice * point;
        int x = (int) (illusionerPosition.getX() + radius * MathHelper.cos(angle));
        int y = (int) illusionerPosition.getY();
        int z = (int) (illusionerPosition.getZ() + radius * MathHelper.sin(angle));
        this.createIllusion(x, y, z);
        if (randomPoint == point) {
            boolean teleportResult = this.tryToTeleport(x, y, z);
            if (teleportResult) {
                this.addStatusEffect(new StatusEffectInstance(StatusEffects.INVISIBILITY, INVISIBILITY_TICKS));
                this.spawnCloudParticles();
            }
        }
    }
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) Vec3d(net.minecraft.util.math.Vec3d)

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