public static void main(String[] args) { System.out.print("Enter infix: "); String infix = Keyboard.readString(); String result = generatePostfix(infix); System.out.println(result); }
public void drawScreen(int par1, int par2, float par3) { super.drawScreen(par1, par2, par3); boolean op = false; // TODO: Check if player is OP if (Keyboard.isKeyDown(Keyboard.KEY_O) && op) { player.openGui(ModUncrafting.instance, 1, worldObj, x, y, z); } }
public void shutdownMinecraftApplet() { try { statFileWriter.func_27175_b(); statFileWriter.syncStats(); if (mcApplet != null) { mcApplet.clearApplet(); } try { if (downloadResourcesThread != null) { downloadResourcesThread.closeMinecraft(); } } catch (Exception exception) { } System.out.println("Stopping!"); try { changeWorld1(null); } catch (Throwable throwable) { } try { GLAllocation.deleteTexturesAndDisplayLists(); } catch (Throwable throwable1) { } sndManager.closeMinecraft(); Mouse.destroy(); Keyboard.destroy(); } finally { Display.destroy(); if (!hasCrashed) { System.exit(0); } } System.gc(); }
private Keyboard createKeyboard() { Button[] letters = { (Button) getActivity().findViewById(R.id.A), (Button) getActivity().findViewById(R.id.B), (Button) getActivity().findViewById(R.id.C), (Button) getActivity().findViewById(R.id.D), (Button) getActivity().findViewById(R.id.E), (Button) getActivity().findViewById(R.id.F), (Button) getActivity().findViewById(R.id.G), (Button) getActivity().findViewById(R.id.H), (Button) getActivity().findViewById(R.id.I), (Button) getActivity().findViewById(R.id.J), (Button) getActivity().findViewById(R.id.K), (Button) getActivity().findViewById(R.id.L), (Button) getActivity().findViewById(R.id.M), (Button) getActivity().findViewById(R.id.N), (Button) getActivity().findViewById(R.id.O), (Button) getActivity().findViewById(R.id.P), (Button) getActivity().findViewById(R.id.Q), (Button) getActivity().findViewById(R.id.R), (Button) getActivity().findViewById(R.id.S), (Button) getActivity().findViewById(R.id.T), (Button) getActivity().findViewById(R.id.U), (Button) getActivity().findViewById(R.id.V), (Button) getActivity().findViewById(R.id.W), (Button) getActivity().findViewById(R.id.X), (Button) getActivity().findViewById(R.id.Y), (Button) getActivity().findViewById(R.id.Z) }; ImageButton back = (ImageButton) getActivity().findViewById(R.id.backspace); ImageButton guess = (ImageButton) getActivity().findViewById(R.id.guess); Keyboard keyboard = new Keyboard(getActivity().getBaseContext()); for (int i = 0; i < letters.length; i++) keyboard.registerLetterKey(letters[i], (char) (i + 65)); keyboard.registerBackspaceKey(back); keyboard.registerGuessKey(guess); keyboard.addKeyboardListener(this); onKeyboardHide(); return keyboard; }
private void screenshotListener() { if (Keyboard.isKeyDown(60)) { if (!isTakingScreenshot) { isTakingScreenshot = true; ingameGUI.addChatMessage( ScreenShotHelper.saveScreenshot(minecraftDir, displayWidth, displayHeight)); } } else { isTakingScreenshot = false; } }
/** Processes all that has to be repeated in the game loop. */ protected void process() { // get user inputs Keyboard.captureState(); Mouse.captureState(); // update game state update(gameTime); // render graphics Screen.getInstance().render(); }
//关键字string拼写错误,其中s应该大写 public static void main(string[]args){ //j变量没有定义 j=Keyboard.readInt(); if(j>0) System.out.println("j is greater than zero"); else if(j<0) System.out.println("j is equals to zero"); else //遗漏了分号";" System.out.println("j is less than zero") int x=120/j; System.out.println(x); }
@Test public void test_keyboard_usage() { when(evaluator.componentType(id)).thenReturn(TextField); TextField textField = new TextField(evaluator, id); when(evaluator.maxLength(textField)).thenReturn(255); when(evaluator.label(textField)).thenReturn("label"); when(evaluator.value(textField)).thenReturn("value"); type("Some Data", on(textField)); Keyboard.type("Other Data"); Keyboard.keyDown(KeyModifier.SHIFT); Keyboard.release(KeyModifier.CONTROL); Keyboard.press(Key.F6); Keyboard.release(); verify(evaluator, atLeastOnce()).focusOn(textField); verify(evaluator, times(1)).type("Some Data"); verify(evaluator, times(1)).type("Other Data"); verify(evaluator, times(1)).keyDown(KeyModifier.SHIFT); verify(evaluator, times(1)).release(KeyModifier.CONTROL); verify(evaluator, times(1)).press(Key.F6); verify(evaluator, times(1)).release(); }
public void sendKeyUpdate() { int keyState = (this.altKey.pressed ? 1 : 0) << 0 | (this.boostKey.pressed ? 1 : 0) << 1 | (this.mc.gameSettings.keyBindForward.pressed ? 1 : 0) << 2 | (this.modeSwitchKey.pressed ? 1 : 0) << 3 | (this.mc.gameSettings.keyBindJump.pressed ? 1 : 0) << 4 | (this.sideinventoryKey.pressed ? 1 : 0) << 5; if (keyState != this.lastKeyState) { System.out.println(keyState); PE.network.keyUpdate(keyState); super.processKeyUpdate(PE.platform.getPlayerInstance(), keyState); this.lastKeyState = keyState; } }
@Test public void textfield_usage_through_language_part1() { when(evaluator.componentType(id)).thenReturn(TextField); TextField textField = new TextField(evaluator, id); when(evaluator.label(textField)).thenReturn("myLabel"); when(evaluator.value(textField)).thenReturn("myValue"); assertThat(textField, has(label("myLabel"))); assertThat(textField, has(value("myValue"))); clickOn(textField); Keyboard.type("SomeData"); verify(evaluator, times(1)).click(textField, Click.left); verify(evaluator, times(1)).type("SomeData"); }
public void keyReleased(KeyEvent event) { keyboard.keyReleased(event); }
public void keyPressed(KeyEvent event) { keyboard.keyPressed(event); }
public void focusLost(FocusEvent evt) { keyboard.reset(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); use25fps = Build.DEVICE.equals("bravo"); // Log.d("Build", "Its a " + Build.DEVICE); Analytics.trackPageView(getApplicationContext(), "/start"); setContentView(R.layout.activity_beebdroid); setAdVisibility(); DPI_MULT = getResources().getDisplayMetrics().density; DP_SCREEN_WIDTH = getResources().getDisplayMetrics().widthPixels; // Detect the Xperia Play, for which we do special magic if (Build.DEVICE.equalsIgnoreCase("R800i") || Build.DEVICE.equalsIgnoreCase("zeus")) { isXperiaPlay = true; } // Find UI bits and wire things up beebView = (BeebView) findViewById(R.id.beeb); keyboard = (Keyboard) findViewById(R.id.keyboard); keyboard.beebdroid = this; controller = (ControllerView) findViewById(R.id.controller); controller.beebdroid = this; // See if we're a previous instance of the same activity, or a totally fresh one Beebdroid prev = (Beebdroid) getLastNonConfigurationInstance(); if (prev == null) { InstalledDisks.load(this); audiobuff = new byte[2000 * 2]; audio = new AudioTrack( AudioManager.STREAM_MUSIC, 31250, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, 16384, AudioTrack.MODE_STREAM); model = new Model(); model.loadRoms(this, Model.SupportedModels[1]); bbcInit(model.mem, model.roms, audiobuff, 1); currentController = Controllers.DEFAULT_CONTROLLER; if (UserPrefs.shouldShowSplashScreen(this)) { startActivity(new Intent(Beebdroid.this, AboutActivity.class)); } processDiskViaIntent(); } else { model = prev.model; audio = prev.audio; audiobuff = prev.audiobuff; diskInfo = prev.diskInfo; last_trigger = prev.last_trigger; keyboardTextWait = prev.keyboardTextWait; keyboardTextEvents = prev.keyboardTextEvents; keyboardShowing = prev.keyboardShowing; currentController = prev.currentController; bbcInit(model.mem, model.roms, audiobuff, 0); } setController(currentController); showKeyboard(keyboardShowing); // Wire up the white buttons final ImageView btnInput = (ImageView) findViewById(R.id.btnInput); if (btnInput != null) { btnInput.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { toggleKeyboard(); } }); } tvFps = (TextView) findViewById(R.id.fps); beebView.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { bbcKeyEvent(BeebKeys.BBCKEY_CTRL, 0, 1); bbcKeyEvent(BeebKeys.BBCKEY_SPACE, 0, 1); handler.postDelayed( new Runnable() { @Override public void run() { bbcKeyEvent(BeebKeys.BBCKEY_CTRL, 0, 0); bbcKeyEvent(BeebKeys.BBCKEY_SPACE, 0, 0); } }, 50); hintActioned("hint_space_to_start"); } }); UserPrefs.setGrandfatheredIn(this, true); }
public void startGame() throws LWJGLException { if (mcCanvas != null) { Graphics g = mcCanvas.getGraphics(); if (g != null) { g.setColor(Color.BLACK); g.fillRect(0, 0, displayWidth, displayHeight); g.dispose(); } Display.setParent(mcCanvas); } else if (fullscreen) { Display.setFullscreen(true); displayWidth = Display.getDisplayMode().getWidth(); displayHeight = Display.getDisplayMode().getHeight(); if (displayWidth <= 0) { displayWidth = 1; } if (displayHeight <= 0) { displayHeight = 1; } } else { Display.setDisplayMode(new DisplayMode(displayWidth, displayHeight)); } Display.setTitle("Minecraft Minecraft Beta 1.7.3"); try { Display.create(); } catch (LWJGLException lwjglexception) { lwjglexception.printStackTrace(); try { Thread.sleep(1000L); } catch (InterruptedException interruptedexception) { } Display.create(); } mcDataDir = getMinecraftDir(); saveLoader = new SaveConverterMcRegion(new File(mcDataDir, "saves")); gameSettings = new GameSettings(this, mcDataDir); texturePackList = new TexturePackList(this, mcDataDir); renderEngine = new RenderEngine(texturePackList, gameSettings); fontRenderer = new FontRenderer(gameSettings, "/font/default.png", renderEngine); ColorizerWater.func_28182_a(renderEngine.func_28149_a("/misc/watercolor.png")); ColorizerGrass.func_28181_a(renderEngine.func_28149_a("/misc/grasscolor.png")); ColorizerFoliage.func_28152_a(renderEngine.func_28149_a("/misc/foliagecolor.png")); entityRenderer = new EntityRenderer(this); RenderManager.instance.itemRenderer = new ItemRenderer(this); statFileWriter = new StatFileWriter(session, mcDataDir); AchievementList.openInventory.setStatStringFormatter(new StatStringFormatKeyInv(this)); loadScreen(); Keyboard.create(); Mouse.create(); mouseHelper = new MouseHelper(mcCanvas); try { Controllers.create(); } catch (Exception exception) { exception.printStackTrace(); } checkGLError("Pre startup"); GL11.glEnable(3553 /*GL_TEXTURE_2D*/); GL11.glShadeModel(7425 /*GL_SMOOTH*/); GL11.glClearDepth(1.0D); GL11.glEnable(2929 /*GL_DEPTH_TEST*/); GL11.glDepthFunc(515); GL11.glEnable(3008 /*GL_ALPHA_TEST*/); GL11.glAlphaFunc(516, 0.1F); GL11.glCullFace(1029 /*GL_BACK*/); GL11.glMatrixMode(5889 /*GL_PROJECTION*/); GL11.glLoadIdentity(); GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/); checkGLError("Startup"); glCapabilities = new OpenGlCapsChecker(); sndManager.loadSoundSettings(gameSettings); renderEngine.registerTextureFX(textureLavaFX); renderEngine.registerTextureFX(textureWaterFX); renderEngine.registerTextureFX(new TexturePortalFX()); renderEngine.registerTextureFX(new TextureCompassFX(this)); renderEngine.registerTextureFX(new TextureWatchFX(this)); renderEngine.registerTextureFX(new TextureWaterFlowFX()); renderEngine.registerTextureFX(new TextureLavaFlowFX()); renderEngine.registerTextureFX(new TextureFlamesFX(0)); renderEngine.registerTextureFX(new TextureFlamesFX(1)); renderGlobal = new RenderGlobal(this, renderEngine); GL11.glViewport(0, 0, displayWidth, displayHeight); effectRenderer = new EffectRenderer(theWorld, renderEngine); try { downloadResourcesThread = new ThreadDownloadResources(mcDataDir, this); downloadResourcesThread.start(); } catch (Exception exception1) { } checkGLError("Post startup"); ingameGUI = new GuiIngame(this); if (serverName != null) { displayGuiScreen(new GuiConnecting(this, serverName, serverPort)); } else { displayGuiScreen(new GuiMainMenu()); } }
public void run() { running = true; try { startGame(); } catch (Exception exception) { exception.printStackTrace(); onMinecraftCrash(new UnexpectedThrowable("Failed to start game", exception)); return; } try { long l = System.currentTimeMillis(); int i = 0; do { if (!running) { break; } try { if (mcApplet != null && !mcApplet.isActive()) { break; } AxisAlignedBB.clearBoundingBoxPool(); Vec3D.initialize(); if (mcCanvas == null && Display.isCloseRequested()) { shutdown(); } if (isGamePaused && theWorld != null) { float f = timer.renderPartialTicks; timer.updateTimer(); timer.renderPartialTicks = f; } else { timer.updateTimer(); } long l1 = System.nanoTime(); for (int j = 0; j < timer.elapsedTicks; j++) { ticksRan++; try { runTick(); continue; } catch (MinecraftException minecraftexception1) { theWorld = null; } changeWorld1(null); displayGuiScreen(new GuiConflictWarning()); } long l2 = System.nanoTime() - l1; checkGLError("Pre render"); RenderBlocks.fancyGrass = gameSettings.fancyGraphics; sndManager.func_338_a(thePlayer, timer.renderPartialTicks); GL11.glEnable(3553 /*GL_TEXTURE_2D*/); if (theWorld != null) { theWorld.updatingLighting(); } if (!Keyboard.isKeyDown(65)) { Display.update(); } if (thePlayer != null && thePlayer.isEntityInsideOpaqueBlock()) { gameSettings.thirdPersonView = false; } if (!skipRenderWorld) { if (playerController != null) { playerController.setPartialTime(timer.renderPartialTicks); } entityRenderer.updateCameraAndRender(timer.renderPartialTicks); } if (!Display.isActive()) { if (fullscreen) { toggleFullscreen(); } Thread.sleep(10L); } if (gameSettings.showDebugInfo) { displayDebugInfo(l2); } else { prevFrameTime = System.nanoTime(); } guiAchievement.updateAchievementWindow(); Thread.yield(); if (Keyboard.isKeyDown(65)) { Display.update(); } screenshotListener(); if (mcCanvas != null && !fullscreen && (mcCanvas.getWidth() != displayWidth || mcCanvas.getHeight() != displayHeight)) { displayWidth = mcCanvas.getWidth(); displayHeight = mcCanvas.getHeight(); if (displayWidth <= 0) { displayWidth = 1; } if (displayHeight <= 0) { displayHeight = 1; } resize(displayWidth, displayHeight); } checkGLError("Post render"); i++; isGamePaused = !isMultiplayerWorld() && currentScreen != null && currentScreen.doesGuiPauseGame(); while (System.currentTimeMillis() >= l + 1000L) { debug = (new StringBuilder()) .append(i) .append(" fps, ") .append(WorldRenderer.chunksUpdated) .append(" chunk updates") .toString(); WorldRenderer.chunksUpdated = 0; l += 1000L; i = 0; } } catch (MinecraftException minecraftexception) { theWorld = null; changeWorld1(null); displayGuiScreen(new GuiConflictWarning()); } catch (OutOfMemoryError outofmemoryerror) { func_28002_e(); displayGuiScreen(new GuiErrorScreen()); System.gc(); } } while (true); } catch (MinecraftError minecrafterror) { } catch (Throwable throwable) { func_28002_e(); throwable.printStackTrace(); onMinecraftCrash(new UnexpectedThrowable("Unexpected error", throwable)); } finally { shutdownMinecraftApplet(); } }
private void classify(GestureData gestureData) throws Exception { TimeSeries timeSeries = Utils.dataToTimeSeries(gestureData.getValues()); Gesture gesture = Classifier.getInstance().knn(1, timeSeries); System.out.println(gesture); Keyboard.getInstance().type(gesture.getCommand()); }
/** * Do the actual work of the program by looping over it and writing/exceptioning In case you are * looking at this code and thinking "OMG why not just use the CardTerminal methods instead of * catching?": There is a very good reason: javax.smartcardio is buggy as f**k, so on some * platform the `waitForCardPresent` and `waitForCardAbsent` methods will not block, or block * indefinitely under some conditions. Especially in combination with sleeping code, this is a * significant nightmare! Therefore we simply try to read from the card, and handle all * exceptions. In the exception handling, possibly we will reconnect to a terminal, if that is the * best thing to do for stability */ public void run() { if (terminal == null) { System.err.println("No terminal connected!"); return; } try { synchronized (synchronizer) { // Bulkhead feature, ensure we do not fire anything there on the main thread or // executorservice so // prevent those of becoming too busy ExecutorService uglyExecutorHack = Executors.newSingleThreadExecutor(); Callable task = new CardUuidReader(terminal); FutureTask<String> future = new FutureTask<>(task); uglyExecutorHack.execute(future); String uid; // We'll give the card 150ms to respond, or we cancel the request. try { uid = future.get(150, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { future.cancel(true); System.err.println("Did not get an card uid in time, cancelled"); return; } catch (ExecutionException e) { System.err.println("Something went wrong while executing the Callable"); throw e.getCause(); } finally { uglyExecutorHack.shutdownNow(); } // We'll check if this is simply a re-read, if it is, we are not going to type this again if (!isNewCard(uid, oldUid, lastAction)) { return; } // Buzz! Separate thread to allow it to fail if the card is removed by now! new Thread(new SingleBuzz(terminal)).start(); System.out.println("This is a new card! " + uid); lastAction = Instant.now(); // Emulate a keyboard and "type" the uid, followed by a newline keyboard.type(uid + "\n"); i++; oldUid = uid; System.out.println("ready for next card"); System.out.println("Card scan run: " + i); } } catch (Exception e) { // Something went wrong when scanning the card if (e.getMessage().equals(Errors.FAILED_CARD_TRANSACTION) || e.getMessage().equals(Errors.READER_UNAVAILABLE)) { logError(e.getMessage()); return; } // Card is not present while scanning if (e.getMessage().equals(Errors.NO_CARD) || e instanceof CardNotPresentException || e.getMessage().equals(Errors.REMOVED_CARD)) { logError(e.getMessage()); return; } // Could not reliably connect to the reader (this can mean there is simply no card) if (e.getMessage().equals(Errors.NO_CONNECT) || e.getMessage().equals(Errors.CARD_READ_FAILURE)) { logError(e.getMessage()); return; } if (e.getMessage().equals(Errors.EMPTY_CODE)) { logError(e.getMessage()); System.err.println("Empty code was read"); return; } System.err.println("Help something uncatched happened! This should not happen!"); attemptRecovery(e); } catch (Throwable e) { System.err.println("Throwable was thrown!"); attemptRecovery(e); } }
public void focusGained(FocusEvent evt) { keyboard.reset(); }
private int readDestinationFloor() { return Keyboard.readInt(); }
private void handleInput() { while (Keyboard.next()) { if (Keyboard.isRepeatEvent()) { continue; } if (!Keyboard.getEventKeyState()) { continue; } if (Keyboard.getEventKey() == Keyboard.KEY_A) { broadcastController.requestAuthToken(username, password); } else if (Keyboard.getEventKey() == Keyboard.KEY_S) { broadcastController.setStreamInfo(username, "Java Game", "Fun times"); } else if (Keyboard.getEventKey() == Keyboard.KEY_P) { if (broadcastController.getIsPaused()) { broadcastController.resumeBroadcasting(); } else { broadcastController.pauseBroadcasting(); } } else if (Keyboard.getEventKey() == Keyboard.KEY_SPACE) { if (broadcastController.getIsBroadcasting()) { broadcastController.stopBroadcasting(); } else { VideoParams videoParams = broadcastController.getRecommendedVideoParams( Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight(), broadcastFramesPerSecond); videoParams.verticalFlip = true; broadcastController.startBroadcasting(videoParams); } } else if (Keyboard.getEventKey() == Keyboard.KEY_R) { broadcastController.runCommercial(); } else if (Keyboard.getEventKey() == Keyboard.KEY_I) { if (ingestTester != null) { broadcastController.cancelIngestTest(); ingestTester = null; } else { ingestTester = broadcastController.startIngestTest(); ingestTester.setListener(this); } } else if (Keyboard.getEventKey() == Keyboard.KEY_G) { broadcastController.requestGameNameList("final"); } else if (Keyboard.getEventKey() == Keyboard.KEY_1) { broadcastController.sendActionMetaData( "TestAction", broadcastController.getCurrentBroadcastTime(), "Something cool happened", "{ \"MyValue\" : \"42\" }"); } else if (Keyboard.getEventKey() == Keyboard.KEY_2) { if (metaDataSpanSequenceId == -1) { metaDataSpanSequenceId = broadcastController.startSpanMetaData( "TestSpan", broadcastController.getCurrentBroadcastTime(), "Something cool just started happening", "{ \"MyValue\" : \"42\" }"); } else { broadcastController.endSpanMetaData( "TestSpan", broadcastController.getCurrentBroadcastTime(), metaDataSpanSequenceId, "Something cool just stopped happening", "{ \"MyValue\" : \"42\" }"); metaDataSpanSequenceId = -1; } } else if (Keyboard.getEventKey() == Keyboard.KEY_C) { if (chatController != null) { if (chatController.getIsConnected()) { chatController.disconnect(); } else { chatController.connect(username); } } } else if (Keyboard.getEventKey() == Keyboard.KEY_V) { if (chatController != null) { if (chatController.getIsConnected()) { chatController.disconnect(); } else { chatController.connectAnonymous(username); } } } else if (Keyboard.getEventKey() == Keyboard.KEY_M) { if (chatController != null) { if (chatController.getIsConnected()) { chatController.sendChatMessage("Test chat message: " + System.currentTimeMillis()); } } } } }
public void runTick() { if (ticksRan == 6000) { func_28001_B(); } statFileWriter.func_27178_d(); ingameGUI.updateTick(); entityRenderer.getMouseOver(1.0F); if (thePlayer != null) { net.minecraft.src.IChunkProvider ichunkprovider = theWorld.getIChunkProvider(); if (ichunkprovider instanceof ChunkProviderLoadOrGenerate) { ChunkProviderLoadOrGenerate chunkproviderloadorgenerate = (ChunkProviderLoadOrGenerate) ichunkprovider; int j = MathHelper.floor_float((int) thePlayer.posX) >> 4; int i1 = MathHelper.floor_float((int) thePlayer.posZ) >> 4; chunkproviderloadorgenerate.setCurrentChunkOver(j, i1); } } if (!isGamePaused && theWorld != null) { playerController.updateController(); } GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, renderEngine.getTexture("/terrain.png")); if (!isGamePaused) { renderEngine.updateDynamicTextures(); } if (currentScreen == null && thePlayer != null) { if (thePlayer.health <= 0) { displayGuiScreen(null); } else if (thePlayer.isPlayerSleeping() && theWorld != null && theWorld.multiplayerWorld) { displayGuiScreen(new GuiSleepMP()); } } else if (currentScreen != null && (currentScreen instanceof GuiSleepMP) && !thePlayer.isPlayerSleeping()) { displayGuiScreen(null); } if (currentScreen != null) { leftClickCounter = 10000; mouseTicksRan = ticksRan + 10000; } if (currentScreen != null) { currentScreen.handleInput(); if (currentScreen != null) { currentScreen.field_25091_h.func_25088_a(); currentScreen.updateScreen(); } } if (currentScreen == null || currentScreen.field_948_f) { do { if (!Mouse.next()) { break; } long l = System.currentTimeMillis() - systemTime; if (l <= 200L) { int k = Mouse.getEventDWheel(); if (k != 0) { thePlayer.inventory.changeCurrentItem(k); if (gameSettings.field_22275_C) { if (k > 0) { k = 1; } if (k < 0) { k = -1; } gameSettings.field_22272_F += (float) k * 0.25F; } } if (currentScreen == null) { if (!inGameHasFocus && Mouse.getEventButtonState()) { setIngameFocus(); } else { if (Mouse.getEventButton() == 0 && Mouse.getEventButtonState()) { clickMouse(0); mouseTicksRan = ticksRan; } if (Mouse.getEventButton() == 1 && Mouse.getEventButtonState()) { clickMouse(1); mouseTicksRan = ticksRan; } if (Mouse.getEventButton() == 2 && Mouse.getEventButtonState()) { clickMiddleMouseButton(); } } } else if (currentScreen != null) { currentScreen.handleMouseInput(); } } } while (true); if (leftClickCounter > 0) { leftClickCounter--; } do { if (!Keyboard.next()) { break; } thePlayer.handleKeyPress(Keyboard.getEventKey(), Keyboard.getEventKeyState()); if (Keyboard.getEventKeyState()) { if (Keyboard.getEventKey() == 87) { toggleFullscreen(); } else { if (currentScreen != null) { currentScreen.handleKeyboardInput(); } else { if (Keyboard.getEventKey() == 1) { displayInGameMenu(); } if (Keyboard.getEventKey() == 31 && Keyboard.isKeyDown(61)) { forceReload(); } if (Keyboard.getEventKey() == 59) { gameSettings.hideGUI = !gameSettings.hideGUI; } if (Keyboard.getEventKey() == 61) { gameSettings.showDebugInfo = !gameSettings.showDebugInfo; } if (Keyboard.getEventKey() == 63) { gameSettings.thirdPersonView = !gameSettings.thirdPersonView; } if (Keyboard.getEventKey() == 66) { gameSettings.smoothCamera = !gameSettings.smoothCamera; } if (Keyboard.getEventKey() == gameSettings.keyBindInventory.keyCode) { displayGuiScreen(new GuiInventory(thePlayer)); } if (Keyboard.getEventKey() == gameSettings.keyBindDrop.keyCode) { thePlayer.dropCurrentItem(); } if (isMultiplayerWorld() && Keyboard.getEventKey() == gameSettings.keyBindChat.keyCode) { displayGuiScreen(new GuiChat()); } } for (int i = 0; i < 9; i++) { if (Keyboard.getEventKey() == 2 + i) { thePlayer.inventory.currentItem = i; } } if (Keyboard.getEventKey() == gameSettings.keyBindToggleFog.keyCode) { gameSettings.setOptionValue( EnumOptions.RENDER_DISTANCE, !Keyboard.isKeyDown(42) && !Keyboard.isKeyDown(54) ? 1 : -1); } } } } while (true); if (currentScreen == null) { if (Mouse.isButtonDown(0) && (float) (ticksRan - mouseTicksRan) >= timer.ticksPerSecond / 4F && inGameHasFocus) { clickMouse(0); mouseTicksRan = ticksRan; } if (Mouse.isButtonDown(1) && (float) (ticksRan - mouseTicksRan) >= timer.ticksPerSecond / 4F && inGameHasFocus) { clickMouse(1); mouseTicksRan = ticksRan; } } func_6254_a(0, currentScreen == null && Mouse.isButtonDown(0) && inGameHasFocus); } if (theWorld != null) { if (thePlayer != null) { joinPlayerCounter++; if (joinPlayerCounter == 30) { joinPlayerCounter = 0; theWorld.joinEntityInSurroundings(thePlayer); } } theWorld.difficultySetting = gameSettings.difficulty; if (theWorld.multiplayerWorld) { theWorld.difficultySetting = 3; } if (!isGamePaused) { entityRenderer.updateRenderer(); } if (!isGamePaused) { renderGlobal.updateClouds(); } if (!isGamePaused) { if (theWorld.field_27172_i > 0) { theWorld.field_27172_i--; } theWorld.updateEntities(); } if (!isGamePaused || isMultiplayerWorld()) { theWorld.setAllowedMobSpawns(gameSettings.difficulty > 0, true); theWorld.tick(); } if (!isGamePaused && theWorld != null) { theWorld.randomDisplayUpdates( MathHelper.floor_double(thePlayer.posX), MathHelper.floor_double(thePlayer.posY), MathHelper.floor_double(thePlayer.posZ)); } if (!isGamePaused) { effectRenderer.updateEffects(); } } systemTime = System.currentTimeMillis(); }