for (i = 0; superGarden [i] != undefined; i++) if (superGarden [i] [0]) {
	if (world.getBlockID(superGarden [i] [1] [0], superGarden [i] [1] [1], superGarden [i] [1] [2]) != superGarden [i] [5]) {
		superGarden [i] = [false, 0, 0, 0, 0, 0, 0, ""]; waterAmount.text = ""; sunAmount.text = "";
		blockHP = 0; blockMaxHP = 0; gardenLabel.alpha = 0;
	}
	
	if (!(superGarden [i] [6] > 0)) {superGarden [i] [6] = 0;}
	for (kk = 0; kk < timeWaited; kk++) {
		k = ((3.5 + Math.sqrt(superGarden [i] [3]*superGarden [i] [2])) - 
			(3.5 + Math.sqrt(superGarden [i] [3]*Math.pow(superGarden [i] [2], 1.5)))/Math.max(Math.sqrt(100 - superGarden [i] [2]), 1))/5000;
		superGarden [i] [4] += k; gardening_xp += k/10; superGarden [i] [6] += 0.015/Math.max(Math.sqrt(gardening_lvl/20 + 0.8), 1) - k;
		superGarden [i] [2] = Math.max(superGarden [i] [2]*0.9994 - 0.0003, 0);
		if (superGarden [i] [1] != 0)
			superGarden [i] [3] = Math.min((world.getLightValue(superGarden [i] [1] [0], 
				superGarden [i] [1] [1], superGarden [i] [1] [2]))/(superGarden [i] [3]+1) + superGarden [i] [3],100);
	}

	if (superGarden [i] [4] >= 30) {
		var lowerID = world.getBlockID(superGarden [i] [1] [0], superGarden [i] [1] [1]-1, superGarden [i] [1] [2]); 
		var lowerMD = world.getMetadata(superGarden [i] [1] [0], superGarden [i] [1] [1]-1, superGarden [i] [1] [2]);
		changeID = 207; if (lowerMD == 0) switch (lowerID) {
			case 82: {changeMD = 4; break;} case 12: {changeMD = 8; break;} case 87: {changeMD = 6; break;} 
			case 48: {changeMD = 15; break;} case 79: {changeMD = 5; break;} case 13: {changeMD = 10; break;}
			case 2: {rand = Math.floor(Math.random() * 22); 
			switch (rand) {
				case 0: {changeMD = 3; break;} case 1: {changeMD = 7; break;} case 2: {changeMD = 9; break;} 
				case 3: {changeMD = 11; break;} case 4: {changeMD = 12; break;} case 5: {changeMD = 13; break;} 
				case 6: {changeMD = 14; break;} default: {changeID = 232; changeMD = rand - 7; break;}
			} break;}
		}
		if (lowerID == 2 && lowerMD == 3) {changeMD = 2;}
		if (lowerID == 2 && lowerMD == 1) {changeMD = 1;}
		if (lowerID == 2 && lowerMD == 2) {changeMD = 0;}

		gardening_xp += prices [changeID] [changeMD] [1];
		world.setBlockIDAndMetadata(superGarden [i] [1] [0], superGarden [i] [1] [1], superGarden [i] [1] [2], changeID, changeMD);
		superGarden [i] = [false, 0, 0, 0, 0, 0, 0, ""]; waterAmount.text = ""; sunAmount.text = "";
		blockHP = 0; blockMaxHP = 0; gardenLabel.alpha = 0;
	}
	if (superGarden [i] [6] >= 30) {
		world.setBlockIDAndMetadata(superGarden [i] [1] [0], superGarden [i] [1] [1], superGarden [i] [1] [2], 208, 1);
		superGarden [i] = [false, 0, 0, 0, 0, 0, 0, ""]; waterAmount.text = ""; sunAmount.text = "";
		blockHP = 0; blockMaxHP = 0; gardenLabel.alpha = 0;
	}
}

if (superGarden [actD] != undefined && superGarden [actD] [0] == true && getBlock != null 
&& superGarden [actD] [1] [0] == getBlock.x && superGarden [actD] [1] [1] == getBlock.y + 1 && superGarden [actD] [1] [2] == getBlock.z) {
	hb5.alpha = 0.6; hb5.width = (1 - superGarden [actD] [6]/30)*174;
	gardenLabel.alpha = 1; blockHP = 30 - superGarden [actD] [4]; blockLabel.text = superGarden [actD] [7];
	waterAmount.text = Math.round(waterpower); sunAmount.text = Math.round(sunpower);
	waterAmount.x = width/2 - 96 - ui.getStringWidth(Math.round(waterpower))/2;
	sunAmount.x = width/2 + 98 - ui.getStringWidth(Math.round(sunpower))/2; blockMaxHP = 30;
} else {hb5.alpha = 0;}
if ((waterAmount.text != "" || sunAmount.text != "" || gardenLabel.alpha != 0) && blockHP == 0 && blockMaxHP == 0) 
	{waterAmount.text = ""; sunAmount.text = ""; gardenLabel.alpha = 0;}