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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations