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 net.minecraft.world.item.consume_effects.ConsumeEffect
ConsumeEffect.Type<T extends ConsumeEffect> -
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. -
Constructor Summary
ConstructorsConstructorDescriptionApplyStatusEffectsConsumeEffect(List<MobEffectInstance> p_366447_) ApplyStatusEffectsConsumeEffect(List<MobEffectInstance> effects, float probability) Creates an instance of aApplyStatusEffectsConsumeEffectrecord class.ApplyStatusEffectsConsumeEffect(MobEffectInstance p_366678_) ApplyStatusEffectsConsumeEffect(MobEffectInstance p_366514_, float p_366567_) -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(Level p_366679_, ItemStack p_366517_, LivingEntity p_366435_) 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
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 '=='. -
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
-