Search in sources :

Example 1 with BuildingSchool

use of com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingSchool in project minecolonies by Minecolonies.

the class EntityAIWorkPupil method decide.

/**
 * Decide between recess and studying.
 *
 * @return next state to go to.
 */
private IAIState decide() {
    if (worker.getRandom().nextInt(STUDY_TO_RECESS_RATIO) < 1) {
        recessPos = building.getPosition();
        return RECESS;
    }
    final BuildingSchool school = building;
    final BlockPos pos = school.getRandomPlaceToSit();
    if (pos == null) {
        worker.getCitizenData().triggerInteraction(new StandardInteraction(new TranslationTextComponent(PUPIL_NO_CARPET), ChatPriority.BLOCKING));
        return DECIDE;
    }
    studyPos = pos;
    return STUDY;
}
Also used : StandardInteraction(com.minecolonies.coremod.colony.interactionhandling.StandardInteraction) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) BlockPos(net.minecraft.util.math.BlockPos) BuildingSchool(com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingSchool)

Example 2 with BuildingSchool

use of com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingSchool in project minecolonies by ldtteam.

the class EntityAIWorkPupil method decide.

/**
 * Decide between recess and studying.
 *
 * @return next state to go to.
 */
private IAIState decide() {
    if (worker.getRandom().nextInt(STUDY_TO_RECESS_RATIO) < 1) {
        recessPos = getOwnBuilding().getPosition();
        return RECESS;
    }
    final BuildingSchool school = getOwnBuilding();
    final BlockPos pos = school.getRandomPlaceToSit();
    if (pos == null) {
        worker.getCitizenData().triggerInteraction(new StandardInteraction(new TranslationTextComponent(PUPIL_NO_CARPET), ChatPriority.BLOCKING));
        return DECIDE;
    }
    studyPos = pos;
    return STUDY;
}
Also used : StandardInteraction(com.minecolonies.coremod.colony.interactionhandling.StandardInteraction) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) BlockPos(net.minecraft.util.math.BlockPos) BuildingSchool(com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingSchool)

Aggregations

BuildingSchool (com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingSchool)2 StandardInteraction (com.minecolonies.coremod.colony.interactionhandling.StandardInteraction)2 BlockPos (net.minecraft.util.math.BlockPos)2 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)2