Record Class BedRule
java.lang.Object
java.lang.Record
net.minecraft.world.attribute.BedRule
public record BedRule(BedRule.Rule canSleep, BedRule.Rule canSetSpawn, boolean explodes, Optional<Component> errorMessage)
extends Record
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BedRuleprivate final BedRule.RuleThe field for thecanSetSpawnrecord component.private final BedRule.RuleThe field for thecanSleeprecord component.static final com.mojang.serialization.Codec<BedRule> The field for theerrorMessagerecord component.private final booleanThe field for theexplodesrecord component.static final BedRule -
Constructor Summary
ConstructorsConstructorDescriptionBedRule(BedRule.Rule canSleep, BedRule.Rule canSetSpawn, boolean explodes, Optional<Component> errorMessage) Creates an instance of aBedRulerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecanSetSpawnrecord component.booleancanSetSpawn(Level level) canSleep()Returns the value of thecanSleeprecord component.booleanfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theerrorMessagerecord component.booleanexplodes()Returns the value of theexplodesrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
canSleep
The field for thecanSleeprecord component. -
canSetSpawn
The field for thecanSetSpawnrecord component. -
explodes
private final boolean explodesThe field for theexplodesrecord component. -
errorMessage
-
CAN_SLEEP_WHEN_DARK
-
EXPLODES
-
CODEC
-
-
Constructor Details
-
BedRule
public BedRule(BedRule.Rule canSleep, BedRule.Rule canSetSpawn, boolean explodes, Optional<Component> errorMessage) Creates an instance of aBedRulerecord class.- Parameters:
canSleep- the value for thecanSleeprecord componentcanSetSpawn- the value for thecanSetSpawnrecord componentexplodes- the value for theexplodesrecord componenterrorMessage- the value for theerrorMessagerecord component
-
-
Method Details
-
canSleep
-
canSetSpawn
-
asProblem
-
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. -
canSleep
Returns the value of thecanSleeprecord component.- Returns:
- the value of the
canSleeprecord component
-
canSetSpawn
Returns the value of thecanSetSpawnrecord component.- Returns:
- the value of the
canSetSpawnrecord component
-
explodes
public boolean explodes()Returns the value of theexplodesrecord component.- Returns:
- the value of the
explodesrecord component
-
errorMessage
-