Package net.minecraft.world.effect
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
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private final Map
<Holder<Attribute>, MobEffect.AttributeTemplate> private int
private int
private int
private final MobEffectCategory
private final int
private String
private final Function
<MobEffectInstance, ParticleOptions> private FeatureFlagSet
private Optional
<SoundEvent> static final StreamCodec
<RegistryFriendlyByteBuf, Holder<MobEffect>> Fields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
MobEffect
(MobEffectCategory p_19451_, int p_19452_) protected
MobEffect
(MobEffectCategory category, int color, Function<MobEffectInstance, ParticleOptions> particleFactory) Neo: Constructor that can take in the particle factory as a function of theMobEffectInstance
.protected
MobEffect
(MobEffectCategory p_333963_, int p_333864_, ParticleOptions p_333716_) -
Method Summary
Modifier and TypeMethodDescriptionaddAttributeModifier
(Holder<Attribute> p_316656_, ResourceLocation p_350368_, double p_19475_, AttributeModifier.Operation p_19476_) addAttributeModifier
(Holder<Attribute> attribute, ResourceLocation 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.void
addAttributeModifiers
(AttributeMap p_19479_, int p_19480_) boolean
applyEffectTick
(ServerLevel p_376587_, LivingEntity p_19467_, int p_19468_) void
applyInstantenousEffect
(ServerLevel p_376271_, Entity p_19462_, Entity p_19463_, LivingEntity p_19464_, int p_19465_, double p_19466_) void
createModifiers
(int p_316803_, BiConsumer<Holder<Attribute>, AttributeModifier> p_316902_) createParticleOptions
(MobEffectInstance p_333815_) int
int
int
int
getColor()
protected String
boolean
boolean
void
onEffectAdded
(LivingEntity p_338333_, int p_338715_) void
onEffectStarted
(LivingEntity p_296490_, int p_296147_) void
onMobHurt
(ServerLevel p_376153_, LivingEntity p_338186_, int p_338204_, DamageSource p_338393_, float p_338618_) void
onMobRemoved
(ServerLevel p_376540_, LivingEntity p_338500_, int p_338476_, Entity.RemovalReason p_338373_) void
removeAttributeModifiers
(AttributeMap p_19470_) requiredFeatures
(FeatureFlag... p_338702_) setBlendDuration
(int p_316265_) setBlendDuration
(int p_394323_, int p_394063_, int p_393533_) boolean
shouldApplyEffectTickThisTick
(int p_295329_, int p_295167_) withSoundOnAdded
(SoundEvent p_338383_) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabled
Methods inherited from interface net.neoforged.neoforge.common.extensions.IMobEffectExtension
getSortOrder
-
Field Details
-
CODEC
-
STREAM_CODEC
-
AMBIENT_ALPHA
private static final int AMBIENT_ALPHA -
attributeModifiers
-
category
-
color
private final int color -
particleFactory
-
descriptionId
-
blendInDurationTicks
private int blendInDurationTicks -
blendOutDurationTicks
private int blendOutDurationTicks -
blendOutAdvanceTicks
private int blendOutAdvanceTicks -
soundOnAdded
-
requiredFeatures
-
-
Constructor Details
-
MobEffect
-
MobEffect
-
MobEffect
protected MobEffect(MobEffectCategory category, int color, Function<MobEffectInstance, ParticleOptions> particleFactory) Neo: Constructor that can take in the particle factory as a function of theMobEffectInstance
. This should be used if the desiredParticleOptions
depends on the presence of other registry entries.
-
-
Method Details
-
getBlendInDurationTicks
public int getBlendInDurationTicks() -
getBlendOutDurationTicks
public int getBlendOutDurationTicks() -
getBlendOutAdvanceTicks
public int getBlendOutAdvanceTicks() -
applyEffectTick
-
applyInstantenousEffect
public void applyInstantenousEffect(ServerLevel p_376271_, @Nullable Entity p_19462_, @Nullable Entity p_19463_, LivingEntity p_19464_, int p_19465_, double p_19466_) -
shouldApplyEffectTickThisTick
public boolean shouldApplyEffectTickThisTick(int p_295329_, int p_295167_) -
onEffectStarted
-
onEffectAdded
-
onMobRemoved
public void onMobRemoved(ServerLevel p_376540_, LivingEntity p_338500_, int p_338476_, Entity.RemovalReason p_338373_) -
onMobHurt
public void onMobHurt(ServerLevel p_376153_, LivingEntity p_338186_, int p_338204_, DamageSource p_338393_, float p_338618_) -
isInstantenous
public boolean isInstantenous() -
getOrCreateDescriptionId
-
getDescriptionId
-
getDisplayName
-
getCategory
-
getColor
public int getColor() -
addAttributeModifier
public MobEffect addAttributeModifier(Holder<Attribute> p_316656_, ResourceLocation p_350368_, double p_19475_, AttributeModifier.Operation p_19476_) -
addAttributeModifier
public MobEffect addAttributeModifier(Holder<Attribute> attribute, ResourceLocation 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 modifierid
- ID of the modifieroperation
- Operation of the modifiercurve
- A function mapping effect instance amplifier to modifier amount
-
setBlendDuration
-
setBlendDuration
-
createModifiers
public void createModifiers(int p_316803_, BiConsumer<Holder<Attribute>, AttributeModifier> p_316902_) -
removeAttributeModifiers
-
addAttributeModifiers
-
isBeneficial
public boolean isBeneficial() -
createParticleOptions
-
withSoundOnAdded
-
requiredFeatures
-
requiredFeatures
- Specified by:
requiredFeatures
in interfaceFeatureElement
-