Search in sources :

Example 1 with ICivilianData

use of com.minecolonies.api.colony.ICivilianData in project minecolonies by ldtteam.

the class ReproductionManager method checkForBioParents.

/**
 * Check if there are potential biological parents in the colony.
 * (At least one male/female citizen).
 * @return true if so.
 */
private boolean checkForBioParents() {
    boolean hasMale = false;
    boolean hasFemale = false;
    for (final ICitizenData data : colony.getCitizenManager().getCitizens()) {
        if (data.isFemale()) {
            hasFemale = true;
        } else {
            hasMale = true;
        }
        if (hasFemale && hasMale) {
            return true;
        }
    }
    for (final ICivilianData data : colony.getVisitorManager().getCivilianDataMap().values()) {
        if (data.isFemale()) {
            hasFemale = true;
        } else {
            hasMale = true;
        }
        if (hasFemale && hasMale) {
            return true;
        }
    }
    return false;
}
Also used : ICivilianData(com.minecolonies.api.colony.ICivilianData) ICitizenData(com.minecolonies.api.colony.ICitizenData)

Example 2 with ICivilianData

use of com.minecolonies.api.colony.ICivilianData in project minecolonies by Minecolonies.

the class ReproductionManager method checkForBioParents.

/**
 * Check if there are potential biological parents in the colony.
 * (At least one male/female citizen).
 * @return true if so.
 */
private boolean checkForBioParents() {
    boolean hasMale = false;
    boolean hasFemale = false;
    for (final ICitizenData data : colony.getCitizenManager().getCitizens()) {
        if (data.isFemale()) {
            hasFemale = true;
        } else {
            hasMale = true;
        }
        if (hasFemale && hasMale) {
            return true;
        }
    }
    for (final ICivilianData data : colony.getVisitorManager().getCivilianDataMap().values()) {
        if (data.isFemale()) {
            hasFemale = true;
        } else {
            hasMale = true;
        }
        if (hasFemale && hasMale) {
            return true;
        }
    }
    return false;
}
Also used : ICivilianData(com.minecolonies.api.colony.ICivilianData) ICitizenData(com.minecolonies.api.colony.ICitizenData)

Example 3 with ICivilianData

use of com.minecolonies.api.colony.ICivilianData in project AdvancedPeripherals by Seniorendi.

the class ColonyPeripheral method getVisitors.

@LuaFunction(mainThread = true)
public final Object getVisitors() throws LuaException {
    IColony colony = getColony();
    List<Object> list = new ArrayList<>();
    for (ICivilianData civilian : colony.getVisitorManager().getCivilianDataMap().values()) {
        if (!(civilian instanceof IVisitorData))
            continue;
        list.add(MineColonies.visitorToObject((IVisitorData) civilian));
    }
    return list;
}
Also used : ICivilianData(com.minecolonies.api.colony.ICivilianData) IVisitorData(com.minecolonies.api.colony.IVisitorData) IColony(com.minecolonies.api.colony.IColony) LuaFunction(dan200.computercraft.api.lua.LuaFunction)

Aggregations

ICivilianData (com.minecolonies.api.colony.ICivilianData)3 ICitizenData (com.minecolonies.api.colony.ICitizenData)2 IColony (com.minecolonies.api.colony.IColony)1 IVisitorData (com.minecolonies.api.colony.IVisitorData)1 LuaFunction (dan200.computercraft.api.lua.LuaFunction)1