When i run the following code it is rendering the first xyz coords from the text file without a right side, and often other booleans get messed up.

public static void readBlockXYZtxt(){ File file = new File("blockXYZ.txt"); if (!file.exists()){ Writer output; try{ output = new BufferedWriter(new FileWriter("blockXYZ.txt", true)); //output.append("hello"); output.close(); } catch (IOException e){ e.printStackTrace(); } } else { try{ BufferedReader br = new BufferedReader(new FileReader("blockXYZ.txt")); String allText; String[] blockXYZ; String[] xyzINDVblock; String block; //String blockXstr; //String blockYstr; //String blockZstr; int blockX; int blockY; int blockZ; while ((allText = br.readLine()) != null){ blockXYZ = allText.split("N"); int BlockAmount = blockXYZ.length; // amountBlocks = amountBlocks + BlockAmount; for (int i=0;i<BlockAmount;){ boolean renderFront = true; boolean renderBack = true; boolean renderLeft = true; boolean renderRight = true; boolean renderTop = true; boolean renderBottom = true; block = blockXYZ[i]; xyzINDVblock = block.split("-"); System.out.println(BlockAmount); blockX = Integer.parseInt(xyzINDVblock[0]); blockY = Integer.parseInt(xyzINDVblock[1]); blockZ = Integer.parseInt(xyzINDVblock[2]); if (allText.contains(blockX+"-"+blockY+"-"+(blockZ-1)+"N")){ renderFront = false; System.out.println("renderFront "+renderFront+""+i); } if (allText.contains(blockX+"-"+blockY+"-"+(blockZ+1)+"N")){ renderBack = false; System.out.println("renderBack == "+renderBack+""+i); } if (allText.contains((blockX+1)+"-"+blockY+"-"+blockZ+"N")){// renderLeft = false; System.out.println("renderLeft "+renderLeft+""+i); } if (allText.contains((blockX-1)+"-"+blockY+"-"+blockZ+"N")){ renderRight = false; System.out.println((blockX-1)+"-"+blockY+"-"+blockZ+"N"); System.out.println("renderRight == "+renderRight+""+i); } if (allText.contains(blockX+"-"+(blockY+1)+"-"+blockZ+"N")){// renderTop = false; System.out.println("renderTop "+renderTop+""+i); } if (allText.contains(blockX+"-"+(blockY-1)+"-"+blockZ+"N")){// renderBottom = false; System.out.println("renderBottom "+renderBottom+""+i); } cubeVertex(blockX, blockY, blockZ, renderFront, renderBack, renderLeft, renderRight, renderTop, renderBottom); /*if (blockY > 0){ for (int r=0;r<blockY;){ cubeVertex(blockX, r, blockZ, renderFront, renderBack); r++; } }*/ i++; } //System.out.println(blockXstr);//blockXYZ = x, y, z //System.out.println(allText); //System.out.println(BlockAmount); //System.out.println(part3); } br.close(); } catch (IOException e){ System.out.println("File Read Error"); } } }

Text file:

2-0-2N3-0-2N4-0-2N4-1-2N5-0-2N5-1-2N6-0-2N7-0-2N7-1-2N8-0-2N8-1-2N9-0-2N9-1-2N10-0-2N10-1-2N11-0-2N11-1-2N12-0-2N12-1-2N2-0-3N3-0-3N3-1-3N4-0-3N5-0-3N6-0-3N7-0-3N7-1-3N8-0-3N9-0-3N9-1-3N10-0-3N11-0-3N12-0-3N2-0-4N2-1-4N3-0-4N4-0-4N4-1-4N5-0-4N6-0-4N7-0-4N8-0-4N8-1-4N9-0-4N10-0-4N10-1-4N11-0-4N11-1-4N12-0-4N2-0-5N2-1-5N3-0-5N3-1-5N4-0-5N4-1-5N5-0-5N6-0-5N7-0-5N8-0-5N8-1-5N9-0-5N10-0-5N11-0-5N11-1-5N12-0-5N12-1-5N2-0-6N2-1-6N3-0-6N3-1-6N4-0-6N4-1-6N5-0-6N6-0-6N6-1-6N7-0-6N7-1-6N8-0-6N9-0-6N10-0-6N10-1-6N11-0-6N12-0-6N12-1-6N2-0-7N3-0-7N3-1-7N4-0-7N4-1-7N5-0-7N6-0-7N7-0-7N7-1-7N8-0-7N8-1-7N9-0-7N9-1-7N10-0-7N10-1-7N11-0-7N12-0-7N12-1-7N2-0-8N3-0-8N3-1-8N4-0-8N5-0-8N5-1-8N6-0-8N6-1-8N7-0-8N7-1-8N8-0-8N8-1-8N9-0-8N9-1-8N10-0-8N11-0-8N11-1-8N12-0-8N2-0-9N2-1-9N3-0-9N3-1-9N4-0-9N4-1-9N5-0-9N5-1-9N6-0-9N6-1-9N7-0-9N8-0-9N9-0-9N10-0-9N11-0-9N11-1-9N12-0-9N12-1-9N2-0-10N3-0-10N4-0-10N4-1-10N5-0-10N6-0-10N6-1-10N7-0-10N8-0-10N8-1-10N9-0-10N10-0-10N10-1-10N11-0-10N11-1-10N12-0-10N12-1-10N2-0-11N2-1-11N3-0-11N3-1-11N4-0-11N4-1-11N5-0-11N6-0-11N6-1-11N7-0-11N7-1-11N8-0-11N9-0-11N9-1-11N10-0-11N11-0-11N12-0-11N