Package forgottentowns.mod.api
Interface ColonyContext.View
- Enclosing interface:
ColonyContext
public static interface ColonyContext.View
Read-only bounded colony access tied to its creating callback and thread.
Every query rejects an expired scope or a different thread. Returned records and lists are
detached values that may be retained; this view object itself cannot be used after the callback.
-
Method Summary
Modifier and TypeMethodDescriptioncitizen(int id) Looks up a citizen by stable identity.citizens()Returns the captured roster, including any dead or deserting citizens still in the manager.intday()Returns monotonic game calendar day, starting at one.intReturns days in one season, the default month used by simulation mods.intReturns days in the game's year.home(long id) Looks up a home by stable identity.homeOf(int citizenId) Resolves a citizen's assigned home.homes()Returns the captured catalog of supported residential zones.nearby(ColonyContext.Position position, int radius) Queries the shared spatial index using Chebyshev distance on the same level.
-
Method Details
-
day
int day()Returns monotonic game calendar day, starting at one.- Returns:
- monotonic game calendar day, starting at one
- Throws:
IllegalStateException- outside the owning callback or thread
-
daysPerYear
int daysPerYear()Returns days in the game's year.- Returns:
- days in the game's year
- Throws:
IllegalStateException- outside the owning callback or thread
-
daysPerSeason
int daysPerSeason()Returns days in one season, the default month used by simulation mods.- Returns:
- days in one season, the default month used by simulation mods
- Throws:
IllegalStateException- outside the owning callback or thread
-
citizens
List<ColonyContext.Person> citizens()Returns the captured roster, including any dead or deserting citizens still in the manager.- Returns:
- immutable captured roster in stable identity order
- Throws:
IllegalStateException- outside the owning callback or thread
-
citizen
Looks up a citizen by stable identity.- Parameters:
id- citizen identity- Returns:
- snapshot, or null when absent
- Throws:
IllegalStateException- outside the owning callback or thread
-
homes
List<ColonyContext.Home> homes()Returns the captured catalog of supported residential zones.- Returns:
- immutable home catalog in stable identity order
- Throws:
IllegalStateException- outside the owning callback or thread
-
home
Looks up a home by stable identity.- Parameters:
id- home identity- Returns:
- home snapshot, or null when absent
- Throws:
IllegalStateException- outside the owning callback or thread
-
homeOf
Resolves a citizen's assigned home.- Parameters:
citizenId- citizen identity- Returns:
- assigned home, or null when absent
- Throws:
IllegalStateException- outside the owning callback or thread
-
nearby
Queries the shared spatial index using Chebyshev distance on the same level.- Parameters:
position- query origin within the world's tile-coordinate range, or null for no matchesradius- tile radius between zero and 32- Returns:
- immutable nearby living citizen snapshots in stable ID order
- Throws:
IllegalArgumentException- if radius is outside its boundsIllegalStateException- outside the owning callback or thread
-