Placing blocks Minecraft-style on round world?

Hello, I’m trying to make a game where blocks can be placed on the sides of other blocks like Minecraft, but on a giant sphere. The problem is that I can’t figure out how to place blocks on whatever side of the other block was clicked on no matter the rotation. The code below will only work on the absolute “top” of the sphere.

						var FrontDist = Vector3.Distance (HitResult.transform.gameObject.transform.position + new Vector3(0,0,-1), HitResult.point);
						var BackDist = Vector3.Distance (HitResult.transform.gameObject.transform.position + new Vector3(0,0,1), HitResult.point);
						var TopDist = Vector3.Distance (HitResult.transform.gameObject.transform.position + new Vector3(0,1,0), HitResult.point);
						var BottomDist = Vector3.Distance (HitResult.transform.gameObject.transform.position + new Vector3(0,-1,0), HitResult.point);
						var LeftDist = Vector3.Distance (HitResult.transform.gameObject.transform.position + new Vector3(-1,0,0), HitResult.point);
						var RightDist = Vector3.Distance (HitResult.transform.gameObject.transform.position + new Vector3(1,0,0), HitResult.point);

						Debug.Log (ChooseLowest (FrontDist, BackDist, TopDist, BottomDist, LeftDist, RightDist));
						Debug.Log ("Front:" + FrontDist + "Back:" + BackDist + "Top" + TopDist + "Bottom" + BottomDist + "Left" + LeftDist + "Right" + RightDist);
						Debug.Log ("Test:" + ChooseLowest (15, 10, 5));

						if (ChooseLowest (FrontDist, BackDist, TopDist, BottomDist, LeftDist, RightDist) == FrontDist) {
							PlacedItem.GetComponent<BlockScript> ().MoveAmount = new Vector3 (0, 0, -1);
							Debug.Log ("Front");
							PlaySound ("PlaceWood", (2.5f + Random.value)/3, 1.5f);
						}
						if (ChooseLowest (FrontDist, BackDist, TopDist, BottomDist, LeftDist, RightDist) == BackDist) {
							PlacedItem.GetComponent<BlockScript> ().MoveAmount = new Vector3 (0, 0, 1);
							Debug.Log ("Back");
							PlaySound ("PlaceWood", (2.5f + Random.value)/3, 1.5f);
						}
						if (ChooseLowest (FrontDist, BackDist, TopDist, BottomDist, LeftDist, RightDist) == TopDist) {
							PlacedItem.GetComponent<BlockScript> ().MoveAmount = new Vector3 (0, 1, 0);
							Debug.Log ("Top");
							PlaySound ("PlaceWood", (2.5f + Random.value)/3, 1.5f);
						}
						if (ChooseLowest (FrontDist, BackDist, TopDist, BottomDist, LeftDist, RightDist) == BottomDist) {
							PlacedItem.GetComponent<BlockScript> ().MoveAmount = new Vector3 (0, -1, 0);
							Debug.Log ("Bottom");
							PlaySound ("PlaceWood", (2.5f + Random.value)/3, 1.5f);
						}
						if (ChooseLowest (FrontDist, BackDist, TopDist, BottomDist, LeftDist, RightDist) == LeftDist) {
							PlacedItem.GetComponent<BlockScript> ().MoveAmount = new Vector3 (-1, 0, 0);
							Debug.Log ("Left");
							PlaySound ("PlaceWood", (2.5f + Random.value)/3, 1.5f);
						}
						if (ChooseLowest (FrontDist, BackDist, TopDist, BottomDist, LeftDist, RightDist) == RightDist) {
							PlacedItem.GetComponent<BlockScript> ().MoveAmount = new Vector3 (1, 0, 0);
							Debug.Log ("Right");
							PlaySound ("PlaceWood", (2.5f + Random.value) / 3, 1.5f);
						}

I figured it out, rather than use something like [new Vector3(1,0,0)], I use [gameObject.transform.right], that way cube placement will be based on the rotation of the cube that it is being placed next to.

						if (SelectedItem.GetComponent<BlockScript> ()) {
							PlacedItem = Instantiate (SelectedItem, HitResult.transform.gameObject.transform.position, HitResult.transform.gameObject.transform.rotation);

							var HitObject = HitResult.transform.gameObject;

							var FrontDist = Vector3.Distance (HitObject.transform.position + HitObject.transform.forward, HitResult.point);
							var BackDist = Vector3.Distance (HitObject.transform.position + -HitObject.transform.forward, HitResult.point);
							var TopDist = Vector3.Distance (HitObject.transform.position + HitObject.transform.up, HitResult.point);
							var BottomDist = Vector3.Distance (HitObject.transform.position + -HitObject.transform.up, HitResult.point);
							var LeftDist = Vector3.Distance (HitObject.transform.position + HitObject.transform.right, HitResult.point);
							var RightDist = Vector3.Distance (HitObject.transform.position + -HitObject.transform.right, HitResult.point);

							if (ChooseLowest (FrontDist, BackDist, TopDist, BottomDist, LeftDist, RightDist) == FrontDist) {
								PlacedItem.GetComponent<BlockScript> ().MoveAmount = new Vector3 (0, 0, 1);
								PlaySound ("PlaceWood", (2.5f + Random.value)/3, 1.5f);
							}
							if (ChooseLowest (FrontDist, BackDist, TopDist, BottomDist, LeftDist, RightDist) == BackDist) {
								PlacedItem.GetComponent<BlockScript> ().MoveAmount = new Vector3 (0, 0, -1);
								PlaySound ("PlaceWood", (2.5f + Random.value)/3, 1.5f);
							}
							if (ChooseLowest (FrontDist, BackDist, TopDist, BottomDist, LeftDist, RightDist) == TopDist) {
								PlacedItem.GetComponent<BlockScript> ().MoveAmount = new Vector3 (0, 1, 0);
								PlaySound ("PlaceWood", (2.5f + Random.value)/3, 1.5f);
							}
							if (ChooseLowest (FrontDist, BackDist, TopDist, BottomDist, LeftDist, RightDist) == BottomDist) {
								PlacedItem.GetComponent<BlockScript> ().MoveAmount = new Vector3 (0, -1, 0);
								PlaySound ("PlaceWood", (2.5f + Random.value)/3, 1.5f);
							}
							if (ChooseLowest (FrontDist, BackDist, TopDist, BottomDist, LeftDist, RightDist) == LeftDist) {
								PlacedItem.GetComponent<BlockScript> ().MoveAmount = new Vector3 (1, 0, 0);
								PlaySound ("PlaceWood", (2.5f + Random.value)/3, 1.5f);
							}
							if (ChooseLowest (FrontDist, BackDist, TopDist, BottomDist, LeftDist, RightDist) == RightDist) {
								PlacedItem.GetComponent<BlockScript> ().MoveAmount = new Vector3 (-1, 0, 0);
								PlaySound ("PlaceWood", (2.5f + Random.value) / 3, 1.5f);
							}
						}