Package com.minecolonies.api.colony
Interface IColony
- All Known Subinterfaces:
IColonyView
- All Known Implementing Classes:
Colony,ColonyView
public interface IColony
Interface of the Colony and ColonyView which will have to implement the following methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraftforge.common.capabilities.Capability<IColonyTagCapability> -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFreeBlock(net.minecraft.world.level.block.Block block) voidaddFreePosition(net.minecraft.core.BlockPos pos) voidaddGuardToAttackers(AbstractEntityCitizen entityCitizen, net.minecraft.world.entity.player.Player followPlayer) voidaddLoadedChunk(long chunkPos, net.minecraft.world.level.chunk.LevelChunk chunk) Adds a loaded chunk to the colony listvoidaddVisitingPlayer(net.minecraft.world.entity.player.Player player) Add a visiting player.voidaddWayPoint(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState newWayPointState) booleanCalled to check if the colony can be deleted by an automatic cleanup.Get the animal manager of the colony.net.minecraft.core.BlockPosReturns the position of the colony.getCitizen(int id) Get citizen from colony.Get the matching citizen name file of the colony .net.minecraft.nbt.ListTagReturns this colony's banner patterns, as a Listnet.minecraft.nbt.CompoundTagGet the connection manager of the colony.intgetDay()Get the current day of the colony.net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level>Get the colony dimension.longgetDistanceSquared(net.minecraft.core.BlockPos pos) Returns the squared (x, z) distance to the center.Get the event description manager of the colony.Get the event manager of the colony.intgetID()returns this colonies unique id.@NotNull List<net.minecraft.world.entity.player.Player>Returns a set of players receiving important messages for the colony.intGet the last contact of a player to the colony in hours.intReturns the amount of loaded chunkslongGet the last time mercenaries were used.@NotNull List<net.minecraft.world.entity.player.Player>Get the players in the colony which should receive the message.getName()Returns the name of the colony.Get the colony name style.doubleThe colony networking packaging manager.Returns the permissions of the colony.Get the quest manager of the colony.Get the reproduction manager of the colony.@Nullable IRequestergetRequesterBuildingForPosition(@NotNull net.minecraft.core.BlockPos pos) Method used to get aIRequesterfrom a given Position.@NotNull IRequestManagerGet the currentIRequestManagerfor this Colony.Get the research manager.Get the colony level settings module.getState()Returns the colonies current state.Get the statistics manager of the colony.net.minecraft.ChatFormattingGetter for the team colony color.Get the colony style.Get the set of chunk positions which the colony is loading through ticketsGet the travelling manager of the colony.Gets the visitor managerMap<net.minecraft.core.BlockPos,net.minecraft.world.level.block.state.BlockState> default @NotNull List<net.minecraft.core.BlockPos>getWayPoints(@NotNull net.minecraft.core.BlockPos position, @NotNull net.minecraft.core.BlockPos target) @NotNull IWorkManagernet.minecraft.world.level.LevelgetWorld()Method to get the World this colony is in.booleanisActive()Is the colony active currently.booleanbooleanisCoordInColony(net.minecraft.world.level.Level w, net.minecraft.core.BlockPos pos) Determine if a given chunk coordinate is considered to be within the colony's bounds.booleanisDay()Whether it is day for the colonybooleanisRemote()Check if the colony is on the server or client.booleanbooleanisValidAttackingPlayer(net.minecraft.world.entity.player.Player entity) voidCalled to mark this colony dirty, and in need of syncing / saving.voidonServerTick(net.minecraftforge.event.TickEvent.ServerTickEvent event) voidonWorldLoad(@NotNull net.minecraft.world.level.Level w) voidonWorldTick(net.minecraftforge.event.TickEvent.LevelTickEvent event) voidonWorldUnload(@NotNull net.minecraft.world.level.Level w) voidread(net.minecraft.nbt.CompoundTag compound) voidremoveFreeBlock(net.minecraft.world.level.block.Block block) voidremoveFreePosition(net.minecraft.core.BlockPos pos) voidremoveLoadedChunk(long chunkPos) Adds a chunk from the colony listvoidremoveVisitingPlayer(net.minecraft.world.entity.player.Player player) Remove a visiting player.voidsetCanBeAutoDeleted(boolean canBeDeleted) voidsetColonyColor(net.minecraft.ChatFormatting color) voidsetColonyFlag(net.minecraft.nbt.ListTag patterns) voidvoidsetNameStyle(String style) Set the colony name style.voidsetStructurePack(String style) voidsetTextureStyle(String style) Set the texture style of the colony.voidSets whether the colony has a child.booleanuseAdditionalChildTime(int amount) Tries to use a given amount of additional growth-time for childs.voidSave the time when mercenaries are used, to set a cooldown.net.minecraft.nbt.CompoundTagwrite(net.minecraft.nbt.CompoundTag colonyCompound)
-
Field Details
-
CLOSE_COLONY_CAP
static final net.minecraftforge.common.capabilities.Capability<IColonyTagCapability> CLOSE_COLONY_CAP
-
-
Method Details
-
onWorldLoad
void onWorldLoad(@NotNull @NotNull net.minecraft.world.level.Level w) -
onWorldUnload
void onWorldUnload(@NotNull @NotNull net.minecraft.world.level.Level w) -
onServerTick
void onServerTick(@NotNull net.minecraftforge.event.TickEvent.ServerTickEvent event) -
getWorkManager
-
onWorldTick
void onWorldTick(@NotNull net.minecraftforge.event.TickEvent.LevelTickEvent event) -
getCenter
net.minecraft.core.BlockPos getCenter()Returns the position of the colony.- Returns:
- pos of the colony.
-
getName
String getName()Returns the name of the colony.- Returns:
- Name of the colony.
-
setName
-
getPermissions
IPermissions getPermissions()Returns the permissions of the colony.- Returns:
IPermissionsof the colony.
-
isCoordInColony
boolean isCoordInColony(net.minecraft.world.level.Level w, net.minecraft.core.BlockPos pos) Determine if a given chunk coordinate is considered to be within the colony's bounds.- Parameters:
w- World to check.pos- Block Position.- Returns:
- True if inside colony, otherwise false.
-
getDistanceSquared
long getDistanceSquared(net.minecraft.core.BlockPos pos) Returns the squared (x, z) distance to the center.- Parameters:
pos- Block Position.- Returns:
- Squared distance to the center in (x, z) direction.
-
getID
int getID()returns this colonies unique id.- Returns:
- an int representing the id.
-
getTeamColonyColor
net.minecraft.ChatFormatting getTeamColonyColor()Getter for the team colony color.- Returns:
- the color.
-
getColonyFlag
net.minecraft.nbt.ListTag getColonyFlag()Returns this colony's banner patterns, as a List- Returns:
- a list of pattern-color pairs
-
isDay
boolean isDay()Whether it is day for the colony- Returns:
- true if it is day
-
getLastContactInHours
int getLastContactInHours()Get the last contact of a player to the colony in hours.- Returns:
- an integer with a describing value.
-
getWorld
net.minecraft.world.level.Level getWorld()Method to get the World this colony is in.- Returns:
- the World the colony is in.
-
getRequestManager
Get the currentIRequestManagerfor this Colony. Returns null if the current Colony does not support the request system.- Returns:
- the
IRequestManagerfor this colony, null if not supported.
-
markDirty
void markDirty()Called to mark this colony dirty, and in need of syncing / saving. -
canBeAutoDeleted
boolean canBeAutoDeleted()Called to check if the colony can be deleted by an automatic cleanup.- Returns:
- true if so.
-
getRequesterBuildingForPosition
@Nullable @Nullable IRequester getRequesterBuildingForPosition(@NotNull @NotNull net.minecraft.core.BlockPos pos) Method used to get aIRequesterfrom a given Position. Is always a Building.- Parameters:
pos- The position to get the Building that acts as a requester.- Returns:
- The
IRequesterfrom the position, or null.
-
removeVisitingPlayer
void removeVisitingPlayer(net.minecraft.world.entity.player.Player player) Remove a visiting player.- Parameters:
player- the player.
-
getMessagePlayerEntities
Get the players in the colony which should receive the message.- Returns:
- list of players
-
getWayPoints
@NotNull default @NotNull List<net.minecraft.core.BlockPos> getWayPoints(@NotNull @NotNull net.minecraft.core.BlockPos position, @NotNull @NotNull net.minecraft.core.BlockPos target) -
getOverallHappiness
double getOverallHappiness() -
getWayPoints
Map<net.minecraft.core.BlockPos,net.minecraft.world.level.block.state.BlockState> getWayPoints() -
getStructurePack
String getStructurePack() -
setStructurePack
-
getServerBuildingManager
IRegisteredStructureManager getServerBuildingManager() -
getCommonBuildingManager
ICommonRegisteredStructureManager getCommonBuildingManager() -
getCitizenManager
ICitizenManager getCitizenManager() -
getGraveManager
IGraveManager getGraveManager() -
getVisitorManager
IVisitorManager getVisitorManager()Gets the visitor manager- Returns:
- manager
-
getAnimalManager
IAnimalManager getAnimalManager()Get the animal manager of the colony.- Returns:
- the animal manager.
-
getRaiderManager
IRaiderManager getRaiderManager() -
getEventManager
IEventManager getEventManager()Get the event manager of the colony.- Returns:
- the event manager.
-
getReproductionManager
IReproductionManager getReproductionManager()Get the reproduction manager of the colony.- Returns:
- the reproduction manager.
-
getEventDescriptionManager
IEventDescriptionManager getEventDescriptionManager()Get the event description manager of the colony.- Returns:
- the event description manager.
-
getPackageManager
IColonyPackageManager getPackageManager()The colony networking packaging manager.- Returns:
- The packaging manager.
-
getTravellingManager
ITravellingManager getTravellingManager()Get the travelling manager of the colony.- Returns:
- the travelling manager.
-
getConnectionManager
IColonyConnectionManager getConnectionManager()Get the connection manager of the colony.- Returns:
- the connection manager.
-
addVisitingPlayer
void addVisitingPlayer(net.minecraft.world.entity.player.Player player) Add a visiting player.- Parameters:
player- the player.
-
getDimension
net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> getDimension()Get the colony dimension.- Returns:
- the dimension id.
-
isRemote
boolean isRemote()Check if the colony is on the server or client.- Returns:
- true if so.
-
getResearchManager
IResearchManager getResearchManager()Get the research manager.- Returns:
- the research manager object.
-
usedMercenaries
void usedMercenaries()Save the time when mercenaries are used, to set a cooldown. -
getMercenaryUseTime
long getMercenaryUseTime()Get the last time mercenaries were used.- Returns:
- the mercenary use time.
-
getColonyTag
net.minecraft.nbt.CompoundTag getColonyTag() -
isColonyUnderAttack
boolean isColonyUnderAttack() -
isValidAttackingPlayer
boolean isValidAttackingPlayer(net.minecraft.world.entity.player.Player entity) -
isValidAttackingGuard
-
setColonyColor
void setColonyColor(net.minecraft.ChatFormatting color) -
setColonyFlag
void setColonyFlag(net.minecraft.nbt.ListTag patterns) -
addWayPoint
void addWayPoint(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState newWayPointState) -
addGuardToAttackers
void addGuardToAttackers(AbstractEntityCitizen entityCitizen, net.minecraft.world.entity.player.Player followPlayer) -
addFreePosition
void addFreePosition(net.minecraft.core.BlockPos pos) -
addFreeBlock
void addFreeBlock(net.minecraft.world.level.block.Block block) -
removeFreePosition
void removeFreePosition(net.minecraft.core.BlockPos pos) -
removeFreeBlock
void removeFreeBlock(net.minecraft.world.level.block.Block block) -
setCanBeAutoDeleted
void setCanBeAutoDeleted(boolean canBeDeleted) -
write
net.minecraft.nbt.CompoundTag write(net.minecraft.nbt.CompoundTag colonyCompound) -
read
void read(net.minecraft.nbt.CompoundTag compound) -
getImportantMessageEntityPlayers
Returns a set of players receiving important messages for the colony.- Returns:
- set of players.
-
useAdditionalChildTime
boolean useAdditionalChildTime(int amount) Tries to use a given amount of additional growth-time for childs.- Parameters:
amount- amount to use- Returns:
- true if used up.
-
updateHasChilds
void updateHasChilds()Sets whether the colony has a child. -
addLoadedChunk
void addLoadedChunk(long chunkPos, net.minecraft.world.level.chunk.LevelChunk chunk) Adds a loaded chunk to the colony list- Parameters:
chunkPos- chunk to add
-
removeLoadedChunk
void removeLoadedChunk(long chunkPos) Adds a chunk from the colony list- Parameters:
chunkPos- chunk to remove
-
getLoadedChunkCount
int getLoadedChunkCount()Returns the amount of loaded chunks- Returns:
- amount of chunks
-
getLoadedChunks
-
getState
ColonyState getState()Returns the colonies current state.- Returns:
- the state.
-
isActive
boolean isActive()Is the colony active currently.- Returns:
- true if so.
-
getTicketedChunks
Get the set of chunk positions which the colony is loading through tickets- Returns:
- set of positions
-
setTextureStyle
Set the texture style of the colony.- Parameters:
style- the style to set.
-
getTextureStyleId
String getTextureStyleId()Get the colony style.- Returns:
- the string id of the style.
-
getNameStyle
String getNameStyle()Get the colony name style.- Returns:
- the string id of the style.
-
setNameStyle
Set the colony name style.- Parameters:
style- the string id of the style.
-
getCitizenNameFile
CitizenNameFile getCitizenNameFile()Get the matching citizen name file of the colony .- Returns:
- the matching file.
-
getStatisticsManager
IStatisticsManager getStatisticsManager()Get the statistics manager of the colony.- Returns:
- the statistics manager.
-
getDay
int getDay()Get the current day of the colony.- Returns:
- the current day progress of the colony.
-
getQuestManager
IQuestManager getQuestManager()Get the quest manager of the colony.- Returns:
- the quest manager.
-
getCitizen
Get citizen from colony.- Parameters:
id- the id of the cit.- Returns:
- the cit.
-
getSettings
ICommonSettingsModule getSettings()Get the colony level settings module.- Returns:
- the settings module.
-