Record Class BedRule
java.lang.Object
java.lang.Record
net.minecraft.world.attribute.BedRule
public record BedRule(BedRule.Rule canSleep, BedRule.Rule canSetSpawn, boolean destroyOnUse, boolean destroyOnLeave, 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> static final BedRulestatic final BedRuleprivate final booleanThe field for thedestroyOnLeaverecord component.private final booleanThe field for thedestroyOnUserecord component.The field for theerrorMessagerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionBedRule(BedRule.Rule canSleep, BedRule.Rule canSetSpawn, boolean destroyOnUse, boolean destroyOnLeave, 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.booleanbooleanReturns the value of thedestroyOnLeaverecord component.booleanReturns the value of thedestroyOnUserecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theerrorMessagerecord 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. -
destroyOnUse
private final boolean destroyOnUseThe field for thedestroyOnUserecord component. -
destroyOnLeave
private final boolean destroyOnLeaveThe field for thedestroyOnLeaverecord component. -
errorMessage
-
CAN_SLEEP_WHEN_DARK
-
DESTROY_ON_USE
-
DESTROY_ON_LEAVE
-
CODEC
-
-
Constructor Details
-
BedRule
public BedRule(BedRule.Rule canSleep, BedRule.Rule canSetSpawn, boolean destroyOnUse, boolean destroyOnLeave, Optional<Component> errorMessage) Creates an instance of aBedRulerecord class.- Parameters:
canSleep- the value for thecanSleeprecord componentcanSetSpawn- the value for thecanSetSpawnrecord componentdestroyOnUse- the value for thedestroyOnUserecord componentdestroyOnLeave- the value for thedestroyOnLeaverecord 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
-
destroyOnUse
public boolean destroyOnUse()Returns the value of thedestroyOnUserecord component.- Returns:
- the value of the
destroyOnUserecord component
-
destroyOnLeave
public boolean destroyOnLeave()Returns the value of thedestroyOnLeaverecord component.- Returns:
- the value of the
destroyOnLeaverecord component
-
errorMessage
-