Class MobEffect

java.lang.Object
net.minecraft.world.effect.MobEffect
All Implemented Interfaces:
FeatureElement, IMobEffectExtension
Direct Known Subclasses:
AbsorptionMobEffect, BadOmenMobEffect, HungerMobEffect, InfestedMobEffect, InstantenousMobEffect, OozingMobEffect, PoisonMobEffect, RaidOmenMobEffect, RegenerationMobEffect, WeavingMobEffect, WindChargedMobEffect, WitherMobEffect

public class MobEffect extends Object implements FeatureElement, IMobEffectExtension
  • Field Details

  • Constructor Details

  • Method Details

    • getBlendInDurationTicks

      public int getBlendInDurationTicks()
    • getBlendOutDurationTicks

      public int getBlendOutDurationTicks()
    • getBlendOutAdvanceTicks

      public int getBlendOutAdvanceTicks()
    • applyEffectTick

      public boolean applyEffectTick(ServerLevel serverLevel, LivingEntity mob, int amplification)
    • applyInstantenousEffect

      public void applyInstantenousEffect(ServerLevel level, @Nullable Entity source, @Nullable Entity owner, LivingEntity mob, int amplification, double scale)
    • shouldApplyEffectTickThisTick

      public boolean shouldApplyEffectTickThisTick(int tickCount, int amplification)
    • onEffectStarted

      public void onEffectStarted(LivingEntity mob, int amplifier)
    • onEffectAdded

      public void onEffectAdded(LivingEntity mob, int amplifier)
    • onMobRemoved

      public void onMobRemoved(ServerLevel level, LivingEntity mob, int amplifier, Entity.RemovalReason reason)
    • onMobHurt

      public void onMobHurt(ServerLevel level, LivingEntity mob, int amplifier, DamageSource source, float damage)
    • isInstantenous

      public boolean isInstantenous()
    • getOrCreateDescriptionId

      protected String getOrCreateDescriptionId()
    • getDescriptionId

      public String getDescriptionId()
    • getDisplayName

      public Component getDisplayName()
    • getCategory

      public MobEffectCategory getCategory()
    • getColor

      public int getColor()
    • addAttributeModifier

      public MobEffect addAttributeModifier(Holder<Attribute> attribute, Identifier id, double amount, AttributeModifier.Operation operation)
    • addAttributeModifier

      public MobEffect addAttributeModifier(Holder<Attribute> attribute, Identifier id, AttributeModifier.Operation operation, it.unimi.dsi.fastutil.ints.Int2DoubleFunction curve)
      Neo: attribute template with custom level curve, for mob effects providing non-linear attribute modifiers.
      Parameters:
      attribute - The attribute of the modifier
      id - ID of the modifier
      operation - Operation of the modifier
      curve - A function mapping effect instance amplifier to modifier amount
    • setBlendDuration

      public MobEffect setBlendDuration(int ticks)
    • setBlendDuration

      public MobEffect setBlendDuration(int inTicks, int outTicks, int outAdvanceTicks)
    • createModifiers

      public void createModifiers(int amplifier, BiConsumer<Holder<Attribute>, AttributeModifier> consumer)
    • removeAttributeModifiers

      public void removeAttributeModifiers(AttributeMap attributes)
    • addAttributeModifiers

      public void addAttributeModifiers(AttributeMap attributes, int amplifier)
    • isBeneficial

      public boolean isBeneficial()
    • createParticleOptions

      public ParticleOptions createParticleOptions(MobEffectInstance mobEffectInstance)
    • withSoundOnAdded

      public MobEffect withSoundOnAdded(SoundEvent soundEvent)
    • requiredFeatures

      public MobEffect requiredFeatures(FeatureFlag... flags)
    • requiredFeatures

      public FeatureFlagSet requiredFeatures()
      Specified by:
      requiredFeatures in interface FeatureElement