use of com.minecolonies.api.colony.requestsystem.requestable.IConcreteDeliverable in project minecolonies by Minecolonies.
the class WarehouseConcreteRequestResolver method internalCanResolve.
@Override
protected boolean internalCanResolve(final List<TileEntityWareHouse> wareHouses, final IRequest<? extends IDeliverable> requestToCheck) {
final IDeliverable deliverable = requestToCheck.getRequest();
if (deliverable instanceof IConcreteDeliverable) {
boolean ignoreNBT = false;
boolean ignoreDamage = false;
if (deliverable instanceof Stack) {
if (!((Stack) requestToCheck.getRequest()).matchNBT()) {
ignoreNBT = true;
}
if (!((Stack) requestToCheck.getRequest()).matchDamage()) {
ignoreDamage = true;
}
}
for (final ItemStack possible : ((IConcreteDeliverable) deliverable).getRequestedItems()) {
for (final TileEntityWareHouse wareHouse : wareHouses) {
if (requestToCheck.getRequest() instanceof INonExhaustiveDeliverable) {
if (wareHouse.hasMatchingItemStackInWarehouse(possible, requestToCheck.getRequest().getMinimumCount(), ignoreNBT, ignoreDamage, ((INonExhaustiveDeliverable) requestToCheck.getRequest()).getLeftOver())) {
return true;
}
} else {
if (wareHouse.hasMatchingItemStackInWarehouse(possible, requestToCheck.getRequest().getMinimumCount(), ignoreNBT, ignoreDamage, 0)) {
return true;
}
}
}
}
}
return false;
}
use of com.minecolonies.api.colony.requestsystem.requestable.IConcreteDeliverable in project minecolonies by ldtteam.
the class WarehouseConcreteRequestResolver method internalCanResolve.
@Override
protected boolean internalCanResolve(final List<TileEntityWareHouse> wareHouses, final IRequest<? extends IDeliverable> requestToCheck) {
final IDeliverable deliverable = requestToCheck.getRequest();
if (deliverable instanceof IConcreteDeliverable) {
boolean ignoreNBT = false;
boolean ignoreDamage = false;
if (deliverable instanceof Stack) {
if (!((Stack) requestToCheck.getRequest()).matchNBT()) {
ignoreNBT = true;
}
if (!((Stack) requestToCheck.getRequest()).matchDamage()) {
ignoreDamage = true;
}
}
for (final ItemStack possible : ((IConcreteDeliverable) deliverable).getRequestedItems()) {
for (final TileEntityWareHouse wareHouse : wareHouses) {
if (requestToCheck.getRequest() instanceof INonExhaustiveDeliverable) {
if (wareHouse.hasMatchingItemStackInWarehouse(possible, requestToCheck.getRequest().getMinimumCount(), ignoreNBT, ignoreDamage, ((INonExhaustiveDeliverable) requestToCheck.getRequest()).getLeftOver())) {
return true;
}
} else {
if (wareHouse.hasMatchingItemStackInWarehouse(possible, requestToCheck.getRequest().getMinimumCount(), ignoreNBT, ignoreDamage, 0)) {
return true;
}
}
}
}
}
return false;
}
Aggregations