コード例 #1
0
ファイル: Minecraft.java プロジェクト: Tartine08/Aelyth-1
 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();
 }
コード例 #2
0
ファイル: Gears.java プロジェクト: RELO4D3D/sdk-dist
  private void submitFrame() {
    if (!broadcastController.getIsBroadcasting() || broadcastController.getIsPaused()) {
      return;
    }

    long curTime = System.nanoTime();
    long nanoPerFrame = 1000000000 / broadcastFramesPerSecond;

    // If you send frames too quickly to the SDK (based on the broadcast FPS you configured) it will
    // not be able
    // to make use of them all.  In that case, it will simply release buffers without using them
    // which means the
    // game wasted time doing the capture.  To mitigate this, the app should pace the captures to
    // the broadcast FPS.
    long captureDelta = curTime - lastCaptureTime;
    boolean isTimeForNextCapture = captureDelta >= nanoPerFrame;

    if (!isTimeForNextCapture) {
      return;
    }

    FrameBuffer buffer = broadcastController.getNextFreeBuffer();
    broadcastController.captureFrameBuffer_ReadPixels(buffer);
    broadcastController.submitFrame(buffer);

    lastCaptureTime = curTime;
  }
コード例 #3
0
ファイル: Minecraft.java プロジェクト: Tartine08/Aelyth-1
 public static void startMainThread(String s, String s1, String s2) {
   boolean flag = false;
   String s3 = s;
   Frame frame = new Frame("Minecraft");
   Canvas canvas = new Canvas();
   frame.setLayout(new BorderLayout());
   frame.add(canvas, "Center");
   canvas.setPreferredSize(new Dimension(854, 480));
   frame.pack();
   frame.setLocationRelativeTo(null);
   MinecraftImpl minecraftimpl = new MinecraftImpl(frame, canvas, null, 854, 480, flag, frame);
   Thread thread = new Thread(minecraftimpl, "Minecraft main thread");
   thread.setPriority(10);
   minecraftimpl.minecraftUri = "www.minecraft.net";
   if (s3 != null && s1 != null) {
     minecraftimpl.session = new Session(s3, s1);
   } else {
     minecraftimpl.session =
         new Session(
             (new StringBuilder())
                 .append("Player")
                 .append(System.currentTimeMillis() % 1000L)
                 .toString(),
             "");
   }
   if (s2 != null) {
     String as[] = s2.split(":");
     minecraftimpl.setServer(as[0], Integer.parseInt(as[1]));
   }
   frame.setVisible(true);
   frame.addWindowListener(new GameWindowListener(minecraftimpl, thread));
   thread.start();
 }
コード例 #4
0
ファイル: Gears.java プロジェクト: RELO4D3D/sdk-dist
  private void loop() {
    long lastFrameTime = 0;

    while (!Display.isCloseRequested()) {
      long now = System.nanoTime();
      long renderFps = 30;
      long nanoPerFrame = 1000000000 / renderFps;

      // update the animation
      if (now - lastFrameTime >= nanoPerFrame) {
        lastFrameTime = now;

        angle += 2.0f;

        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glPushMatrix();
        glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
        glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
        glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);

        glPushMatrix();
        glTranslatef(-3.0f, -2.0f, 0.0f);
        glRotatef(angle, 0.0f, 0.0f, 1.0f);
        glCallList(gear1);
        glPopMatrix();

        glPushMatrix();
        glTranslatef(3.1f, -2.0f, 0.0f);
        glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
        glCallList(gear2);
        glPopMatrix();

        glPushMatrix();
        glTranslatef(-3.1f, 4.2f, 0.0f);
        glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
        glCallList(gear3);
        glPopMatrix();

        glPopMatrix();

        Display.update();
      }

      handleInput();

      if (broadcastController != null) {
        submitFrame();
        broadcastController.update();
      }

      if (chatController != null) {
        chatController.update();
      }
    }
  }
