Record Class ApplyStatusEffectsConsumeEffect
java.lang.Object
java.lang.Record
net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect
- All Implemented Interfaces:
ConsumeEffect
public record ApplyStatusEffectsConsumeEffect(List<MobEffectInstance> effects, float probability)
extends Record
implements ConsumeEffect
-
Nested Class Summary
Nested classes/interfaces inherited from interface ConsumeEffect
ConsumeEffect.Type<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ApplyStatusEffectsConsumeEffect> private final List<MobEffectInstance> The field for theeffectsrecord component.private final floatThe field for theprobabilityrecord component.static final StreamCodec<RegistryFriendlyByteBuf, ApplyStatusEffectsConsumeEffect> -
Constructor Summary
ConstructorsConstructorDescriptionApplyStatusEffectsConsumeEffect(List<MobEffectInstance> effects, float probability) Creates an instance of aApplyStatusEffectsConsumeEffectrecord class.ApplyStatusEffectsConsumeEffect(MobEffectInstance effect, float probability) -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(Level level, ItemStack stack, LivingEntity user) effects()Returns the value of theeffectsrecord component.final booleanIndicates whether some other object is "equal to" this one.getType()final inthashCode()Returns a hash code value for this object.floatReturns the value of theprobabilityrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
effects
The field for theeffectsrecord component. -
probability
private final float probabilityThe field for theprobabilityrecord component. -
CODEC
-
STREAM_CODEC
public static final StreamCodec<RegistryFriendlyByteBuf, ApplyStatusEffectsConsumeEffect> STREAM_CODEC
-
-
Constructor Details
-
ApplyStatusEffectsConsumeEffect
-
ApplyStatusEffectsConsumeEffect
-
ApplyStatusEffectsConsumeEffect
-
ApplyStatusEffectsConsumeEffect
Creates an instance of aApplyStatusEffectsConsumeEffectrecord class.- Parameters:
effects- the value for theeffectsrecord componentprobability- the value for theprobabilityrecord component
-
-
Method Details
-
getType
- Specified by:
getTypein interfaceConsumeEffect
-
apply
- Specified by:
applyin interfaceConsumeEffect
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
effects
Returns the value of theeffectsrecord component.- Returns:
- the value of the
effectsrecord component
-
probability
public float probability()Returns the value of theprobabilityrecord component.- Returns:
- the value of the
probabilityrecord component
-