Class MobEffectEvent.Added
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.LivingEvent
net.neoforged.neoforge.event.entity.living.MobEffectEvent
net.neoforged.neoforge.event.entity.living.MobEffectEvent.Added
- Enclosing class:
MobEffectEvent
This event is fired when a new
MobEffectInstance
is added to an entity.
This event is also fired if an entity already has the effect but with a different duration or amplifier.
This event is not ICancellableEvent
.
This event does not have a result.-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.MobEffectEvent
MobEffectEvent.Added, MobEffectEvent.Applicable, MobEffectEvent.Expired, MobEffectEvent.Remove
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingVisibilityEvent
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final net.minecraft.world.effect.MobEffectInstance
private final net.minecraft.world.entity.Entity
Fields inherited from class net.neoforged.neoforge.event.entity.living.MobEffectEvent
effectInstance
-
Constructor Summary
ConstructorsConstructorDescriptionAdded
(net.minecraft.world.entity.LivingEntity living, net.minecraft.world.effect.MobEffectInstance oldEffectInstance, net.minecraft.world.effect.MobEffectInstance newEffectInstance, net.minecraft.world.entity.Entity source) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.effect.MobEffectInstance
@Nullable net.minecraft.world.entity.Entity
@Nullable net.minecraft.world.effect.MobEffectInstance
Methods inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
getEntity
-
Field Details
-
oldEffectInstance
private final net.minecraft.world.effect.MobEffectInstance oldEffectInstance -
source
private final net.minecraft.world.entity.Entity source
-
-
Constructor Details
-
Added
@Internal public Added(net.minecraft.world.entity.LivingEntity living, net.minecraft.world.effect.MobEffectInstance oldEffectInstance, net.minecraft.world.effect.MobEffectInstance newEffectInstance, net.minecraft.world.entity.Entity source)
-
-
Method Details
-
getEffectInstance
public net.minecraft.world.effect.MobEffectInstance getEffectInstance()- Overrides:
getEffectInstance
in classMobEffectEvent
- Returns:
- the added
MobEffectInstance
. This is the unmerged MobEffectInstance if the old MobEffectInstance is not null.
-
getOldEffectInstance
@Nullable public @Nullable net.minecraft.world.effect.MobEffectInstance getOldEffectInstance()- Returns:
- the old
MobEffectInstance
. This can be null if the entity did not have an effect of this kind before.
-
getEffectSource
@Nullable public @Nullable net.minecraft.world.entity.Entity getEffectSource()- Returns:
- the entity source of the effect, or
null
if none exists
-