Search in sources :

Example 1 with IWareHouse

use of com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse in project minecolonies by ldtteam.

the class AbstractCraftingBuildingModule method getWarehouseCount.

/**
 * Get the count of items in all the warehouses
 */
protected int getWarehouseCount(ItemStorage item) {
    int count = 0;
    final List<IWareHouse> wareHouses = building.getColony().getBuildingManager().getWareHouses();
    for (IWareHouse wareHouse : wareHouses) {
        count += InventoryUtils.getCountFromBuilding(wareHouse, item);
    }
    return count;
}
Also used : IWareHouse(com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse)

Example 2 with IWareHouse

use of com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse in project minecolonies by ldtteam.

the class DeliverymenRequestResolver method getResolveAbleDeliverymen.

/**
 * Get the deliverymen we can resolve requests for
 *
 * @param manager request manager
 * @return list of citizens
 */
public List<ICitizenData> getResolveAbleDeliverymen(@NotNull final IRequestManager manager) {
    final List<ICitizenData> citizenList = new ArrayList<>();
    final Colony colony = (Colony) manager.getColony();
    final IWareHouse wareHouse = colony.getBuildingManager().getBuilding(getLocation().getInDimensionLocation(), IWareHouse.class);
    if (wareHouse == null) {
        return citizenList;
    }
    for (final ICitizenData data : wareHouse.getFirstModuleOccurance(CourierAssignmentModule.class).getAssignedCitizen()) {
        if (data.isWorking()) {
            citizenList.add(data);
        }
    }
    return citizenList;
}
Also used : CourierAssignmentModule(com.minecolonies.coremod.colony.buildings.modules.CourierAssignmentModule) IWareHouse(com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse) ArrayList(java.util.ArrayList) ICitizenData(com.minecolonies.api.colony.ICitizenData) Colony(com.minecolonies.coremod.colony.Colony)

Example 3 with IWareHouse

use of com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse in project minecolonies by Minecolonies.

the class BuildingManager method getClosestWarehouseInColony.

@Nullable
@Override
public IWareHouse getClosestWarehouseInColony(final BlockPos pos) {
    IWareHouse wareHouse = null;
    double dist = 0;
    for (final IWareHouse building : wareHouses) {
        if (building.getBuildingLevel() > 0 && building.getTileEntity() != null) {
            final double tempDist = building.getPosition().distSqr(pos);
            if (wareHouse == null || tempDist < dist) {
                dist = tempDist;
                wareHouse = building;
            }
        }
    }
    return wareHouse;
}
Also used : IWareHouse(com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with IWareHouse

use of com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse in project minecolonies by Minecolonies.

the class AbstractCraftingBuildingModule method getWarehouseCount.

/**
 * Get the count of items in all the warehouses
 */
protected int getWarehouseCount(ItemStorage item) {
    int count = 0;
    final List<IWareHouse> wareHouses = building.getColony().getBuildingManager().getWareHouses();
    for (IWareHouse wareHouse : wareHouses) {
        count += InventoryUtils.getCountFromBuilding(wareHouse, item);
    }
    return count;
}
Also used : IWareHouse(com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse)

Example 5 with IWareHouse

use of com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse in project minecolonies by Minecolonies.

the class DeliverymenRequestResolver method getResolveAbleDeliverymen.

/**
 * Get the deliverymen we can resolve requests for
 *
 * @param manager request manager
 * @return list of citizens
 */
public List<ICitizenData> getResolveAbleDeliverymen(@NotNull final IRequestManager manager) {
    final List<ICitizenData> citizenList = new ArrayList<>();
    final Colony colony = (Colony) manager.getColony();
    final IWareHouse wareHouse = colony.getBuildingManager().getBuilding(getLocation().getInDimensionLocation(), IWareHouse.class);
    if (wareHouse == null) {
        return citizenList;
    }
    for (final ICitizenData data : wareHouse.getFirstModuleOccurance(CourierAssignmentModule.class).getAssignedCitizen()) {
        if (data.isWorking()) {
            citizenList.add(data);
        }
    }
    return citizenList;
}
Also used : CourierAssignmentModule(com.minecolonies.coremod.colony.buildings.modules.CourierAssignmentModule) IWareHouse(com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse) ArrayList(java.util.ArrayList) ICitizenData(com.minecolonies.api.colony.ICitizenData) Colony(com.minecolonies.coremod.colony.Colony)

Aggregations

IWareHouse (com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse)8 ICitizenData (com.minecolonies.api.colony.ICitizenData)2 Colony (com.minecolonies.coremod.colony.Colony)2 CourierAssignmentModule (com.minecolonies.coremod.colony.buildings.modules.CourierAssignmentModule)2 StandardInteraction (com.minecolonies.coremod.colony.interactionhandling.StandardInteraction)2 ArrayList (java.util.ArrayList)2 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)2 Nullable (org.jetbrains.annotations.Nullable)2