Package forgottentowns.mod.api
Record Class ColonyContext.Person
java.lang.Object
java.lang.Record
forgottentowns.mod.api.ColonyContext.Person
- Record Components:
id- stable citizen identityname- current player-visible namefemale- female identity flagliving- alive and not desertingcivilian- ordinary civilian classificationsoldier- soldier classificationhero- named hero classificationposition- current tile, or null while absenthousehold- shared household key projected by a mod, or emptyneedsBed- whether the citizen currently needs an individual bed
- Enclosing interface:
ColonyContext
public static record ColonyContext.Person(int id, String name, boolean female, boolean living, boolean civilian, boolean soldier, boolean hero, ColonyContext.Position position, String household, boolean needsBed)
extends Record
Immutable citizen identity and projected state.
-
Constructor Summary
ConstructorsConstructorDescriptionPerson(int id, String name, boolean female, boolean living, boolean civilian, boolean soldier, boolean hero, ColonyContext.Position position, String household, boolean needsBed) Creates an instance of aPersonrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleancivilian()Returns the value of thecivilianrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanfemale()Returns the value of thefemalerecord component.final inthashCode()Returns a hash code value for this object.booleanhero()Returns the value of theherorecord component.Returns the value of thehouseholdrecord component.intid()Returns the value of theidrecord component.booleanliving()Returns the value of thelivingrecord component.name()Returns the value of thenamerecord component.booleanneedsBed()Returns the value of theneedsBedrecord component.position()Returns the value of thepositionrecord component.booleansoldier()Returns the value of thesoldierrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Person
public Person(int id, String name, boolean female, boolean living, boolean civilian, boolean soldier, boolean hero, ColonyContext.Position position, String household, boolean needsBed) Creates an instance of aPersonrecord class.- Parameters:
id- the value for theidrecord componentname- the value for thenamerecord componentfemale- the value for thefemalerecord componentliving- the value for thelivingrecord componentcivilian- the value for thecivilianrecord componentsoldier- the value for thesoldierrecord componenthero- the value for theherorecord componentposition- the value for thepositionrecord componenthousehold- the value for thehouseholdrecord componentneedsBed- the value for theneedsBedrecord component
-
-
Method Details
-
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 '=='. -
id
public int id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
female
public boolean female()Returns the value of thefemalerecord component.- Returns:
- the value of the
femalerecord component
-
living
public boolean living()Returns the value of thelivingrecord component.- Returns:
- the value of the
livingrecord component
-
civilian
public boolean civilian()Returns the value of thecivilianrecord component.- Returns:
- the value of the
civilianrecord component
-
soldier
public boolean soldier()Returns the value of thesoldierrecord component.- Returns:
- the value of the
soldierrecord component
-
hero
public boolean hero()Returns the value of theherorecord component.- Returns:
- the value of the
herorecord component
-
position
Returns the value of thepositionrecord component.- Returns:
- the value of the
positionrecord component
-
household
Returns the value of thehouseholdrecord component.- Returns:
- the value of the
householdrecord component
-
needsBed
public boolean needsBed()Returns the value of theneedsBedrecord component.- Returns:
- the value of the
needsBedrecord component
-