コード例 #5
0
ファイル: Minecraft.java プロジェクト: Tartine08/Aelyth-1
 public void func_28002_e() {
   try {
     field_28006_b = new byte[0];
     renderGlobal.func_28137_f();
   } catch (Throwable throwable) {
   }
   try {
     System.gc();
     AxisAlignedBB.func_28196_a();
     Vec3D.func_28215_a();
   } catch (Throwable throwable1) {
   }
   try {
     System.gc();
     changeWorld1(null);
   } catch (Throwable throwable2) {
   }
   System.gc();
 }
コード例 #6
0
ファイル: Minecraft.java プロジェクト: Tartine08/Aelyth-1
  public static File getAppDir(String s) {
    String s1 = System.getProperty("user.home", ".");
    File file;
    switch (EnumOSMappingHelper.enumOSMappingArray[getOs().ordinal()]) {
      case 1: // '\001'
      case 2: // '\002'
        file = new File(s1, (new StringBuilder()).append('.').append(s).append('/').toString());
        break;

      case 3: // '\003'
        String s2 = System.getenv("APPDATA");
        if (s2 != null) {
          file = new File(s2, (new StringBuilder()).append(".").append(s).append('/').toString());
        } else {
          file = new File(s1, (new StringBuilder()).append('.').append(s).append('/').toString());
        }
        break;

      case 4: // '\004'
        file =
            new File(
                s1,
                (new StringBuilder()).append("Library/Application Support/").append(s).toString());
        break;

      default:
        file = new File(s1, (new StringBuilder()).append(s).append('/').toString());
        break;
    }
    if (!file.exists() && !file.mkdirs()) {
      throw new RuntimeException(
          (new StringBuilder())
              .append("The working directory could not be created: ")
              .append(file)
              .toString());
    } else {
      return file;
    }
  }
コード例 #7
0
ファイル: Minecraft.java プロジェクト: Tartine08/Aelyth-1
 public Minecraft(
     Component component,
     Canvas canvas,
     MinecraftApplet minecraftapplet,
     int i,
     int j,
     boolean flag) {
   fullscreen = false;
   hasCrashed = false;
   timer = new Timer(20F);
   session = null;
   hideQuitButton = true;
   isGamePaused = false;
   currentScreen = null;
   loadingScreen = new LoadingScreenRenderer(this);
   ticksRan = 0;
   leftClickCounter = 0;
   guiAchievement = new GuiAchievement(this);
   skipRenderWorld = false;
   field_9242_w = new ModelBiped(0.0F);
   objectMouseOver = null;
   sndManager = new SoundManager();
   textureWaterFX = new TextureWaterFX();
   textureLavaFX = new TextureLavaFX();
   running = true;
   debug = "";
   isTakingScreenshot = false;
   prevFrameTime = -1L;
   inGameHasFocus = false;
   mouseTicksRan = 0;
   isRaining = false;
   systemTime = System.currentTimeMillis();
   joinPlayerCounter = 0;
   StatList.func_27360_a();
   tempDisplayHeight = j;
   fullscreen = flag;
   mcApplet = minecraftapplet;
   new ThreadSleepForever(this, "Timer hack thread");
   mcCanvas = canvas;
   displayWidth = i;
   displayHeight = j;
   fullscreen = flag;
   if (minecraftapplet == null || "true".equals(minecraftapplet.getParameter("stand-alone"))) {
     hideQuitButton = false;
   }
   theMinecraft = this;
 }
コード例 #8
0
ファイル: Minecraft.java プロジェクト: Tartine08/Aelyth-1
 public static void main(String args[]) {
   String s = null;
   String s1 = null;
   s =
       (new StringBuilder())
           .append("Player")
           .append(System.currentTimeMillis() % 1000L)
           .toString();
   if (args.length > 0) {
     s = args[0];
   }
   s1 = "-";
   if (args.length > 1) {
     s1 = args[1];
   }
   func_6269_a(s, s1);
 }
