Record Class ConditionalValue
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.providers.number.floats.ConditionalValue
- All Implemented Interfaces:
ConditionalProvider<ContextFloatProvider>, ContextFloatProvider, Validatable
public record ConditionalValue(Holder<LootItemCondition> condition, Holder<ContextFloatProvider> onTrue, Holder<ContextFloatProvider> onFalse)
extends Record
implements ContextFloatProvider, ConditionalProvider<ContextFloatProvider>
-
Nested Class Summary
Nested classes/interfaces inherited from interface ConditionalProvider
ConditionalProvider.Factory<Value,Self> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ConditionalValue> private final Holder<LootItemCondition> The field for theconditionrecord component.static final com.mojang.serialization.MapCodec<ConditionalValue> private final Holder<ContextFloatProvider> The field for theonFalserecord component.private final Holder<ContextFloatProvider> The field for theonTruerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionConditionalValue(Holder<LootItemCondition> condition, Holder<ContextFloatProvider> onTrue, Holder<ContextFloatProvider> onFalse) Creates an instance of aConditionalValuerecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<ConditionalValue> codec()Returns the value of theconditionrecord component.final booleanIndicates whether some other object is "equal to" this one.floatgetFloatUnsafe(LootContext context) final inthashCode()Returns a hash code value for this object.onFalse()Returns the value of theonFalserecord component.onTrue()Returns the value of theonTruerecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface ConditionalProvider
selectValue, validateMethods inherited from interface ContextFloatProvider
getFloat, getFloatOrThrow
-
Field Details
-
condition
The field for theconditionrecord component. -
onTrue
The field for theonTruerecord component. -
onFalse
The field for theonFalserecord component. -
MAP_CODEC
-
CODEC
-
-
Constructor Details
-
ConditionalValue
public ConditionalValue(Holder<LootItemCondition> condition, Holder<ContextFloatProvider> onTrue, Holder<ContextFloatProvider> onFalse) Creates an instance of aConditionalValuerecord class.- Parameters:
condition- the value for theconditionrecord componentonTrue- the value for theonTruerecord componentonFalse- the value for theonFalserecord component
-
-
Method Details
-
getFloatUnsafe
- Specified by:
getFloatUnsafein interfaceContextFloatProvider
-
codec
- Specified by:
codecin interfaceContextFloatProvider
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
condition
Returns the value of theconditionrecord component.- Specified by:
conditionin interfaceConditionalProvider<ContextFloatProvider>- Returns:
- the value of the
conditionrecord component
-
onTrue
Returns the value of theonTruerecord component.- Specified by:
onTruein interfaceConditionalProvider<ContextFloatProvider>- Returns:
- the value of the
onTruerecord component
-
onFalse
Returns the value of theonFalserecord component.- Specified by:
onFalsein interfaceConditionalProvider<ContextFloatProvider>- Returns:
- the value of the
onFalserecord component
-