Package com.minecolonies.api.colony
Interface IColonyView
- All Superinterfaces:
IColony
- All Known Implementing Classes:
ColonyView
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddFreeBlock(@NotNull net.minecraft.world.level.block.Block block) Add a new free to interact block.voidaddFreePosition(@NotNull net.minecraft.core.BlockPos pos) Add a new free to interact position.voidUpdate a players permissions.voidaddVisitingPlayer(net.minecraft.world.entity.player.Player player) Add a visiting player.booleanbooleanCalled to check if the colony can be deleted by an automatic cleanup.getAnimal(int animalId) Gets the data view for an animalnet.minecraft.core.BlockPosReturns the position of the colony.getCitizen(int id) Gets the CitizenDataView for a citizen id.intReturns the maximum amount of total citizen beds in the colony.intReturns the maximum amount of citizen slots in the colony considering beds and guard towersGetter for the citizens map.Client side building manager.net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> Returns the dimension ID of the view.longgetDistanceSquared(@NotNull net.minecraft.core.BlockPos pos) Returns the squared (x, z) distance to the center.List<net.minecraft.world.level.block.Block> Get a copy of the freeBlocks list.List<net.minecraft.core.BlockPos> Get a copy of the freePositions list.intgetID()Returns the ID of the view.intGet the last contact of a player to the colony in hours.List<net.minecraft.core.BlockPos> Get a list of all barb spawn positions in the colony view.getName()Returns the name of the colony.Get a list of all available citizen name style options.doubleGetter for the overall happiness.@NotNull IPermissionsReturns the permissions of the colony.@NotNull Map<UUID, ColonyPlayer> Returns a map of players in 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 style of the colony.getVisitor(int citizenId) Gets the data view for a visitorgetWorkOrder(int id) Getter for a single workorder.Getter for the workOrders.net.minecraft.world.level.LevelgetWorld()Method to get the World this colony is in.voidhandleColonyViewAnimalMessage(net.minecraft.network.RegistryFriendlyByteBuf animalViewData, boolean refresh) Handles animal view messagesvoidhandleColonyViewCitizensMessage(int id, net.minecraft.network.RegistryFriendlyByteBuf buf) Update a ColonyView's citizens given a network data ColonyView update packet.voidhandleColonyViewMessage(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf, boolean isNewSubscription) Populate a ColonyView from the network data.voidhandleColonyViewRemoveCitizenMessage(int citizen) Remove a citizen from the ColonyView.voidhandleColonyViewRemoveWorkOrderMessage(int workOrderId) Remove a workOrder from the ColonyView.voidhandleColonyViewResearchManagerUpdate(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compoundTag) Handle the colony view research manager updating.voidhandleColonyViewVisitorMessage(net.minecraft.network.RegistryFriendlyByteBuf visitorViewData, boolean refresh) Handles visitor view messagesvoidhandleColonyViewWorkOrderMessage(net.minecraft.network.RegistryFriendlyByteBuf buf) Update a ColonyView's workOrders given a network data ColonyView update packet.voidhandlePermissionsViewMessage(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Update permissions.booleanisCoordInColony(@NotNull net.minecraft.world.level.Level w, @NotNull net.minecraft.core.BlockPos pos) Determine if a given chunk coordinate is considered to be within the colony's bounds.booleanIf currently being raided.booleanisRemote()Check if the colony is on the server or client.voidCalled to mark this colony dirty, and in need of syncing / saving.voidremoveFreeBlock(@NotNull net.minecraft.world.level.block.Block block) Remove a free to interact block.voidremoveFreePosition(@NotNull net.minecraft.core.BlockPos pos) Remove a free to interact position.voidremovePlayer(UUID player) Remove player from colony permissions.voidremoveVisitingPlayer(net.minecraft.world.entity.player.Player player) Remove a visiting player.voidSets the name of the view.Methods inherited from interface com.minecolonies.api.colony.IColony
addGuardToAttackers, addLoadedChunk, addWayPoint, getAnimalManager, getCitizenManager, getCitizenNameFile, getColonyFlag, getColonyTag, getCommonBuildingManager, getConnectionManager, getDay, getEventDescriptionManager, getEventManager, getGraveManager, getImportantMessageEntityPlayers, getLoadedChunkCount, getLoadedChunks, getMercenaryUseTime, getMessagePlayerEntities, getNameStyle, getPackageManager, getQuestManager, getRaiderManager, getReproductionManager, getResearchManager, getServerBuildingManager, getSettings, getState, getStatisticsManager, getTeamColonyColor, getTextureStyleId, getTicketedChunks, getTravellingManager, getVisitorManager, getWayPoints, getWayPoints, getWorkManager, isActive, isColonyUnderAttack, isDay, isValidAttackingGuard, isValidAttackingPlayer, onServerTick, onWorldLoad, onWorldTick, onWorldUnload, read, removeLoadedChunk, setCanBeAutoDeleted, setColonyColor, setColonyFlag, setNameStyle, setStructurePack, setTextureStyle, updateHasChilds, useAdditionalChildTime, usedMercenaries, write, writeToItemStack
-
Method Details
-
getFreePositions
List<net.minecraft.core.BlockPos> getFreePositions()Get a copy of the freePositions list.- Returns:
- the list of free to interact positions.
-
getFreeBlocks
List<net.minecraft.world.level.block.Block> getFreeBlocks()Get a copy of the freeBlocks list.- Returns:
- the list of free to interact blocks.
-
addFreePosition
void addFreePosition(@NotNull @NotNull net.minecraft.core.BlockPos pos) Add a new free to interact position.- Specified by:
addFreePositionin interfaceIColony- Parameters:
pos- position to add.
-
addFreeBlock
void addFreeBlock(@NotNull @NotNull net.minecraft.world.level.block.Block block) Add a new free to interact block.- Specified by:
addFreeBlockin interfaceIColony- Parameters:
block- block to add.
-
removeFreePosition
void removeFreePosition(@NotNull @NotNull net.minecraft.core.BlockPos pos) Remove a free to interact position.- Specified by:
removeFreePositionin interfaceIColony- Parameters:
pos- position to remove.
-
removeFreeBlock
void removeFreeBlock(@NotNull @NotNull net.minecraft.world.level.block.Block block) Remove a free to interact block.- Specified by:
removeFreeBlockin interfaceIColony- Parameters:
block- state to remove.
-
getDimension
net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> getDimension()Returns the dimension ID of the view.- Specified by:
getDimensionin interfaceIColony- Returns:
- dimension ID of the view.
-
getPlayers
Returns a map of players in the colony. Key is the UUID, value isPlayer- Returns:
- Map of UUID's and
Player
-
getCitizenCount
int getCitizenCount()Returns the maximum amount of total citizen beds in the colony.- Returns:
- maximum amount of citizens.
-
getCitizenCountLimit
int getCitizenCountLimit()Returns the maximum amount of citizen slots in the colony considering beds and guard towers- Returns:
- maximum amount of citizens.
-
getCitizens
Map<Integer,ICitizenDataView> getCitizens()Getter for the citizens map.- Returns:
- a unmodifiable Map of the citizen.
-
getWorkOrders
Collection<IWorkOrderView> getWorkOrders()Getter for the workOrders.- Returns:
- a unmodifiable Collection of the workOrders.
-
getWorkOrder
Getter for a single workorder.- Parameters:
id- workorder id.- Returns:
- a specific workorder.
-
getCitizen
Gets the CitizenDataView for a citizen id.- Specified by:
getCitizenin interfaceIColony- Parameters:
id- the citizen id.- Returns:
- CitizenDataView for the citizen.
-
handleColonyViewMessage
void handleColonyViewMessage(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf, boolean isNewSubscription) Populate a ColonyView from the network data.- Parameters:
buf-RegistryFriendlyByteBufto read from.isNewSubscription- Whether this is a new subscription of not.
-
handlePermissionsViewMessage
void handlePermissionsViewMessage(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Update permissions.- Parameters:
buf- buffer containing permissions.
-
handleColonyViewWorkOrderMessage
void handleColonyViewWorkOrderMessage(net.minecraft.network.RegistryFriendlyByteBuf buf) Update a ColonyView's workOrders given a network data ColonyView update packet. This uses a full-replacement - workOrders do not get updated and are instead overwritten.- Parameters:
buf- Network data.
-
handleColonyViewCitizensMessage
void handleColonyViewCitizensMessage(int id, net.minecraft.network.RegistryFriendlyByteBuf buf) Update a ColonyView's citizens given a network data ColonyView update packet. This uses a full-replacement - citizens do not get updated and are instead overwritten.- Parameters:
id- ID of the citizen.buf- Network data.
-
handleColonyViewVisitorMessage
void handleColonyViewVisitorMessage(net.minecraft.network.RegistryFriendlyByteBuf visitorViewData, boolean refresh) Handles visitor view messages- Parameters:
visitorViewData- the new data to setrefresh- if all need to be refreshed.
-
handleColonyViewAnimalMessage
void handleColonyViewAnimalMessage(net.minecraft.network.RegistryFriendlyByteBuf animalViewData, boolean refresh) Handles animal view messages- Parameters:
animalViewData- the new data to setrefresh- if all need to be refreshed.
-
handleColonyViewRemoveCitizenMessage
void handleColonyViewRemoveCitizenMessage(int citizen) Remove a citizen from the ColonyView.- Parameters:
citizen- citizen ID.
-
handleColonyViewRemoveWorkOrderMessage
void handleColonyViewRemoveWorkOrderMessage(int workOrderId) Remove a workOrder from the ColonyView.- Parameters:
workOrderId- id of the workOrder.
-
handleColonyViewResearchManagerUpdate
void handleColonyViewResearchManagerUpdate(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compoundTag) Handle the colony view research manager updating.- Parameters:
compoundTag- the tag to update the research manager with.
-
addPlayer
Update a players permissions.- Parameters:
player- player username.
-
removePlayer
Remove player from colony permissions.- Parameters:
player- the UUID of the player to remove.
-
getOverallHappiness
double getOverallHappiness()Getter for the overall happiness.- Specified by:
getOverallHappinessin interfaceIColony- Returns:
- the happiness, a double.
-
getCenter
net.minecraft.core.BlockPos getCenter()Description copied from interface:IColonyReturns the position of the colony. -
getName
String getName()Description copied from interface:IColonyReturns the name of the colony. -
setName
Sets the name of the view. -
getPermissions
Description copied from interface:IColonyReturns the permissions of the colony.- Specified by:
getPermissionsin interfaceIColony- Returns:
IPermissionsof the colony.
-
isCoordInColony
boolean isCoordInColony(@NotNull @NotNull net.minecraft.world.level.Level w, @NotNull @NotNull net.minecraft.core.BlockPos pos) Description copied from interface:IColonyDetermine if a given chunk coordinate is considered to be within the colony's bounds.- Specified by:
isCoordInColonyin interfaceIColony- Parameters:
w- World to check.pos- Block Position.- Returns:
- True if inside colony, otherwise false.
-
getDistanceSquared
long getDistanceSquared(@NotNull @NotNull net.minecraft.core.BlockPos pos) Description copied from interface:IColonyReturns the squared (x, z) distance to the center.- Specified by:
getDistanceSquaredin interfaceIColony- Parameters:
pos- Block Position.- Returns:
- Squared distance to the center in (x, z) direction.
-
getID
int getID()Returns the ID of the view. -
getLastContactInHours
int getLastContactInHours()Description copied from interface:IColonyGet the last contact of a player to the colony in hours.- Specified by:
getLastContactInHoursin interfaceIColony- Returns:
- an integer with a describing value.
-
getWorld
net.minecraft.world.level.Level getWorld()Description copied from interface:IColonyMethod to get the World this colony is in. -
getRequestManager
Description copied from interface:IColonyGet the currentIRequestManagerfor this Colony. Returns null if the current Colony does not support the request system.- Specified by:
getRequestManagerin interfaceIColony- Returns:
- the
IRequestManagerfor this colony, null if not supported.
-
markDirty
void markDirty()Description copied from interface:IColonyCalled to mark this colony dirty, and in need of syncing / saving. -
canBeAutoDeleted
boolean canBeAutoDeleted()Description copied from interface:IColonyCalled to check if the colony can be deleted by an automatic cleanup.- Specified by:
canBeAutoDeletedin interfaceIColony- Returns:
- true if so.
-
getRequesterBuildingForPosition
@Nullable @Nullable IRequester getRequesterBuildingForPosition(@NotNull @NotNull net.minecraft.core.BlockPos pos) Description copied from interface:IColonyMethod used to get aIRequesterfrom a given Position. Is always a Building.- Specified by:
getRequesterBuildingForPositionin interfaceIColony- 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) Description copied from interface:IColonyRemove a visiting player.- Specified by:
removeVisitingPlayerin interfaceIColony- Parameters:
player- the player.
-
addVisitingPlayer
void addVisitingPlayer(net.minecraft.world.entity.player.Player player) Description copied from interface:IColonyAdd a visiting player.- Specified by:
addVisitingPlayerin interfaceIColony- Parameters:
player- the player.
-
getLastSpawnPoints
List<net.minecraft.core.BlockPos> getLastSpawnPoints()Get a list of all barb spawn positions in the colony view.- Returns:
- a copy of the list.
-
isRemote
boolean isRemote()Description copied from interface:IColonyCheck if the colony is on the server or client. -
getStructurePack
String getStructurePack()Get the style of the colony.- Specified by:
getStructurePackin interfaceIColony- Returns:
- the current default style.
-
isRaiding
boolean isRaiding()If currently being raided.- Returns:
- true if so.
-
areSpiesEnabled
boolean areSpiesEnabled() -
getVisitor
Gets the data view for a visitor- Parameters:
citizenId- id to query- Returns:
- citizen data for visitor
-
getAnimal
Gets the data view for an animal- Parameters:
animalId- id to query- Returns:
- animal data for visitor
-
getNameFileIds
Get a list of all available citizen name style options.- Returns:
- the list of options.
-
getClientBuildingManager
IRegisteredStructureManagerView getClientBuildingManager()Client side building manager.- Returns:
- the client side building manager
-