Class FieldsModuleView
java.lang.Object
com.minecolonies.api.colony.buildings.modules.AbstractBuildingModuleView
com.minecolonies.core.colony.buildings.moduleviews.FieldsModuleView
- All Implemented Interfaces:
IBuildingModuleView
- Direct Known Subclasses:
BuildingFarmer.FarmerFieldsModuleView,BuildingPlantation.PlantationFieldsModuleView
Client side version of the abstract class to list all fields (assigned) to a building.
-
Field Summary
Fields inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModuleView
buildingView, colonyView -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidassignField(IBuildingExtension field) Assign a given field to the current worker.booleanShould the citizen be assigned manually to the fields.final booleancanAssignField(IBuildingExtension field) Check to see if a new field can be assigned to the worker.protected abstract booleanAdditional checks to see if this field can be assigned to the building.voiddeserialize(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Deserialize the data on the client side.voidfreeField(IBuildingExtension field) Free a field from the current worker.net.minecraft.network.chat.ComponentgetDesc()Get the lang string for the title.@NotNull List<IBuildingExtension> Getter of all fields that are either free, or taken by the current building.protected abstract List<IBuildingExtension> Obtains the list of fields from the colony.@Nullable net.minecraft.network.chat.MutableComponentGet a warning text component for the specific field whenever this field cannot be assigned for any reason.net.minecraft.resources.ResourceLocationGet the resource location of the icon for the module view.intGet the maximum allowed field count.@NotNull List<IBuildingExtension> Getter of all owned fields.voidsetAssignFieldManually(boolean assignFieldManually) Sets the assignedFieldManually in the view.Methods inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModuleView
canBeHiredAs, getBuildingView, getColony, getProducer, setBuildingView, setColonyView, setProducerMethods 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.modules.IBuildingModuleView
getIcon, getWindow, isPageVisible
-
Constructor Details
-
FieldsModuleView
public FieldsModuleView()
-
-
Method Details
-
deserialize
public void deserialize(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Description copied from interface:IBuildingModuleViewDeserialize the data on the client side.- Parameters:
buf- the buffer to read it from.
-
getIconResourceLocation
public net.minecraft.resources.ResourceLocation getIconResourceLocation()Description copied from interface:IBuildingModuleViewGet the resource location of the icon for the module view.- Returns:
- the resource location.
-
getDesc
public net.minecraft.network.chat.Component getDesc()Description copied from interface:IBuildingModuleViewGet the lang string for the title.- Returns:
- the lang string.
-
assignFieldManually
public boolean assignFieldManually()Should the citizen be assigned manually to the fields.- Returns:
- true if yes.
-
setAssignFieldManually
public void setAssignFieldManually(boolean assignFieldManually) Sets the assignedFieldManually in the view.- Parameters:
assignFieldManually- variable to set.
-
assignField
Assign a given field to the current worker.- Parameters:
field- the field to assign.
-
canAssignField
Check to see if a new field can be assigned to the worker.- Parameters:
field- the field which is being added.- Returns:
- true if so.
-
getOwnedFields
Getter of all owned fields.- Returns:
- an unmodifiable list.
-
canAssignFieldOverride
Additional checks to see if this field can be assigned to the building.- Parameters:
field- the field which is being added.- Returns:
- true if so.
-
getFields
Getter of all fields that are either free, or taken by the current building.- Returns:
- an unmodifiable list.
-
getFieldsInColony
Obtains the list of fields from the colony.- Returns:
- the list of field instances.
-
freeField
Free a field from the current worker.- Parameters:
field- the field to free.
-
getFieldWarningTooltip
@Nullable public @Nullable net.minecraft.network.chat.MutableComponent getFieldWarningTooltip(IBuildingExtension field) Get a warning text component for the specific field whenever this field cannot be assigned for any reason.- Parameters:
field- the field in question.- Returns:
- a text component that should be shown if there is a problem for the specific field, else null.
-
getMaxFieldCount
public int getMaxFieldCount()Get the maximum allowed field count.- Returns:
- the max field count.
-