Interface IRegisteredStructureManager
- All Superinterfaces:
ICommonRegisteredStructureManager<IBuilding,ITownHall>
- All Known Implementing Classes:
RegisteredStructureManager
public interface IRegisteredStructureManager
extends ICommonRegisteredStructureManager<IBuilding,ITownHall>
Interface for the managers for registered structures.
Buildings + Extensions, Decorations, etc.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaddBuildingExtension(IBuildingExtension extension) Add a new building extension to the building manager.voidaddBuildingExtensionIfMissing(BuildingExtensionRegistries.BuildingExtensionEntry buildingExtensionEntry, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player) Add a building extension if it's missing.voidaddLeisureSite(net.minecraft.core.BlockPos pos) Register a new leisure site.@Nullable IBuildingaddNewBuilding(@NotNull AbstractTileEntityColonyBuilding tileEntity, net.minecraft.world.level.Level world) Creates a building from a tile entity and adds it to the colony.booleancanPlaceAt(net.minecraft.world.level.block.Block block, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player) Checks whether we're allowed to place the block for a new buildingvoidcleanUpBuildings(IColony colony) Clean up the buildings.voidClear the isDirty of the buildings.voidclearPendingPrestigeCalc(IBuilding building) Indicate to building manager that prestige just has been calculated.@Nullable IWareHousegetClosestWarehouseInColony(net.minecraft.core.BlockPos pos) Get the closest warehouse relative to a position.intGet the colony prestige.Get a house with a spare bed.List<net.minecraft.core.BlockPos>Get the leisure site positions.@Nullable IBuildingExtensionGet a building extension by id.Get a specific building extension on the given location.intGet the maximum level among built mystical sitesGet a list of the mystical sites in this colony.net.minecraft.core.BlockPosGet a random leisure site to go to.Get a list of the warehouses in this colony.voidguardBuildingChangedAt(IBuilding guardBuilding, int newLevel) Event once a guard building changed at a certain level.booleanhasGuardBuildingNear(IBuilding building) Finds whether there is a guard building close to the given buildingbooleanCheck if the colony has a placed mystical site.booleankeepChunkColonyLoaded(net.minecraft.world.level.chunk.LevelChunk chunk) Is this chunk claimed by enough buildings to keep it loaded.voidMarks building extensions data dirty.voidMarks building data dirty.voidonBuildingUpgradeComplete(@Nullable IBuilding building, int level) Performed when a building of this colony finished his upgrade state.voidonColonyTick(IColony colony) Tick the buildings on colony tick.voidread(@NotNull net.minecraft.nbt.CompoundTag compound) Read the buildings from NBT.voidremoveBuilding(@NotNull IBuilding building, Set<net.minecraft.server.level.ServerPlayer> subscribers) Remove a IBuilding from the Colony (when it is destroyed).voidRemove a building extension from the building extension collection.voidremoveLeisureSite(net.minecraft.core.BlockPos pos) Remove a leisure site.voidremoveMysticalSite(IMysticalSite mysticalSite) Removes a warehouse from the BuildingManagervoidremoveWareHouse(IWareHouse wareHouse) Removes a warehouse from the BuildingManagervoidsendPackets(Set<net.minecraft.server.level.ServerPlayer> closeSubscribers, Set<net.minecraft.server.level.ServerPlayer> newSubscribers) Send packets of the buildings to the subscribers.voidsetTownHall(@Nullable ITownHall building) Set the townhall building.voidwrite(@NotNull net.minecraft.nbt.CompoundTag compound) Write the buildings to NBT.Methods inherited from interface com.minecolonies.api.colony.managers.interfaces.ICommonRegisteredStructureManager
getBestBuilding, getBestBuilding, getBestBuilding, getBestBuilding, getBuilding, getBuilding, getBuildingExtensions, getBuildings, getColony, getFirstBuildingMatching, getRandomBuilding, getTownHall, hasBuilding, hasTownHall, hasWarehouse
-
Method Details
-
read
void read(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Read the buildings from NBT.- Parameters:
compound- the compound.
-
write
void write(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Write the buildings to NBT.- Parameters:
compound- the compound.
-
clearDirty
void clearDirty()Clear the isDirty of the buildings. -
sendPackets
void sendPackets(Set<net.minecraft.server.level.ServerPlayer> closeSubscribers, Set<net.minecraft.server.level.ServerPlayer> newSubscribers) Send packets of the buildings to the subscribers.- Parameters:
closeSubscribers- the old subs.newSubscribers- new subs.
-
onColonyTick
Tick the buildings on colony tick.- Parameters:
colony- the event.
-
cleanUpBuildings
Clean up the buildings.- Parameters:
colony- at the worldTick event.
-
getLeisureSites
List<net.minecraft.core.BlockPos> getLeisureSites()Get the leisure site positions.- Returns:
- the list.
-
addLeisureSite
void addLeisureSite(net.minecraft.core.BlockPos pos) Register a new leisure site.- Parameters:
pos- the position of it.
-
removeLeisureSite
void removeLeisureSite(net.minecraft.core.BlockPos pos) Remove a leisure site.- Parameters:
pos- the position of it.
-
getClosestWarehouseInColony
Get the closest warehouse relative to a position.- Parameters:
pos- the position,.- Returns:
- the closest warehouse.
-
getMysticalSiteMaxBuildingLevel
int getMysticalSiteMaxBuildingLevel()Get the maximum level among built mystical sites- Returns:
- the max level among all mystical sites or zero if no mystical site built
-
hasMysticalSite
boolean hasMysticalSite()Check if the colony has a placed mystical site.- Returns:
- true if so.
-
removeBuilding
void removeBuilding(@NotNull @NotNull IBuilding building, Set<net.minecraft.server.level.ServerPlayer> subscribers) Remove a IBuilding from the Colony (when it is destroyed).- Parameters:
subscribers- the subscribers of the colony to message.building- IBuilding to remove.
-
markBuildingsDirty
void markBuildingsDirty()Marks building data dirty. -
markBuildingExtensionsDirty
void markBuildingExtensionsDirty()Marks building extensions data dirty. -
addNewBuilding
@Nullable @Nullable IBuilding addNewBuilding(@NotNull @NotNull AbstractTileEntityColonyBuilding tileEntity, net.minecraft.world.level.Level world) Creates a building from a tile entity and adds it to the colony.- Parameters:
tileEntity- Tile entity to build a building from.world- the world to add it to.- Returns:
- IBuilding that was created and added.
-
hasGuardBuildingNear
Finds whether there is a guard building close to the given building- Parameters:
building- the building to check for.- Returns:
- false if no guard tower close, true in other cases
-
guardBuildingChangedAt
Event once a guard building changed at a certain level.- Parameters:
guardBuilding- the guard building.newLevel- the level of it.
-
setTownHall
Set the townhall building.- Parameters:
building- the building to set.
-
removeWareHouse
Removes a warehouse from the BuildingManager- Parameters:
wareHouse- the warehouse to remove.
-
getWareHouses
List<IWareHouse> getWareHouses()Get a list of the warehouses in this colony.- Returns:
- the warehouse.
-
removeMysticalSite
Removes a warehouse from the BuildingManager- Parameters:
mysticalSite- the warehouse to remove.
-
getMysticalSites
List<IMysticalSite> getMysticalSites()Get a list of the mystical sites in this colony.- Returns:
- the list of mistical sites.
-
canPlaceAt
boolean canPlaceAt(net.minecraft.world.level.block.Block block, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player) Checks whether we're allowed to place the block for a new building- Parameters:
block- Block to checkpos- positionplayer- the player trying to place- Returns:
- true if placement allowed
-
keepChunkColonyLoaded
boolean keepChunkColonyLoaded(net.minecraft.world.level.chunk.LevelChunk chunk) Is this chunk claimed by enough buildings to keep it loaded.- Parameters:
chunk- the chunk to check- Returns:
- true if within.
-
getHouseWithSpareBed
IBuilding getHouseWithSpareBed()Get a house with a spare bed.- Returns:
- the house or null.
-
onBuildingUpgradeComplete
Performed when a building of this colony finished his upgrade state.- Parameters:
building- The upgraded building.level- The new level.
-
getRandomLeisureSite
net.minecraft.core.BlockPos getRandomLeisureSite()Get a random leisure site to go to.- Returns:
- the position of it.
-
getMatchingBuildingExtension
Get a specific building extension on the given location.- Parameters:
matcher- the building extension matcher predicate.- Returns:
- the building extension, if any.
-
addBuildingExtension
Add a new building extension to the building manager. If an identical building extension already exists, this building extension won't be added.- Parameters:
extension- the new building extension to add.- Returns:
- true if the building extension was added.
-
removeBuildingExtension
Remove a building extension from the building extension collection.- Parameters:
matcher- the building extension matcher predicate.
-
getMatchingBuildingExtension
@Nullable @Nullable IBuildingExtension getMatchingBuildingExtension(IBuildingExtension.ExtensionId extensionId) Get a building extension by id.- Parameters:
extensionId- the id of the extension.- Returns:
- the building extension or null.
-
addBuildingExtensionIfMissing
void addBuildingExtensionIfMissing(BuildingExtensionRegistries.BuildingExtensionEntry buildingExtensionEntry, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player) Add a building extension if it's missing.- Parameters:
buildingExtensionEntry- the entry to create the extension from.pos- the pos it's at.
-
clearPendingPrestigeCalc
Indicate to building manager that prestige just has been calculated.- Parameters:
building- the building it happened for.
-
getColonyPrestige
int getColonyPrestige()Get the colony prestige.- Returns:
- the prestige.
-