I've got some code written to take a string as input and separate it into multiple strings divided by commas. I've placed tons of outputs to the terminal to figure out where it's stopping and determined it only runs the For loop once, then nothing else happens. The game itself keeps running fine though, just without the tile being added. I can't for the life of me figure out what's going on.
public void addTile(String tileData) { //tileData is "0,0,visible,potato,oranges,green,monadfg,manatee" String tileXst = tileData; tileXst = tileXst.substring(0, tileXst.indexOf(',')); System.out.println("146: " + tileXst); //output "146: 0" String bufLineText = tileData.substring(tileXst.length() + 1); tileData = bufLineText; String tileYst = bufLineText; String working = new String(); if(tileYst.contains(",")) { tileYst = tileYst.substring(0, tileYst.indexOf(',')); bufLineText = tileData.substring(tileYst.length() + 1); working = bufLineText; tileData = working; System.out.println("156: " + working); //output "156: visible,potato,oranges,green,monadfg,manatee" } System.out.println("158: " + tileYst); //output "158: 0" int tileX = Integer.parseInt(tileXst); int tileY = Integer.parseInt(tileYst); List<String> tileInfo = new ArrayList(); System.out.println("For loop begins"); //This is always reached for(int i = 0; i < 50; i++) //50 times max { if(bufLineText.contains(",")) { working = working.substring(0, working.indexOf(',')); System.out.println("181: " + working); //output: "181: visible" tileInfo.add(working); bufLineText = bufLineText.substring(working.length() + 1); } else { System.out.println("for loop break"); //never reached tileInfo.add(bufLineText); break; } System.out.println("for loop: " + i); //output "for loop: 0" //there is no more output, this is where it just dies } System.out.println("for loop finished"); //never reached //Further code is irrelevant, it just adds the tile to the world }