@SubscribeEvent public void onClientTick(ClientTickEvent event) { if (event.phase != Phase.END) return; switch (type) { case KH_POSTCAPTCHA0: type = 0; mc.displayGuiScreen(new VLHGuiPostCaptcha0(VioletLiveHelper.poster, captcha)); break; case KH_POSTCAPTCHA4: type = 0; mc.displayGuiScreen(new VLHGuiPostCaptcha4(VioletLiveHelper.poster, captcha)); break; } }
public void respawn(boolean flag, int i) { if (!theWorld.multiplayerWorld && !theWorld.worldProvider.canRespawnHere()) { usePortal(); } ChunkCoordinates chunkcoordinates = null; ChunkCoordinates chunkcoordinates1 = null; boolean flag1 = true; if (thePlayer != null && !flag) { chunkcoordinates = thePlayer.getPlayerSpawnCoordinate(); if (chunkcoordinates != null) { chunkcoordinates1 = EntityPlayer.func_25060_a(theWorld, chunkcoordinates); if (chunkcoordinates1 == null) { thePlayer.addChatMessage("tile.bed.notValid"); } } } if (chunkcoordinates1 == null) { chunkcoordinates1 = theWorld.getSpawnPoint(); flag1 = false; } net.minecraft.src.IChunkProvider ichunkprovider = theWorld.getIChunkProvider(); if (ichunkprovider instanceof ChunkProviderLoadOrGenerate) { ChunkProviderLoadOrGenerate chunkproviderloadorgenerate = (ChunkProviderLoadOrGenerate) ichunkprovider; chunkproviderloadorgenerate.setCurrentChunkOver( chunkcoordinates1.x >> 4, chunkcoordinates1.z >> 4); } theWorld.setSpawnLocation(); theWorld.updateEntityList(); int j = 0; if (thePlayer != null) { j = thePlayer.entityId; theWorld.setEntityDead(thePlayer); } renderViewEntity = null; thePlayer = (EntityPlayerSP) playerController.createPlayer(theWorld); thePlayer.dimension = i; renderViewEntity = thePlayer; thePlayer.preparePlayerToSpawn(); if (flag1) { thePlayer.setPlayerSpawnCoordinate(chunkcoordinates); thePlayer.setLocationAndAngles( (float) chunkcoordinates1.x + 0.5F, (float) chunkcoordinates1.y + 0.1F, (float) chunkcoordinates1.z + 0.5F, 0.0F, 0.0F); } playerController.flipPlayer(thePlayer); theWorld.spawnPlayerWithLoadedChunks(thePlayer); thePlayer.movementInput = new MovementInputFromOptions(gameSettings); thePlayer.entityId = j; thePlayer.func_6420_o(); playerController.func_6473_b(thePlayer); func_6255_d("Respawning"); if (currentScreen instanceof GuiGameOver) { displayGuiScreen(null); } }
public void displayInGameMenu() { if (currentScreen != null) { return; } else { displayGuiScreen(new GuiIngameMenu()); return; } }
/** Hide current screen and show parent screen. */ public static void back() { if (GuiModScreen.currentScreen != null) { Minecraft m = ModSettings.getMcinst(); m.displayGuiScreen(GuiModScreen.currentScreen.parentScreen); if (GuiModScreen.currentScreen.parentScreen instanceof GuiModScreen) { GuiModScreen.currentScreen = (GuiModScreen) GuiModScreen.currentScreen.parentScreen; GuiModScreen.currentScreen.setActive(); } else { GuiModScreen.currentScreen = null; } } }
@Override public boolean mouseReleased(Minecraft mc, int cursorX, int cursorY, int button) { if (button == 0) { if (textText.visibility < 1) { textText.visibility = 1; } else { mc.displayGuiScreen(null); mc.setIngameFocus(); } } return super.mouseReleased(mc, cursorX, cursorY, button); }
@SubscribeEvent public void onKeyInput(KeyInputEvent event) throws Throwable { if (mc.inGameHasFocus) { if (keyScreenPost.getIsKeyPressed()) { try { BufferedImage screenshot = VioletLiveHelper.saveScreenShot(); if (VioletLiveHelper.poster.isCanPost()) { if (VioletLiveHelper.poster instanceof VLHTiebaPoster) mc.displayGuiScreen(new VLHGuiPostTieba(VioletLiveHelper.poster, screenshot)); } else { VioletLiveHelper.printMessage("vlh.message.postthread.notconfig"); VLHImageUtil.setClipboardImage(screenshot); } } catch (Throwable e) { logger.warn("Couldn\'t save screenshot", e); } } if (keyOptions.getIsKeyPressed()) { mc.displayGuiScreen(new VLHGuiOptions(VioletLiveHelper.poster)); } } }
@SubscribeEvent public void checkGuiInstance(TickEvent.RenderTickEvent e) { if ((mc.currentScreen == null) && (mc.inGameHasFocus)) replaceGUI = true; else if (replaceGUI) { if (mc.currentScreen != null && !(mc.currentScreen instanceof SAOScreenGUI)) { if (REPLACE_GUI_DELAY > 0) REPLACE_GUI_DELAY--; else if ((mc.currentScreen instanceof GuiIngameMenu) || ((mc.currentScreen instanceof GuiInventory) && (!SAOOption.DEFAULT_INVENTORY.getValue()))) { final boolean inv = (mc.currentScreen instanceof GuiInventory); mc.currentScreen.mc = mc; if (mc.playerController.isInCreativeMode() && mc.currentScreen instanceof GuiInventory) mc.displayGuiScreen(new GuiContainerCreative(mc.thePlayer)); else try { SAOSound.play(mc, SAOSound.ORB_DROPDOWN); mc.displayGuiScreen( new SAOIngameMenuGUI((GuiInventory) (inv ? mc.currentScreen : null))); replaceGUI = false; } catch (NullPointerException ignored) { } } else if ((mc.currentScreen instanceof GuiGameOver) && (!SAOOption.DEFAULT_DEATH_SCREEN.getValue())) { mc.currentScreen.mc = mc; if (mc.ingameGUI instanceof SAOIngameGUI) { try { mc.displayGuiScreen(null); mc.displayGuiScreen(new SAODeathGUI((GuiGameOver) mc.currentScreen)); replaceGUI = false; } catch (NullPointerException ignored) { } } } } } }
@Override public void processCommand(ICommandSender icommandsender, String[] astring) { player = (EntityPlayer) icommandsender; guiLink gui = new guiLink(player); // player.openGui(ModMCCapes.instance, 1, player.worldObj,(int) player.posX,(int) // player.posY,(int) player.posZ); // FMLNetworkHandler.openGui(player,ModMCCapes.instance, 1, player.worldObj,(int) // player.posX,(int) player.posY,(int) player.posZ); // FMLClientHandler.instance().displayGuiScreen(player, gui); Minecraft mc = Minecraft.getMinecraft(); mc.displayGuiScreen(gui); }
public void setIngameFocus() { if (!Display.isActive()) { return; } if (inGameHasFocus) { return; } else { inGameHasFocus = true; mouseHelper.grabMouseCursor(); displayGuiScreen(null); leftClickCounter = 10000; mouseTicksRan = ticksRan + 10000; return; } }
@Override public EnumBehaviorState tick() { PlayerAI playerAI = (PlayerAI) this.getBlackboard().getAgent().getActor(); EntityPlayer player = playerAI.bridgePlayer.getPlayer(); Minecraft mc = Minecraft.getMinecraft(); if (mc.currentScreen == null) { // if (mc.theWorld.getTotalWorldTime() % 5 == 0) { mc.displayGuiScreen(new GuiChat("")); Minecraft.getMinecraft().gameSettings.pauseOnLostFocus = false; // } } return super.tick(); }
public void onTickInGui(float data) throws Exception { Minecraft mc = MinecraftUtil.getClient(); if (mc.currentScreen != null && mc.currentScreen.getClass() == GuiCreateWorld.class) { Field field = null; if (true) { field = mc.currentScreen.getClass().getDeclaredField("parentGuiScreen"); } // else // { // field = mc.currentScreen.getClass().getDeclaredField("field_73924_a");//field_73924_a - // b // } field.setAccessible(true); mc.displayGuiScreen( new MWGuiCreateWorld( (GuiScreen) field.get(mc.currentScreen), (GuiCreateWorld) mc.currentScreen)); } }
@Override @SideOnly(Side.CLIENT) public boolean onBlockActivated( World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) { this.location = new V3((double) i, (double) j, (double) k, entityplayer.dimension); world.playSoundEffect(i, j, k, "ashjacksimukraftreloaded:computer", 1f, 1f); GuiMarker ui = new GuiMarker(this.location, entityplayer); Minecraft mc = Minecraft.getMinecraft(); mc.displayGuiScreen(ui); return true; }
@SubscribeEvent public void tickEnd(TickEvent event) { if (event.phase == TickEvent.Phase.END) { Minecraft mc = ClientHelper.minecraft(); if (mc.currentScreen != null && mc.currentScreen instanceof GuiResearchRecipe && !(mc.currentScreen instanceof GuiResearchPeripheral)) { ResearchItem research = ReflectionHelper.getPrivateValue( GuiResearchRecipe.class, (GuiResearchRecipe) mc.currentScreen, 9); if (research.key.equals(LibResearch.KEY_PERIPHERALS) || research.key.equals(LibResearch.KEY_GOLEMCONNECTOR)) mc.displayGuiScreen(new GuiResearchPeripheral(research)); } ToolModeHUDHandler.clientTick(); ++elapsedTicks; } }
/** * Show a screen - GuiModScreen version. Show an instance of GuiModScreen - Does not set the * parent screen, you have to deal with that yourself! * * @param screen GuiModScreen instance or subclass to show with parent screen already set to * current screen. */ public static void show(GuiModScreen screen) { Minecraft m = ModSettings.getMcinst(); m.displayGuiScreen(screen); screen.setActive(); }
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(); } }
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 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(); }