use of com.minecolonies.coremod.colony.buildings.BuildingMiner in project minecolonies by Minecolonies.
the class EntityAIStructureMiner method lookForLadder.
@NotNull
private AIState lookForLadder() {
@Nullable final BuildingMiner buildingMiner = getOwnBuilding();
//Check for already found ladder
if (buildingMiner.hasFoundLadder() && buildingMiner.getLadderLocation() != null) {
if (world.getBlockState(buildingMiner.getLadderLocation()).getBlock() == Blocks.LADDER) {
return MINER_WALKING_TO_LADDER;
} else {
buildingMiner.setFoundLadder(false);
buildingMiner.setLadderLocation(null);
}
}
final int posX = buildingMiner.getLocation().getX();
final int posY = buildingMiner.getLocation().getY() + 2;
final int posZ = buildingMiner.getLocation().getZ();
for (int y = posY - LADDER_SEARCH_RANGE; y < posY; y++) {
for (int x = posX - LADDER_SEARCH_RANGE; x < posX + LADDER_SEARCH_RANGE; x++) {
for (int z = posZ - LADDER_SEARCH_RANGE; z < posZ + LADDER_SEARCH_RANGE; z++) {
tryFindLadderAt(new BlockPos(x, y, z));
}
}
}
return MINER_SEARCHING_LADDER;
}
Aggregations