use of com.minecolonies.coremod.colony.buildings.modules.WorkAtHomeBuildingModule in project minecolonies by Minecolonies.
the class CitizenManager method calculateMaxCitizens.
@Override
public void calculateMaxCitizens() {
int newMaxCitizens = 0;
int potentialMax = 0;
for (final IBuilding b : colony.getBuildingManager().getBuildings().values()) {
if (b.getBuildingLevel() > 0) {
if (b.hasModule(BedHandlingModule.class) && b.hasModule(WorkAtHomeBuildingModule.class)) {
final WorkAtHomeBuildingModule module = b.getFirstModuleOccurance(WorkAtHomeBuildingModule.class);
newMaxCitizens += b.getAllAssignedCitizen().size();
potentialMax += module.getModuleMax() - b.getAllAssignedCitizen().size();
} else if (b.hasModule(LivingBuildingModule.class)) {
newMaxCitizens += b.getFirstModuleOccurance(LivingBuildingModule.class).getModuleMax();
}
}
}
if (getMaxCitizens() != newMaxCitizens) {
setMaxCitizens(newMaxCitizens);
setPotentialMaxCitizens(potentialMax + newMaxCitizens);
colony.markDirty();
}
}
use of com.minecolonies.coremod.colony.buildings.modules.WorkAtHomeBuildingModule in project minecolonies by ldtteam.
the class CitizenManager method calculateMaxCitizens.
@Override
public void calculateMaxCitizens() {
int newMaxCitizens = 0;
int potentialMax = 0;
for (final IBuilding b : colony.getBuildingManager().getBuildings().values()) {
if (b.getBuildingLevel() > 0) {
if (b.hasModule(BedHandlingModule.class) && b.hasModule(WorkAtHomeBuildingModule.class)) {
final WorkAtHomeBuildingModule module = b.getFirstModuleOccurance(WorkAtHomeBuildingModule.class);
newMaxCitizens += b.getAllAssignedCitizen().size();
potentialMax += module.getModuleMax() - b.getAllAssignedCitizen().size();
} else if (b.hasModule(LivingBuildingModule.class)) {
newMaxCitizens += b.getFirstModuleOccurance(LivingBuildingModule.class).getModuleMax();
}
}
}
if (getMaxCitizens() != newMaxCitizens) {
setMaxCitizens(newMaxCitizens);
setPotentialMaxCitizens(potentialMax + newMaxCitizens);
colony.markDirty();
}
}
Aggregations