Interface ICommonRegisteredStructureManager<B extends ICommonBuilding,T>
- All Known Subinterfaces:
IRegisteredStructureManager,IRegisteredStructureManagerView
- All Known Implementing Classes:
RegisteredStructureManager,RegisteredStructureManagerView
public interface ICommonRegisteredStructureManager<B extends ICommonBuilding,T>
Interface for the managers for registered structures.
Buildings + Extensions, Decorations, etc.
-
Method Summary
Modifier and TypeMethodDescriptiondefault net.minecraft.core.BlockPosgetBestBuilding(AbstractEntityCitizen citizen, Class<? extends B> building) Searches for the closest building to a given citizen.default <BB extends B>
net.minecraft.core.BlockPosgetBestBuilding(AbstractEntityCitizen citizen, Class<BB> building, @NotNull Predicate<BB> filter) Searches for the closest building to a given citizen, with an additional filter predicate.default net.minecraft.core.BlockPosgetBestBuilding(net.minecraft.core.BlockPos pos, Class<? extends B> building) Searches for the closest building to a given position.default <BB extends B>
net.minecraft.core.BlockPosgetBestBuilding(net.minecraft.core.BlockPos pos, Class<BB> building, @NotNull Predicate<BB> filter) Searches for the closest building to a given position, with an additional filter predicate.default BgetBuilding(net.minecraft.core.BlockPos pos) Get a certain building.default <BB extends B>
BBgetBuilding(net.minecraft.core.BlockPos buildingId, @NotNull Class<BB> type) Get building in Colony by ID.@NotNull List<IBuildingExtension> getBuildingExtensions(Predicate<IBuildingExtension> matcher) Get all the building extensions.Returns a map with all buildings within the colony.Get the colony from the manager.default BgetFirstBuildingMatching(Predicate<B> predicate) Get the first building matching the conditions.default net.minecraft.core.BlockPosgetRandomBuilding(Predicate<B> filterPredicate) Returns a random building in the colony, matching the filter predicate.Get the townhall from the colony.default booleanhasBuilding(net.minecraft.resources.ResourceLocation id, int level, boolean singleBuilding) Check if a building matching a given resource location.booleanCheck if the colony has a placed townhall.booleanCheck if the colony has a placed warehouse.
-
Method Details
-
getTownHall
T getTownHall()Get the townhall from the colony.- Returns:
- the townhall building.
-
hasWarehouse
boolean hasWarehouse()Check if the colony has a placed warehouse.- Returns:
- true if so.
-
getBuilding
Get a certain building.- Parameters:
pos- the id of the building.- Returns:
- the building.
-
getBuildings
Returns a map with all buildings within the colony. Key is ID (Coordinates), value is building object.- Returns:
- Map with ID (coordinates) as key, and buildings as value.
-
hasTownHall
boolean hasTownHall()Check if the colony has a placed townhall.- Returns:
- true if so.
-
getBuilding
@Nullable default <BB extends B> BB getBuilding(net.minecraft.core.BlockPos buildingId, @NotNull @NotNull Class<BB> type) Get building in Colony by ID. The building will be casted to the provided type.- Parameters:
buildingId- ID (coordinates) of the building to get.type- Type of building.- Returns:
- the building with the specified id.
-
getBestBuilding
default net.minecraft.core.BlockPos getBestBuilding(AbstractEntityCitizen citizen, Class<? extends B> building) Searches for the closest building to a given citizen.- Parameters:
citizen- the citizen.building- the type of building.- Returns:
- the Position of it.
-
getBestBuilding
default <BB extends B> net.minecraft.core.BlockPos getBestBuilding(AbstractEntityCitizen citizen, Class<BB> building, @NotNull @NotNull Predicate<BB> filter) Searches for the closest building to a given citizen, with an additional filter predicate.- Parameters:
citizen- the citizen.building- the type of building.filter- the filter to match a building against to further specialize the needs.- Returns:
- the Position of it.
-
getBestBuilding
default net.minecraft.core.BlockPos getBestBuilding(net.minecraft.core.BlockPos pos, Class<? extends B> building) Searches for the closest building to a given position.- Parameters:
pos- the pos.building- the building class type.- Returns:
- the Position of it.
-
getBestBuilding
default <BB extends B> net.minecraft.core.BlockPos getBestBuilding(net.minecraft.core.BlockPos pos, Class<BB> building, @NotNull @NotNull Predicate<BB> filter) Searches for the closest building to a given position, with an additional filter predicate.- Parameters:
pos- the pos.building- the building class type.filter- the filter to match a building against to further specialize the needs.- Returns:
- the Position of it.
-
getRandomBuilding
Returns a random building in the colony, matching the filter predicate.- Parameters:
filterPredicate- the filter to apply.- Returns:
- the random building. Returns null if no building matching the predicate was found.
-
getFirstBuildingMatching
Get the first building matching the conditions.- Parameters:
predicate- the predicate matching the building.- Returns:
- the building or null.
-
hasBuilding
default boolean hasBuilding(net.minecraft.resources.ResourceLocation id, int level, boolean singleBuilding) Check if a building matching a given resource location.- Parameters:
id- the resource location to match.level- the level to match.singleBuilding- if one or more buildings can match it.- Returns:
- true if so.
-
getBuildingExtensions
@NotNull @NotNull List<IBuildingExtension> getBuildingExtensions(Predicate<IBuildingExtension> matcher) Get all the building extensions.- Parameters:
matcher- the building extension matcher predicate.- Returns:
- an unmodifiable collection of all building extensions.
-
getColony
IColony getColony()Get the colony from the manager.- Returns:
- the IColony colony.
-