コード例 #9
0
ファイル: Minecraft.java プロジェクト: Tartine08/Aelyth-1
 public void startWorld(String s, String s1, long l) {
   changeWorld1(null);
   System.gc();
   if (saveLoader.isOldMapFormat(s)) {
     convertMapFormat(s, s1);
   } else {
     net.minecraft.src.ISaveHandler isavehandler = saveLoader.getSaveLoader(s, false);
     World world = null;
     world = new World(isavehandler, s1, l);
     if (world.isNewWorld) {
       statFileWriter.readStat(StatList.createWorldStat, 1);
       statFileWriter.readStat(StatList.startGameStat, 1);
       changeWorld2(world, "Generating level");
     } else {
       statFileWriter.readStat(StatList.loadWorldStat, 1);
       statFileWriter.readStat(StatList.startGameStat, 1);
       changeWorld2(world, "Loading level");
     }
   }
 }
コード例 #10
0
ファイル: Minecraft.java プロジェクト: Tartine08/Aelyth-1
 private static EnumOS2 getOs() {
   String s = System.getProperty("os.name").toLowerCase();
   if (s.contains("win")) {
     return EnumOS2.windows;
   }
   if (s.contains("mac")) {
     return EnumOS2.macos;
   }
   if (s.contains("solaris")) {
     return EnumOS2.solaris;
   }
   if (s.contains("sunos")) {
     return EnumOS2.solaris;
   }
   if (s.contains("linux")) {
     return EnumOS2.linux;
   }
   if (s.contains("unix")) {
     return EnumOS2.linux;
   } else {
     return EnumOS2.unknown;
   }
 }
コード例 #11
0
ファイル: Gears.java プロジェクト: RELO4D3D/sdk-dist
  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());
          }
        }
      }
    }
  }
コード例 #12
0
ファイル: Gears.java プロジェクト: RELO4D3D/sdk-dist
 public static void main(String[] args) {
   new Gears().execute();
   System.exit(0);
 }
コード例 #13
0
ファイル: Minecraft.java プロジェクト: Tartine08/Aelyth-1
  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();
  }
コード例 #14
0
ファイル: Minecraft.java プロジェクト: Tartine08/Aelyth-1
  private void displayDebugInfo(long l) {
    long l1 = 0xfe502aL;
    if (prevFrameTime == -1L) {
      prevFrameTime = System.nanoTime();
    }
    long l2 = System.nanoTime();
    tickTimes[numRecordedFrameTimes & frameTimes.length - 1] = l;
    frameTimes[numRecordedFrameTimes++ & frameTimes.length - 1] = l2 - prevFrameTime;
    prevFrameTime = l2;
    GL11.glClear(256);
    GL11.glMatrixMode(5889 /*GL_PROJECTION*/);
    GL11.glLoadIdentity();
    GL11.glOrtho(0.0D, displayWidth, displayHeight, 0.0D, 1000D, 3000D);
    GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/);
    GL11.glLoadIdentity();
    GL11.glTranslatef(0.0F, 0.0F, -2000F);
    GL11.glLineWidth(1.0F);
    GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawing(7);
    int i = (int) (l1 / 0x30d40L);
    tessellator.setColorOpaque_I(0x20000000);
    tessellator.addVertex(0.0D, displayHeight - i, 0.0D);
    tessellator.addVertex(0.0D, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - i, 0.0D);
    tessellator.setColorOpaque_I(0x20200000);
    tessellator.addVertex(0.0D, displayHeight - i * 2, 0.0D);
    tessellator.addVertex(0.0D, displayHeight - i, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - i, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - i * 2, 0.0D);
    tessellator.draw();
    long l3 = 0L;
    for (int j = 0; j < frameTimes.length; j++) {
      l3 += frameTimes[j];
    }

    int k = (int) (l3 / 0x30d40L / (long) frameTimes.length);
    tessellator.startDrawing(7);
    tessellator.setColorOpaque_I(0x20400000);
    tessellator.addVertex(0.0D, displayHeight - k, 0.0D);
    tessellator.addVertex(0.0D, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - k, 0.0D);
    tessellator.draw();
    tessellator.startDrawing(1);
    for (int i1 = 0; i1 < frameTimes.length; i1++) {
      int j1 = ((i1 - numRecordedFrameTimes & frameTimes.length - 1) * 255) / frameTimes.length;
      int k1 = (j1 * j1) / 255;
      k1 = (k1 * k1) / 255;
      int i2 = (k1 * k1) / 255;
      i2 = (i2 * i2) / 255;
      if (frameTimes[i1] > l1) {
        tessellator.setColorOpaque_I(0xff000000 + k1 * 0x10000);
      } else {
        tessellator.setColorOpaque_I(0xff000000 + k1 * 256);
      }
      long l4 = frameTimes[i1] / 0x30d40L;
      long l5 = tickTimes[i1] / 0x30d40L;
      tessellator.addVertex((float) i1 + 0.5F, (float) ((long) displayHeight - l4) + 0.5F, 0.0D);
      tessellator.addVertex((float) i1 + 0.5F, (float) displayHeight + 0.5F, 0.0D);
      tessellator.setColorOpaque_I(0xff000000 + k1 * 0x10000 + k1 * 256 + k1 * 1);
      tessellator.addVertex((float) i1 + 0.5F, (float) ((long) displayHeight - l4) + 0.5F, 0.0D);
      tessellator.addVertex(
          (float) i1 + 0.5F, (float) ((long) displayHeight - (l4 - l5)) + 0.5F, 0.0D);
    }

    tessellator.draw();
    GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
  }
