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

public abstract class FieldsModuleView extends AbstractBuildingModuleView
Client side version of the abstract class to list all fields (assigned) to a building.
  • Constructor Details

    • FieldsModuleView

      public FieldsModuleView()
  • Method Details

    • deserialize

      public void deserialize(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf)
      Description copied from interface: IBuildingModuleView
      Deserialize 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: IBuildingModuleView
      Get 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: IBuildingModuleView
      Get 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

      public void assignField(IBuildingExtension field)
      Assign a given field to the current worker.
      Parameters:
      field - the field to assign.
    • canAssignField

      public final boolean canAssignField(IBuildingExtension field)
      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

      @NotNull public @NotNull List<IBuildingExtension> getOwnedFields()
      Getter of all owned fields.
      Returns:
      an unmodifiable list.
    • canAssignFieldOverride

      protected abstract boolean canAssignFieldOverride(IBuildingExtension field)
      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

      @NotNull public @NotNull List<IBuildingExtension> getFields()
      Getter of all fields that are either free, or taken by the current building.
      Returns:
      an unmodifiable list.
    • getFieldsInColony

      protected abstract List<IBuildingExtension> getFieldsInColony()
      Obtains the list of fields from the colony.
      Returns:
      the list of field instances.
    • freeField

      public void freeField(IBuildingExtension field)
      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.