Search in sources :

Example 1 with JobBuilder

use of com.minecolonies.coremod.colony.jobs.JobBuilder in project minecolonies by Minecolonies.

the class WorkOrderBuildDecoration method attemptToFulfill.

/**
     * Attempt to fulfill the Work Order.
     * Override this with an implementation for the Work Order to find a Citizen to perform the job
     * <p>
     * finds the first suitable builder for this job.
     *
     * @param colony The colony that owns the Work Order.
     */
@Override
public void attemptToFulfill(@NotNull final Colony colony) {
    boolean sendMessage = true;
    boolean hasBuilder = false;
    for (@NotNull final CitizenData citizen : colony.getCitizens().values()) {
        final JobBuilder job = citizen.getJob(JobBuilder.class);
        if (job == null || citizen.getWorkBuilding() == null) {
            continue;
        }
        hasBuilder = true;
        // don't send a message if we have a valid worker that is busy.
        if (canBuild(citizen)) {
            sendMessage = false;
        }
        if (!job.hasWorkOrder() && canBuild(citizen)) {
            job.setWorkOrder(this);
            this.setClaimedBy(citizen);
            return;
        }
    }
    sendBuilderMessage(colony, hasBuilder, sendMessage);
}
Also used : JobBuilder(com.minecolonies.coremod.colony.jobs.JobBuilder) CitizenData(com.minecolonies.coremod.colony.CitizenData) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

CitizenData (com.minecolonies.coremod.colony.CitizenData)1 JobBuilder (com.minecolonies.coremod.colony.jobs.JobBuilder)1 NotNull (org.jetbrains.annotations.NotNull)1