コード例 #15
0
ファイル: Minecraft.java プロジェクト: Tartine08/Aelyth-1
  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();
    }
  }
コード例 #16
0
ファイル: Minecraft.java プロジェクト: Tartine08/Aelyth-1
 public void changeWorld(World world, String s, EntityPlayer entityplayer) {
   statFileWriter.func_27175_b();
   statFileWriter.syncStats();
   renderViewEntity = null;
   loadingScreen.printText(s);
   loadingScreen.displayLoadingString("");
   sndManager.playStreaming(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
   if (theWorld != null) {
     theWorld.saveWorldIndirectly(loadingScreen);
   }
   theWorld = world;
   if (world != null) {
     playerController.func_717_a(world);
     if (!isMultiplayerWorld()) {
       if (entityplayer == null) {
         thePlayer = (EntityPlayerSP) world.func_4085_a(net.minecraft.src.EntityPlayerSP.class);
       }
     } else if (thePlayer != null) {
       thePlayer.preparePlayerToSpawn();
       if (world != null) {
         world.entityJoinedWorld(thePlayer);
       }
     }
     if (!world.multiplayerWorld) {
       func_6255_d(s);
     }
     if (thePlayer == null) {
       thePlayer = (EntityPlayerSP) playerController.createPlayer(world);
       thePlayer.preparePlayerToSpawn();
       playerController.flipPlayer(thePlayer);
     }
     thePlayer.movementInput = new MovementInputFromOptions(gameSettings);
     if (renderGlobal != null) {
       renderGlobal.changeWorld(world);
     }
     if (effectRenderer != null) {
       effectRenderer.clearEffects(world);
     }
     playerController.func_6473_b(thePlayer);
     if (entityplayer != null) {
       world.emptyMethod1();
     }
     net.minecraft.src.IChunkProvider ichunkprovider = world.getIChunkProvider();
     if (ichunkprovider instanceof ChunkProviderLoadOrGenerate) {
       ChunkProviderLoadOrGenerate chunkproviderloadorgenerate =
           (ChunkProviderLoadOrGenerate) ichunkprovider;
       int i = MathHelper.floor_float((int) thePlayer.posX) >> 4;
       int j = MathHelper.floor_float((int) thePlayer.posZ) >> 4;
       chunkproviderloadorgenerate.setCurrentChunkOver(i, j);
     }
     world.spawnPlayerWithLoadedChunks(thePlayer);
     if (world.isNewWorld) {
       world.saveWorldIndirectly(loadingScreen);
     }
     renderViewEntity = thePlayer;
   } else {
     thePlayer = null;
   }
   System.gc();
   systemTime = 0L;
 }