use of com.minecolonies.coremod.colony.requestsystem.requests.StandardRequests.PickupRequest in project minecolonies by Minecolonies.
the class EntityAIWorkDeliveryman method pickup.
/**
* Pickup items from a hut that has requested a pickup.
*
* @return the next state to go to.
*/
private IAIState pickup() {
final IRequest<? extends IDeliverymanRequestable> currentTask = job.getCurrentTask();
if (!(currentTask instanceof PickupRequest)) {
// The current task has changed since the Decision-state. Restart.
return START_WORKING;
}
if (cannotHoldMoreItems()) {
this.alreadyKept = new ArrayList<>();
this.currentSlot = 0;
return DUMPING;
}
worker.getCitizenData().setVisibleStatus(DELIVERING);
worker.getCitizenStatusHandler().setLatestStatus(new TranslationTextComponent("com.minecolonies.coremod.status.gathering"));
final BlockPos pickupTarget = currentTask.getRequester().getLocation().getInDimensionLocation();
if (pickupTarget != BlockPos.ZERO && !worker.isWorkerAtSiteWithMove(pickupTarget, MIN_DISTANCE_TO_WAREHOUSE)) {
setDelay(WALK_DELAY);
return PICKUP;
}
final IBuilding pickupBuilding = getOwnBuilding().getColony().getBuildingManager().getBuilding(pickupTarget);
if (pickupBuilding == null) {
job.finishRequest(false);
return START_WORKING;
}
if (pickupFromBuilding(pickupBuilding)) {
this.alreadyKept = new ArrayList<>();
this.currentSlot = 0;
job.finishRequest(true);
if (currentTask.getRequest().getPriority() >= PRIORITY_FORCING_DUMP) {
return DUMPING;
} else {
return START_WORKING;
}
} else if (InventoryUtils.openSlotCount(worker.getInventoryCitizen()) <= 0) {
this.alreadyKept = new ArrayList<>();
this.currentSlot = 0;
return DUMPING;
}
currentSlot++;
return PICKUP;
}
use of com.minecolonies.coremod.colony.requestsystem.requests.StandardRequests.PickupRequest in project minecolonies by ldtteam.
the class EntityAIWorkDeliveryman method pickup.
/**
* Pickup items from a hut that has requested a pickup.
*
* @return the next state to go to.
*/
private IAIState pickup() {
final IRequest<? extends IDeliverymanRequestable> currentTask = job.getCurrentTask();
if (!(currentTask instanceof PickupRequest)) {
// The current task has changed since the Decision-state. Restart.
return START_WORKING;
}
if (cannotHoldMoreItems()) {
this.alreadyKept = new ArrayList<>();
this.currentSlot = 0;
return DUMPING;
}
worker.getCitizenData().setVisibleStatus(DELIVERING);
worker.getCitizenStatusHandler().setLatestStatus(new TranslationTextComponent("com.minecolonies.coremod.status.gathering"));
final BlockPos pickupTarget = currentTask.getRequester().getLocation().getInDimensionLocation();
if (pickupTarget != BlockPos.ZERO && !worker.isWorkerAtSiteWithMove(pickupTarget, MIN_DISTANCE_TO_WAREHOUSE)) {
setDelay(WALK_DELAY);
return PICKUP;
}
final IBuilding pickupBuilding = getOwnBuilding().getColony().getBuildingManager().getBuilding(pickupTarget);
if (pickupBuilding == null) {
job.finishRequest(false);
return START_WORKING;
}
if (pickupFromBuilding(pickupBuilding)) {
this.alreadyKept = new ArrayList<>();
this.currentSlot = 0;
job.finishRequest(true);
if (currentTask.getRequest().getPriority() >= PRIORITY_FORCING_DUMP) {
return DUMPING;
} else {
return START_WORKING;
}
} else if (InventoryUtils.openSlotCount(worker.getInventoryCitizen()) <= 0) {
this.alreadyKept = new ArrayList<>();
this.currentSlot = 0;
return DUMPING;
}
currentSlot++;
return PICKUP;
}
Aggregations