Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.81 KB | None | 0 0
  1. public void run()
  2.     {
  3.         running = true;
  4.         try
  5.         {
  6.             startGame();
  7.         }
  8.         catch(Exception exception)
  9.         {
  10.             exception.printStackTrace();
  11.             displayUnexpectedThrowable(new UnexpectedThrowable("Failed to start game", exception));
  12.             return;
  13.         }
  14.         try
  15.         {
  16.             long l = System.currentTimeMillis();
  17.             int i = 0;
  18.             while(running && (mcApplet == null || mcApplet.isActive()))
  19.             {
  20.                 AxisAlignedBB.clearBoundingBoxPool();
  21.                 Vec3D.initialize();
  22.                 if(mcCanvas == null && Display.isCloseRequested())
  23.                 {
  24.                     shutdown();
  25.                 }
  26.                 if(isWorldLoaded && theWorld != null)
  27.                 {
  28.                     float f = timer.renderPartialTicks;
  29.                     timer.updateTimer();
  30.                     timer.renderPartialTicks = f;
  31.                 } else
  32.                 {
  33.                     timer.updateTimer();
  34.                 }
  35.                 long l1 = System.nanoTime();
  36.                 for(int j = 0; j < timer.elapsedTicks; j++)
  37.                 {
  38.                     ticksRan++;
  39.                     try
  40.                     {
  41.                         runTick();
  42.                         continue;
  43.                     }
  44.                     catch(MinecraftException minecraftexception)
  45.                     {
  46.                         theWorld = null;
  47.                     }
  48.                     changeWorld1(null);
  49.                     displayGuiScreen(new GuiConflictWarning());
  50.                 }
  51.  
  52.                 long l2 = System.nanoTime() - l1;
  53.                 checkGLError("Pre render");
  54.                 sndManager.func_338_a(thePlayer, timer.renderPartialTicks);
  55.                 GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
  56.                 if(theWorld != null && !theWorld.multiplayerWorld)
  57.                 {
  58.                     theWorld.func_6465_g();
  59.                 }
  60.                 if(theWorld != null && theWorld.multiplayerWorld)
  61.                 {
  62.                     theWorld.func_6465_g();
  63.                 }
  64.                 if(gameSettings.limitFramerate)
  65.                 {
  66.                     Thread.sleep(5L);
  67.                 }
  68.                 if(!Keyboard.isKeyDown(65))
  69.                 {
  70.                     Display.update();
  71.                 }
  72.                 if(!field_6307_v)
  73.                 {
  74.                     if(playerController != null)
  75.                     {
  76.                         playerController.setPartialTime(timer.renderPartialTicks);
  77.                     }
  78.                     entityRenderer.func_4136_b(timer.renderPartialTicks);
  79.                 }
  80.                 if(!Display.isActive())
  81.                 {
  82.                     if(fullscreen)
  83.                     {
  84.                         toggleFullscreen();
  85.                     }
  86.                     Thread.sleep(10L);
  87.                 }
  88.                 if(Keyboard.isKeyDown(61))
  89.                 {
  90.                     displayDebugInfo(l2);
  91.                 } else
  92.                 {
  93.                     prevFrameTime = System.nanoTime();
  94.                 }
  95.                 Thread.yield();
  96.                 if(Keyboard.isKeyDown(65))
  97.                 {
  98.                     Display.update();
  99.                 }
  100.                 screenshotListener();
  101.                 if(mcCanvas != null && !fullscreen && (mcCanvas.getWidth() != displayWidth || mcCanvas.getHeight() != displayHeight))
  102.                 {
  103.                     displayWidth = mcCanvas.getWidth();
  104.                     displayHeight = mcCanvas.getHeight();
  105.                     if(displayWidth <= 0)
  106.                     {
  107.                         displayWidth = 1;
  108.                     }
  109.                     if(displayHeight <= 0)
  110.                     {
  111.                         displayHeight = 1;
  112.                     }
  113.                     resize(displayWidth, displayHeight);
  114.                 }
  115.                 checkGLError("Post render");
  116.                 i++;
  117.                 isWorldLoaded = !isMultiplayerWorld() && currentScreen != null && currentScreen.doesGuiPauseGame();
  118.                 while(System.currentTimeMillis() >= l + 1000L)
  119.                 {
  120.                     debug = (new StringBuilder()).append(i).append(" fps, ").append(WorldRenderer.chunksUpdated).append(" chunk updates").toString();
  121.                     WorldRenderer.chunksUpdated = 0;
  122.                     l += 1000L;
  123.                     i = 0;
  124.                 }
  125.             }
  126.         }
  127.         catch(MinecraftError minecrafterror) { }
  128.         catch(Throwable throwable)
  129.         {
  130.             theWorld = null;
  131.             throwable.printStackTrace();
  132.             displayUnexpectedThrowable(new UnexpectedThrowable("Unexpected error", throwable));
  133.         }
  134.         finally { }
  135.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement