use of com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse in project minecolonies by Minecolonies.
the class EntityAIWorkDeliveryman method checkIfExecute.
/**
* Check if the deliveryman code should be executed. More concretely if he has a warehouse to work at.
*
* @return false if should continue as planned.
*/
private boolean checkIfExecute() {
final IWareHouse wareHouse = getAndCheckWareHouse();
if (wareHouse != null) {
worker.getCitizenData().setWorking(true);
if (wareHouse.getTileEntity() == null) {
return false;
}
{
return true;
}
}
worker.getCitizenData().setWorking(false);
if (worker.getCitizenData() != null) {
worker.getCitizenData().triggerInteraction(new StandardInteraction(new TranslationTextComponent(COM_MINECOLONIES_COREMOD_JOB_DELIVERYMAN_NOWAREHOUSE), ChatPriority.BLOCKING));
}
return false;
}
use of com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse in project minecolonies by ldtteam.
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 ldtteam.
the class EntityAIWorkDeliveryman method checkIfExecute.
/**
* Check if the deliveryman code should be executed. More concretely if he has a warehouse to work at.
*
* @return false if should continue as planned.
*/
private boolean checkIfExecute() {
final IWareHouse wareHouse = getAndCheckWareHouse();
if (wareHouse != null) {
worker.getCitizenData().setWorking(true);
if (wareHouse.getTileEntity() == null) {
return false;
}
{
return true;
}
}
worker.getCitizenData().setWorking(false);
if (worker.getCitizenData() != null) {
worker.getCitizenData().triggerInteraction(new StandardInteraction(new TranslationTextComponent(COM_MINECOLONIES_COREMOD_JOB_DELIVERYMAN_NOWAREHOUSE), ChatPriority.BLOCKING));
}
return false;
}
Aggregations