package xyz.brassgoggledcoders.boilerplate.utils;

import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.common.FMLLog;

public class PositionUtils {

	private static String[] position_pairs = new String[] {"x_y", "x_z", "y_z", "y_x"};

	public static boolean arePositionsAlignedOnTwoAxes(BlockPos first, BlockPos second) {
		for(String pair : position_pairs) {
			String[] split = pair.split("_");
			FMLLog.warning(split[0], "");
			FMLLog.warning(split[1], "");
			if((convertStringToPosVal(split[0], first) == convertStringToPosVal(split[0], second))
					&& (convertStringToPosVal(split[1], first) == convertStringToPosVal(split[1], second)))
				return true;
		}

		return false;
	}

	private static int convertStringToPosVal(String pos_name, BlockPos pos) {
		if(pos_name.equalsIgnoreCase("x"))
			return pos.getX();
		else if(pos_name.equalsIgnoreCase("y"))
			return pos.getY();
		else if(pos_name.equalsIgnoreCase("z"))
			return pos.getZ();
		else
			return 0;
	}
}

@@ -44,16 +44,54 @@
 utils;%0A%0A
+import net.minecraft.util.EnumFacing;%0A
 import n
@@ -1022,11 +1022,519 @@
 rn 0;%0A%09%7D
+%0A%0A%09// TODO Does this already exist?%0A%09public static BlockPos getOffsetPosFromFacing(BlockPos start, EnumFacing facing) %7B%0A%09%09if(facing == EnumFacing.UP)%0A%09%09%09return start.up();%0A%09%09else if(facing == EnumFacing.DOWN)%0A%09%09%09return start.down();%0A%09%09else if(facing == EnumFacing.EAST)%0A%09%09%09return start.east();%0A%09%09else if(facing == EnumFacing.WEST)%0A%09%09%09return start.west();%0A%09%09else if(facing == EnumFacing.NORTH)%0A%09%09%09return start.north();%0A%09%09else if(facing == EnumFacing.SOUTH)%0A%09%09%09return start.south();%0A%09%09else%0A%09%09%09return start;%0A%0A%09%7D
 %0A%7D%0A

Add util for converting Facing to offset BlockPos