Record Class ConditionRule
java.lang.Object
java.lang.Record
net.minecraft.world.level.levelgen.material.rule.ConditionRule
- All Implemented Interfaces:
MaterialRule
public record ConditionRule(MaterialCondition ifTrue, MaterialRule thenRun)
extends Record
implements MaterialRule
-
Nested Class Summary
Nested classes/interfaces inherited from interface MaterialRule
MaterialRule.HolderHolder -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ConditionRule> private final MaterialConditionThe field for theifTruerecord component.private final MaterialRuleThe field for thethenRunrecord component.Fields inherited from interface MaterialRule
DIRECT_CODEC, HOLDER_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionConditionRule(MaterialCondition ifTrue, MaterialRule thenRun) Creates an instance of aConditionRulerecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec<ConditionRule> codec()compile(MaterialRuleContext context) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.ifTrue()Returns the value of theifTruerecord component.thenRun()Returns the value of thethenRunrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
ifTrue
The field for theifTruerecord component. -
thenRun
The field for thethenRunrecord component. -
CODEC
-
-
Constructor Details
-
ConditionRule
Creates an instance of aConditionRulerecord class.- Parameters:
ifTrue- the value for theifTruerecord componentthenRun- the value for thethenRunrecord component
-
-
Method Details
-
codec
- Specified by:
codecin interfaceMaterialRule
-
compile
- Specified by:
compilein interfaceMaterialRule
-
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). -
ifTrue
Returns the value of theifTruerecord component.- Returns:
- the value of the
ifTruerecord component
-
thenRun
Returns the value of thethenRunrecord component.- Returns:
- the value of the
thenRunrecord component
-