Package net.minecraft.world.effect
Class MobEffectInstance
java.lang.Object
net.minecraft.world.effect.MobEffectInstance
- All Implemented Interfaces:
Comparable<MobEffectInstance>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate intprivate final MobEffectInstance.BlendStatestatic final com.mojang.serialization.Codec<MobEffectInstance> private final Set<EffectCure> private intprivate MobEffectInstanceA hidden effect which is not shown to the player.static final intprivate static final org.slf4j.Loggerstatic final intstatic final intprivate booleanstatic final StreamCodec<RegistryFriendlyByteBuf, MobEffectInstance> private boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionMobEffectInstance(Holder<MobEffect> pEffect) MobEffectInstance(Holder<MobEffect> pEffect, int pDuration) MobEffectInstance(Holder<MobEffect> pEffect, int pDuration, int pAmplifier) MobEffectInstance(Holder<MobEffect> pEffect, int pDuration, int pAmplifier, boolean pAmbient, boolean pVisible) MobEffectInstance(Holder<MobEffect> pEffect, int pDuration, int pAmplifier, boolean pAmbient, boolean pVisible, boolean pShowIcon) MobEffectInstance(Holder<MobEffect> pEffect, int pDuration, int pAmplifier, boolean pAmbient, boolean pVisible, boolean pShowIcon, MobEffectInstance pHiddenEffect) privateMobEffectInstance(Holder<MobEffect> pEffect, MobEffectInstance.Details p_324529_) MobEffectInstance(MobEffectInstance pOther) -
Method Summary
Modifier and TypeMethodDescriptionprivate MobEffectInstance.DetailsintcompareTo(MobEffectInstance pOther) voidcopyBlendState(MobEffectInstance pEffectInstance) private StringbooleanendsWithin(int pDuration) booleanintfloatgetBlendFactor(LivingEntity pEntity, float pDelta) getCures()intinthashCode()private booleanbooleanbooleanbooleanprivate booleanbooleanstatic MobEffectInstanceload(CompoundTag pNbt) Read a custom potion effect from a potion item's NBT data.intmapDuration(it.unimi.dsi.fastutil.ints.Int2IntFunction pMapper) voidonEffectAdded(LivingEntity pLivingEntity) voidonEffectStarted(LivingEntity pEntity) voidonMobHurt(LivingEntity pLivingEntity, DamageSource pDamageSource, float pAmount) voidonMobRemoved(LivingEntity pLivingEntity, Entity.RemovalReason pReason) save()(package private) voidsetDetailsFrom(MobEffectInstance pEffectInstance) booleanshowIcon()voidbooleantick(LivingEntity pEntity, Runnable pOnExpirationRunnable) private inttoString()booleanupdate(MobEffectInstance pOther)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
INFINITE_DURATION
public static final int INFINITE_DURATION- See Also:
-
MIN_AMPLIFIER
public static final int MIN_AMPLIFIER- See Also:
-
MAX_AMPLIFIER
public static final int MAX_AMPLIFIER- See Also:
-
CODEC
-
STREAM_CODEC
-
effect
-
duration
private int duration -
amplifier
private int amplifier -
ambient
private boolean ambient -
visible
private boolean visible -
showIcon
private boolean showIcon -
blendState
-
cures
-
-
Constructor Details
-
MobEffectInstance
-
MobEffectInstance
-
MobEffectInstance
-
MobEffectInstance
-
MobEffectInstance
-
MobEffectInstance
public MobEffectInstance(Holder<MobEffect> pEffect, int pDuration, int pAmplifier, boolean pAmbient, boolean pVisible, boolean pShowIcon, @Nullable MobEffectInstance pHiddenEffect) -
MobEffectInstance
-
MobEffectInstance
-
-
Method Details
-
asDetails
-
getBlendFactor
-
getParticleOptions
-
setDetailsFrom
-
update
-
isShorterDurationThan
-
isInfiniteDuration
public boolean isInfiniteDuration() -
endsWithin
public boolean endsWithin(int pDuration) -
mapDuration
public int mapDuration(it.unimi.dsi.fastutil.ints.Int2IntFunction pMapper) -
getEffect
-
getDuration
public int getDuration() -
getAmplifier
public int getAmplifier() -
isAmbient
public boolean isAmbient() -
isVisible
public boolean isVisible() -
showIcon
public boolean showIcon() -
tick
-
hasRemainingDuration
private boolean hasRemainingDuration() -
tickDownDuration
private int tickDownDuration() -
onEffectStarted
-
onMobRemoved
-
onMobHurt
-
getDescriptionId
-
toString
-
describeDuration
-
equals
-
hashCode
public int hashCode() -
save
-
load
Read a custom potion effect from a potion item's NBT data. -
compareTo
- Specified by:
compareToin interfaceComparable<MobEffectInstance>
-
onEffectAdded
-
is
-
copyBlendState
-
skipBlending
public void skipBlending() -
getCures
- Returns:
- the
EffectCures which can cure theMobEffectheld by thisMobEffectInstance
-