Search in sources :

Example 96 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project Neutrino by FrostWizard4.

the class PlayerEntityMixin method neutrino$tickWitherTanzanite.

@Inject(at = @At("HEAD"), method = "tick()V")
private void neutrino$tickWitherTanzanite(CallbackInfo ci) {
    if (this.hasStatusEffect(StatusEffects.WITHER)) {
        if (this.inventory.getArmorStack(0).isOf(ItemRegistry.JEWELED_DIAMOND_BOOTS) && this.inventory.getArmorStack(1).isOf(ItemRegistry.JEWELED_DIAMOND_LEGGINGS) && this.inventory.getArmorStack(2).isOf(ItemRegistry.JEWELED_DIAMOND_CHESTPLATE) && this.inventory.getArmorStack(3).isOf(ItemRegistry.JEWELED_DIAMOND_HELMET)) {
            int duration = this.getStatusEffect(StatusEffects.WITHER).getDuration();
            int amplifier = this.getStatusEffect(StatusEffects.WITHER).getAmplifier();
            this.removeStatusEffect(StatusEffects.WITHER);
            this.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, duration, amplifier));
        }
    }
    if (this.isOnFire() && (this.inventory.getArmorStack(0).isOf(ItemRegistry.JEWELED_DIAMOND_BOOTS) || this.inventory.getArmorStack(1).isOf(ItemRegistry.JEWELED_DIAMOND_LEGGINGS) || this.inventory.getArmorStack(2).isOf(ItemRegistry.JEWELED_DIAMOND_CHESTPLATE) || this.inventory.getArmorStack(3).isOf(ItemRegistry.JEWELED_DIAMOND_HELMET))) {
        this.damage(DamageSource.ON_FIRE, 0.5F);
    }
    if (this.getDamageTracker().wasRecentlyAttacked() && this.getDamageTracker().getMostRecentDamage() != null && this.getDamageTracker().getMostRecentDamage().getDamageSource().isMagic()) {
        this.heal(this.getDamageTracker().getMostRecentDamage().getDamage() - (this.getDamageTracker().getMostRecentDamage().getDamage() / 2));
    }
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 97 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project Neutrino by FrostWizard4.

the class GoatHorn method use.

@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity playerEntity, Hand hand) {
    // Play Sound
    playerEntity.playSound(WAR_HORN_USE, 1.0F, 1.0F);
    // Apply Effects
    for (Entity e : world.getOtherEntities(playerEntity, Box.of(playerEntity.getPos(), 10, 10, 10))) {
        if (e instanceof MobEntity) {
            if (playerEntity.distanceTo(e) < 10) {
                ((MobEntity) e).addStatusEffect(new StatusEffectInstance(StatusEffects.WEAKNESS, 250, 2));
            }
        }
    }
    // Set 20 second Cooldown
    playerEntity.getItemCooldownManager().set(ItemRegistry.GOAT_HORN, 400);
    return TypedActionResult.success(playerEntity.getStackInHand(hand));
}
Also used : Entity(net.minecraft.entity.Entity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) MobEntity(net.minecraft.entity.mob.MobEntity) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) MobEntity(net.minecraft.entity.mob.MobEntity)

Example 98 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project Neutrino by FrostWizard4.

the class DaturaBlade method postHit.

@Override
public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) {
    target.addStatusEffect(new StatusEffectInstance(StatusEffects.POISON, 300));
    stack.damage(1, attacker, (e) -> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
    return true;
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 99 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project Neutrino by FrostWizard4.

the class UpdraftTomeArtifact method use.

@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity playerEntity, Hand hand) {
    // Play Sound
    playerEntity.playSound(UPDRAFT_TOME_ACTIVATE, 1.0F, 1.0F);
    // Add Levitation
    for (Entity e : world.getOtherEntities(playerEntity, Box.of(playerEntity.getPos(), 10, 10, 10))) {
        if (e instanceof MobEntity) {
            if (playerEntity.distanceTo(e) < 10) {
                ((MobEntity) e).addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION, 20, 15));
            }
        }
    }
    // Set 10 second Cooldown
    playerEntity.getItemCooldownManager().set(ItemRegistry.UPDRAFT_TOME, 200);
    return TypedActionResult.success(playerEntity.getStackInHand(hand));
}
Also used : Entity(net.minecraft.entity.Entity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) MobEntity(net.minecraft.entity.mob.MobEntity) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) MobEntity(net.minecraft.entity.mob.MobEntity)

Aggregations

StatusEffectInstance (net.minecraft.entity.effect.StatusEffectInstance)99 LivingEntity (net.minecraft.entity.LivingEntity)14 StatusEffect (net.minecraft.entity.effect.StatusEffect)14 ItemStack (net.minecraft.item.ItemStack)14 PlayerEntity (net.minecraft.entity.player.PlayerEntity)13 Inject (org.spongepowered.asm.mixin.injection.Inject)12 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)8 List (java.util.List)3 Sprite (net.minecraft.client.texture.Sprite)3 StatusEffectSpriteManager (net.minecraft.client.texture.StatusEffectSpriteManager)3 Entity (net.minecraft.entity.Entity)3 Box (net.minecraft.util.math.Box)3 ArrayList (java.util.ArrayList)2 EventHandler (mathax.client.eventbus.EventHandler)2 StatusEffectInstanceAccessor (mathax.client.mixin.StatusEffectInstanceAccessor)2 StatusEffectInstanceAccessor (meteordevelopment.meteorclient.mixin.StatusEffectInstanceAccessor)2 ThirstManager (net.dehydration.thirst.ThirstManager)2 PlayerEnvAccess (net.environmentz.access.PlayerEnvAccess)2 TextRenderer (net.minecraft.client.font.TextRenderer)2 InGameHud (net.minecraft.client.gui.hud.InGameHud)2