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 theeffects
record component.private final float
The field for theprobability
record component. -
Constructor Summary
ConstructorsConstructorDescriptionApplyStatusEffectsConsumeEffect
(List<MobEffectInstance> p_366447_) ApplyStatusEffectsConsumeEffect
(List<MobEffectInstance> effects, float probability) Creates an instance of aApplyStatusEffectsConsumeEffect
record class.ApplyStatusEffectsConsumeEffect
(MobEffectInstance p_366678_) ApplyStatusEffectsConsumeEffect
(MobEffectInstance p_366514_, float p_366567_) -
Method Summary
Modifier and TypeMethodDescriptionboolean
apply
(Level p_366679_, ItemStack p_366517_, LivingEntity p_366435_) effects()
Returns the value of theeffects
record component.final boolean
Indicates whether some other object is "equal to" this one.getType()
final int
hashCode()
Returns a hash code value for this object.float
Returns the value of theprobability
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
effects
The field for theeffects
record component. -
probability
private final float probabilityThe field for theprobability
record component. -
CODEC
-
STREAM_CODEC
public static final StreamCodec<RegistryFriendlyByteBuf,ApplyStatusEffectsConsumeEffect> STREAM_CODEC
-
-
Constructor Details
-
ApplyStatusEffectsConsumeEffect
-
ApplyStatusEffectsConsumeEffect
-
ApplyStatusEffectsConsumeEffect
-
ApplyStatusEffectsConsumeEffect
Creates an instance of aApplyStatusEffectsConsumeEffect
record class.- Parameters:
effects
- the value for theeffects
record componentprobability
- the value for theprobability
record component
-
-
Method Details
-
getType
- Specified by:
getType
in interfaceConsumeEffect
-
apply
- Specified by:
apply
in 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 theeffects
record component.- Returns:
- the value of the
effects
record component
-
probability
public float probability()Returns the value of theprobability
record component.- Returns:
- the value of the
probability
record component
-