use of com.minecolonies.coremod.colony.workorders.WorkOrderBuild in project minecolonies by Minecolonies.
the class EntityAIStructureBuilder method executeSpecificCompleteActions.
@Override
public void executeSpecificCompleteActions() {
if (job.getStructure() == null && job.hasWorkOrder()) {
//fix for bad structures
job.complete();
}
if (job.getStructure() == null) {
return;
}
final String structureName = job.getStructure().getName();
worker.sendLocalizedChat(COM_MINECOLONIES_COREMOD_ENTITY_BUILDER_BUILDCOMPLETE, structureName);
final WorkOrderBuildDecoration wo = job.getWorkOrder();
if (wo == null) {
Log.getLogger().error(String.format("Builder (%d:%d) ERROR - Finished, but missing work order(%d)", worker.getColony().getID(), worker.getCitizenData().getId(), job.getWorkOrderId()));
} else {
final WorkOrderBuild woh = (wo instanceof WorkOrderBuild) ? (WorkOrderBuild) wo : null;
if (woh == null && structureName.contains(WAYPOINT_STRING)) {
worker.getColony().addWayPoint(wo.getBuildingLocation(), world.getBlockState(wo.getBuildingLocation()));
} else if (woh != null) {
final AbstractBuilding building = job.getColony().getBuilding(wo.getBuildingLocation());
if (building == null) {
Log.getLogger().error(String.format("Builder (%d:%d) ERROR - Finished, but missing building(%s)", worker.getColony().getID(), worker.getCitizenData().getId(), woh.getBuildingLocation()));
} else {
building.setBuildingLevel(woh.getUpgradeLevel());
}
}
job.complete();
}
final BuildingBuilder workerBuilding = (BuildingBuilder) getOwnBuilding();
workerBuilding.resetNeededResources();
resetTask();
}
Aggregations