/** called when a key is pressed */ public void keyPressed() { if (screenSelected == OptionsScreenEnum.worldMaker) { if (key == BACKSPACE) { if (TextBoxRegistry.worldNamer.input.length() > 0) TextBoxRegistry.worldNamer.input = TextBoxRegistry.worldNamer.input.substring( 0, TextBoxRegistry.worldNamer.input.length() - 1); } else if (GeneralHelper.isCharInput(key, keyCode)) TextBoxRegistry.worldNamer.input = TextBoxRegistry.worldNamer.input + key; return; } else if (screenSelected == OptionsScreenEnum.noScreen) { if (key == ' ' && ground) player.setYvelocity(MainReference.JUMP_AMOUNT * MainReference.FRAME_RATE); if (key == 'a') player.left = true; if (key == 'd') player.right = true; if (key == 'w' && isFlyMode) player.up = true; if (key == 's' && isFlyMode) player.down = true; if (key == ENTER) { player.setX(mouseX); player.setY(mouseY); } if (key == 'r' && !World.isBlockLocationOpen(mouseX / 16, (height - mouseY) / 16)) { WorldBlock block = World.getBlock(mouseX / 16, (height - mouseY) / 16); if (block != null) { selectedBlockID = block.getBlock().blockID; selectedBlock = block.getBlock(); } } if (key == ESC) setOptionsScreen(OptionsScreenEnum.mainPause); } else if (screenSelected == OptionsScreenEnum.mainPause) { if (key == ESC) clearOptionsScreen(); } if (key == ESC) { key = 0; return; } }