use of com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingMiner in project minecolonies by ldtteam.
the class EntityAIStructureMiner method checkMineShaft.
@NotNull
private IAIState checkMineShaft() {
final BuildingMiner buildingMiner = getOwnBuilding();
// Check if we reached the bottom of the shaft
if (getLastLadder(buildingMiner.getLadderLocation(), world) < SHAFT_BASE_DEPTH) {
AdvancementUtils.TriggerAdvancementPlayersForColony(job.getColony(), AdvancementTriggers.DEEP_MINE::trigger);
}
// Check if we reached the mineshaft depth limit
if (getLastLadder(buildingMiner.getLadderLocation(), world) < buildingMiner.getDepthLimit()) {
// If the miner hut has been placed too deep.
if (buildingMiner.getFirstModuleOccurance(MinerLevelManagementModule.class).getNumberOfLevels() == 0) {
worker.getCitizenData().triggerInteraction(new StandardInteraction(new TranslationTextComponent(NEEDS_BETTER_HUT), ChatPriority.BLOCKING));
return IDLE;
}
worker.getCitizenData().setVisibleStatus(MINING);
return MINER_MINING_NODE;
}
worker.getCitizenData().setVisibleStatus(MINING);
return MINER_MINING_SHAFT;
}
use of com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingMiner in project minecolonies by ldtteam.
the class AbstractEntityAIGuard method patrolMine.
/**
* Patrol between all completed nodes in the assigned mine
*
* @return the next point to patrol to
*/
public IAIState patrolMine() {
if (buildingGuards.getMinePos() == null) {
return PREPARING;
}
if (currentPatrolPoint == null || worker.isWorkerAtSiteWithMove(currentPatrolPoint, 2)) {
final IBuilding building = buildingGuards.getColony().getBuildingManager().getBuilding(buildingGuards.getMinePos());
if (building != null) {
if (building instanceof BuildingMiner) {
final BuildingMiner buildingMiner = (BuildingMiner) building;
final Level level = buildingMiner.getFirstModuleOccurance(MinerLevelManagementModule.class).getCurrentLevel();
if (level == null) {
setNextPatrolTarget(buildingMiner.getPosition());
} else {
setNextPatrolTarget(level.getRandomCompletedNode(buildingMiner));
}
} else {
buildingGuards.getFirstModuleOccurance(ISettingsModule.class).getSetting(AbstractBuildingGuards.GUARD_TASK).set(GuardTaskSetting.PATROL);
}
} else {
buildingGuards.getFirstModuleOccurance(ISettingsModule.class).getSetting(AbstractBuildingGuards.GUARD_TASK).set(GuardTaskSetting.PATROL);
}
}
return null;
}
Aggregations