Interface Consumer

  • All Known Implementing Classes:
    Building, BuildQueue, ServerBuilding, ServerUnit, Unit, UnitType

    public interface Consumer
    Objects implementing the Consumer interface consume Goods. Examples include units that eat food, buildings that convert Goods into other Goods, or buildings that store Goods.
    • Field Detail

      • COMPARATOR

        static final java.util.Comparator<Consumer> COMPARATOR
        Compare consumers by descending priority.
      • POPULATION_PRIORITY

        static final int POPULATION_PRIORITY
        Default consumption priority for the Colony when producing new colonists (from food).
        See Also:
        Constant Field Values
      • COLONY_PRIORITY

        static final int COLONY_PRIORITY
        The consumption priority of the colony build queue.
        See Also:
        Constant Field Values
      • BUILDING_PRIORITY

        static final int BUILDING_PRIORITY
        Default consumption priority for buildings. Individual building types may have different priorities.
        See Also:
        Constant Field Values
      • UNIT_PRIORITY

        static final int UNIT_PRIORITY
        Default consumption priority for units. Individual unit types may have different priorities. Slave units, or converts, or petty criminals, for example, might have a lower priority.
        See Also:
        Constant Field Values
    • Method Detail

      • getConsumedGoods

        java.util.List<AbstractGoods> getConsumedGoods()
        Returns a list of GoodsTypes this Consumer consumes.
        Returns:
        a List value
      • getPriority

        int getPriority()
        The priority of this Consumer. The higher the priority, the earlier will the Consumer be allowed to consume the goods it requires.
        Returns:
        an int value
      • getConsumptionModifiers

        java.util.stream.Stream<Modifier> getConsumptionModifiers​(java.lang.String id)
        Get the modifier set with the given id. The modifier most relevant to consumers is "consumeOnlySurplusProduction", which implies that the consumer does not consume stored goods (used by the country and stables).
        Parameters:
        id - The object identifier.
        Returns:
        The stream of Modifiers found.