Search in sources :

Example 6 with IWareHouse

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;
}
Also used : IWareHouse(com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse) StandardInteraction(com.minecolonies.coremod.colony.interactionhandling.StandardInteraction) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent)

Example 7 with IWareHouse

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;
}
Also used : IWareHouse(com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse) Nullable(org.jetbrains.annotations.Nullable)

Example 8 with IWareHouse

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;
}
Also used : IWareHouse(com.minecolonies.api.colony.buildings.workerbuildings.IWareHouse) StandardInteraction(com.minecolonies.coremod.colony.interactionhandling.StandardInteraction) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent)

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