Class AbstractBuildingView
java.lang.Object
com.minecolonies.core.colony.buildings.views.AbstractBuildingView
- All Implemented Interfaces:
ICommonBuilding,IBuildingView,IModuleContainerView,IRequester
- Direct Known Subclasses:
AbstractBuildingBuilderView,AbstractBuildingGuards.View,BuildingBarracks.View,BuildingBeekeeper.View,BuildingCook.View,BuildingLumberjack.View,BuildingMysticalSite.View,BuildingTownHall.View,BuildingWareHouse.View,EmptyView,LivingBuildingView,PostBox.View
The AbstractBuilding View is the client-side representation of a AbstractBuilding. Views contain the AbstractBuilding's data that is relevant to a Client, in a more
client-friendly form. Mutable operations on a View result in a message to the server to perform the operation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap<IBuildingModuleView>Set of building modules this building has. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractBuildingView(IColonyView c, @NotNull net.minecraft.core.BlockPos l) Creates a building view. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if the building currently allows assignment of citizens.voiddeserialize(@NotNull net.minecraft.network.FriendlyByteBuf buf) Read this view from aFriendlyByteBuf.Get the citizen ids of all assigned citizens to this building.Get all module views in a list.intGet the delivery priority of the building.intGet the current level of the building.intGet the max level of the building.final BuildingEntryGet the Building typeintGet the claim radius for the building.Gets the ColonyView that this building belongs to.List<net.minecraft.core.BlockPos>Returns the Container ListintGet the current work order level.Getter for the custom building name.IToken<?>getId()Method to get the ID of a given requester.@NotNull net.minecraft.core.BlockPosgetID()Gets the id for this building.@NotNull ILocationMethod to get the location of this locatable.getModuleView(int id) Get the first module with a particular class or interface.<M extends IBuildingModule,V extends IBuildingModuleView>
VgetModuleView(BuildingEntry.ModuleProducer<M, V> producer) Get the first module with a particular class or interface.<T extends IBuildingModuleView>
TgetModuleViewByType(Class<T> clazz) Get the first module view matching the class.<T extends IBuildingModuleView>
TgetModuleViewMatching(Class<T> clazz, Predicate<? super T> modulePredicate) Get the module view matching a certain predicate.<T extends IBuildingModuleView>
@NotNull List<T>getModuleViews(Class<T> clazz) Get a list of all modules matching a specific class.com.google.common.collect.ImmutableList<IRequest<?>>getOpenRequests(@NotNull ICitizenDataView data) Map<Integer,Collection<IToken<?>>> com.google.common.collect.ImmutableList<IRequest<?>><R> com.google.common.collect.ImmutableList<IRequest<? extends R>>getOpenRequestsOfType(@NotNull ICitizenDataView citizenData, Class<R> requestType) <R> com.google.common.collect.ImmutableList<IRequest<? extends R>>getOpenRequestsOfTypeFiltered(@NotNull ICitizenDataView citizenData, Class<R> requestType, Predicate<IRequest<? extends R>> filter) @NotNull net.minecraft.core.BlockPosGet the parent building@NotNull net.minecraft.core.BlockPosGets the location of this building.intGet the prestige value of the building.@NotNull net.minecraft.network.chat.MutableComponentgetRequesterDisplayName(@NotNull IRequestManager manager, @NotNull IRequest<?> request) Gets the name of the requester that requested the request given by the token.com.google.common.collect.ImmutableCollection<IToken<?>>intGetter for the rotation.Getter for the style.Getter for the schematic name.@NotNull com.ldtteam.blockui.views.BOWindowWill return the window if this building has an associated blockui window.booleanhasModuleView(BuildingEntry.ModuleProducer producer) Check if the object has a particular module.booleanGet the current work order level.booleanCheck if the building is current being built.booleanChecks if this building is at its max level.booleanCheck if the building was deconstructed.booleanCheck if the building is currently being deconstructed..booleanGetter for the mirror.booleanCheck if the building is currently being repaired.voidonRequestedRequestCancelled(@NotNull IRequestManager manager, @NotNull IRequest<?> request) Method called by the request system to notify this requester that a request has been overruled.voidonRequestedRequestComplete(@NotNull IRequestManager manager, @NotNull IRequest<?> request) Method called by the request system to notify this requester that a request is complete.voidopenGui(boolean shouldOpenInv) Open the associated blockui window for this building.voidregisterModule(IBuildingModuleView iModuleView) Register a view module with the building.voidsetBuildingType(BuildingEntry buildingType) Set the building typevoidsetCustomName(String name) Setter for the custom name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.buildings.views.IBuildingView
getBuildingDisplayName, getHoverWarningForLevel, getRangeMethods inherited from interface com.minecolonies.api.colony.buildings.ICommonBuilding
getBuildingLevelEquivalent
-
Field Details
-
moduleViews
Set of building modules this building has.
-
-
Constructor Details
-
AbstractBuildingView
Creates a building view.- Parameters:
c- ColonyView the building is in.l- The location of the building.
-
-
Method Details
-
getID
@NotNull public @NotNull net.minecraft.core.BlockPos getID()Gets the id for this building.- Specified by:
getIDin interfaceIBuildingView- Returns:
- A BlockPos because the building ID is its location.
-
getPosition
@NotNull public @NotNull net.minecraft.core.BlockPos getPosition()Gets the location of this building.- Specified by:
getPositionin interfaceICommonBuilding- Returns:
- A BlockPos, where this building is.
-
getParent
@NotNull public @NotNull net.minecraft.core.BlockPos getParent()Description copied from interface:IBuildingViewGet the parent building- Specified by:
getParentin interfaceIBuildingView- Returns:
-
getBuildingLevel
public int getBuildingLevel()Get the current level of the building.- Specified by:
getBuildingLevelin interfaceICommonBuilding- Returns:
- AbstractBuilding current level.
-
getBuildingMaxLevel
public int getBuildingMaxLevel()Get the max level of the building.- Specified by:
getBuildingMaxLevelin interfaceIBuildingView- Returns:
- AbstractBuilding max level.
-
isBuildingMaxLevel
public boolean isBuildingMaxLevel()Checks if this building is at its max level.- Specified by:
isBuildingMaxLevelin interfaceIBuildingView- Returns:
- true if the building is at its max level.
-
getCurrentWorkOrderLevel
public int getCurrentWorkOrderLevel()Get the current work order level.- Specified by:
getCurrentWorkOrderLevelin interfaceIBuildingView- Returns:
- 0 if none, othewise the current level worked on
-
getStructurePath
Getter for the schematic name.- Specified by:
getStructurePathin interfaceIBuildingView- Returns:
- the schematic name.
-
getCustomName
Getter for the custom building name.- Specified by:
getCustomNamein interfaceIBuildingView- Returns:
- the name.
-
getStructurePack
Getter for the style.- Specified by:
getStructurePackin interfaceIBuildingView- Returns:
- the style string.
-
getRotation
public int getRotation()Getter for the rotation.- Specified by:
getRotationin interfaceIBuildingView- Returns:
- the rotation.
-
isMirrored
public boolean isMirrored()Getter for the mirror.- Specified by:
isMirroredin interfaceIBuildingView- Returns:
- true if mirrored.
-
hasWorkOrder
public boolean hasWorkOrder()Get the current work order level.- Specified by:
hasWorkOrderin interfaceIBuildingView- Returns:
- 0 if none, othewise the current level worked on
-
isBuilding
public boolean isBuilding()Description copied from interface:IBuildingViewCheck if the building is current being built.- Specified by:
isBuildingin interfaceIBuildingView- Returns:
- true if so.
-
isRepairing
public boolean isRepairing()Description copied from interface:IBuildingViewCheck if the building is currently being repaired.- Specified by:
isRepairingin interfaceIBuildingView- Returns:
- true if so.
-
isDeconstructing
public boolean isDeconstructing()Description copied from interface:IBuildingViewCheck if the building is currently being deconstructed..- Specified by:
isDeconstructingin interfaceIBuildingView- Returns:
- true if so.
-
getClaimRadius
public int getClaimRadius()Get the claim radius for the building.- Specified by:
getClaimRadiusin interfaceIBuildingView- Returns:
- the radius.
-
getContainers
Returns the Container List- Specified by:
getContainersin interfaceICommonBuilding- Returns:
- containerList.
-
openGui
public void openGui(boolean shouldOpenInv) Open the associated blockui window for this building. If the player is sneaking open the inventory else open the GUI directly.- Specified by:
openGuiin interfaceIBuildingView- Parameters:
shouldOpenInv- if the player is sneaking.
-
getWindow
@NotNull public @NotNull com.ldtteam.blockui.views.BOWindow getWindow()Will return the window if this building has an associated blockui window.- Specified by:
getWindowin interfaceIBuildingView- Returns:
- blockui window.
-
deserialize
public void deserialize(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) Read this view from aFriendlyByteBuf.- Specified by:
deserializein interfaceIBuildingView- Parameters:
buf- The buffer to read this view from.
-
getPrestige
public int getPrestige()Description copied from interface:ICommonBuildingGet the prestige value of the building.- Specified by:
getPrestigein interfaceICommonBuilding- Returns:
- the prestige value.
-
getOpenRequestsByCitizen
- Specified by:
getOpenRequestsByCitizenin interfaceIBuildingView
-
getCitizensByRequest
-
getOpenRequestsOfType
public <R> com.google.common.collect.ImmutableList<IRequest<? extends R>> getOpenRequestsOfType(@NotNull @NotNull ICitizenDataView citizenData, Class<R> requestType) - Specified by:
getOpenRequestsOfTypein interfaceIBuildingView
-
getOpenRequests
public com.google.common.collect.ImmutableList<IRequest<?>> getOpenRequests(@NotNull @NotNull ICitizenDataView data) - Specified by:
getOpenRequestsin interfaceIBuildingView
-
getOpenRequestsOfBuilding
- Specified by:
getOpenRequestsOfBuildingin interfaceIBuildingView
-
getColony
Gets the ColonyView that this building belongs to.- Specified by:
getColonyin interfaceIBuildingView- Specified by:
getColonyin interfaceICommonBuilding- Returns:
- ColonyView, client side interpretations of Colony.
-
getOpenRequestsOfTypeFiltered
public <R> com.google.common.collect.ImmutableList<IRequest<? extends R>> getOpenRequestsOfTypeFiltered(@NotNull @NotNull ICitizenDataView citizenData, Class<R> requestType, Predicate<IRequest<? extends R>> filter) - Specified by:
getOpenRequestsOfTypeFilteredin interfaceIBuildingView
-
getId
Description copied from interface:IRequesterMethod to get the ID of a given requester.- Specified by:
getIdin interfaceIRequester- Returns:
- The id of this requester.
-
onRequestedRequestComplete
public void onRequestedRequestComplete(@NotNull @NotNull IRequestManager manager, @NotNull @NotNull IRequest<?> request) Description copied from interface:IRequesterMethod called by the request system to notify this requester that a request is complete.- Specified by:
onRequestedRequestCompletein interfaceIRequester- Parameters:
manager- the request manager.request- the request.
-
onRequestedRequestCancelled
public void onRequestedRequestCancelled(@NotNull @NotNull IRequestManager manager, @NotNull @NotNull IRequest<?> request) Description copied from interface:IRequesterMethod called by the request system to notify this requester that a request has been overruled.- Specified by:
onRequestedRequestCancelledin interfaceIRequester- Parameters:
manager- the request manager.request- the request.
-
getRequesterDisplayName
@NotNull public @NotNull net.minecraft.network.chat.MutableComponent getRequesterDisplayName(@NotNull @NotNull IRequestManager manager, @NotNull @NotNull IRequest<?> request) Description copied from interface:IRequesterGets the name of the requester that requested the request given by the token.- Specified by:
getRequesterDisplayNamein interfaceIRequester- Parameters:
manager- the request manager.request- the request for which the name of the requester is retrieved- Returns:
- The display name of the requester.
-
getLocation
Description copied from interface:IRequesterMethod to get the location of this locatable.- Specified by:
getLocationin interfaceIRequester- Returns:
- the location.
-
getBuildingDmPrio
public int getBuildingDmPrio()Description copied from interface:IBuildingViewGet the delivery priority of the building.- Specified by:
getBuildingDmPrioin interfaceIBuildingView- Returns:
- int, delivery priority.
-
getResolverIds
- Specified by:
getResolverIdsin interfaceIBuildingView
-
setCustomName
Description copied from interface:IBuildingViewSetter for the custom name. Sets the name on the client side and sends it to the server.- Specified by:
setCustomNamein interfaceIBuildingView- Parameters:
name- the new name.
-
isDeconstructed
public boolean isDeconstructed()Description copied from interface:IBuildingViewCheck if the building was deconstructed.- Specified by:
isDeconstructedin interfaceIBuildingView- Returns:
- true if so.
-
getModuleView
Description copied from interface:IModuleContainerViewGet the first module with a particular class or interface.- Specified by:
getModuleViewin interfaceIModuleContainerView- Returns:
- the module or empty if not existent.
-
getModuleView
public <M extends IBuildingModule,V extends IBuildingModuleView> V getModuleView(BuildingEntry.ModuleProducer<M, V> producer) Description copied from interface:IModuleContainerViewGet the first module with a particular class or interface.- Specified by:
getModuleViewin interfaceIModuleContainerView- Returns:
- the module or empty if not existent.
-
hasModuleView
Description copied from interface:IModuleContainerViewCheck if the object has a particular module.- Specified by:
hasModuleViewin interfaceIModuleContainerView- Parameters:
producer- the module producer for the module- Returns:
- true if so.
-
getModuleViewByType
Description copied from interface:IModuleContainerViewGet the first module view matching the class.- Specified by:
getModuleViewByTypein interfaceIModuleContainerView- Type Parameters:
T- the type of module returned.- Parameters:
clazz- the class to match.- Returns:
- the module.
-
getModuleViewMatching
public <T extends IBuildingModuleView> T getModuleViewMatching(Class<T> clazz, Predicate<? super T> modulePredicate) Description copied from interface:IModuleContainerViewGet the module view matching a certain predicate.- Specified by:
getModuleViewMatchingin interfaceIModuleContainerView- Type Parameters:
T- the optional type.- Parameters:
clazz- the class of the module.modulePredicate- the predicate to match.- Returns:
- the module.
-
getModuleViews
Description copied from interface:IModuleContainerViewGet a list of all modules matching a specific class.- Specified by:
getModuleViewsin interfaceIModuleContainerView- Type Parameters:
T- the type of module.- Parameters:
clazz- the class to match.- Returns:
- the list or empty if doesn't exist.
-
registerModule
Description copied from interface:IModuleContainerViewRegister a view module with the building.- Specified by:
registerModulein interfaceIModuleContainerView- Parameters:
iModuleView- the view.
-
getAllModuleViews
Description copied from interface:IModuleContainerViewGet all module views in a list.- Specified by:
getAllModuleViewsin interfaceIModuleContainerView- Returns:
- the list of views.
-
getBuildingType
Description copied from interface:ICommonBuildingGet the Building type- Specified by:
getBuildingTypein interfaceICommonBuilding- Returns:
- building type
-
setBuildingType
Description copied from interface:IBuildingViewSet the building type- Specified by:
setBuildingTypein interfaceIBuildingView
-
getAllAssignedCitizens
Description copied from interface:IBuildingViewGet the citizen ids of all assigned citizens to this building.- Specified by:
getAllAssignedCitizensin interfaceIBuildingView- Returns:
- the set of ids.
-
allowsAssignment
public boolean allowsAssignment()Description copied from interface:IBuildingViewCheck if the building currently allows assignment of citizens.- Specified by:
allowsAssignmentin interfaceIBuildingView- Returns:
- true if so.
-