Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
  public Tessellator getSubTessellatorImpl(int i) {
    for (int j = 0; j < subTextures.length; j++) {
      int l = subTextures[j];
      if (l == i) {
        Tessellator tessellator1 = subTessellators[j];
        return tessellator1;
      }
    }

    for (int k = 0; k < subTextures.length; k++) {
      int i1 = subTextures[k];
      if (i1 <= 0) {
        Tessellator tessellator2 = subTessellators[k];
        subTextures[k] = i;
        return tessellator2;
      }
    }

    Tessellator tessellator = new Tessellator();
    Tessellator atessellator[] = subTessellators;
    int ai[] = subTextures;
    subTessellators = new Tessellator[atessellator.length + 1];
    subTextures = new int[ai.length + 1];
    System.arraycopy(atessellator, 0, subTessellators, 0, atessellator.length);
    System.arraycopy(ai, 0, subTextures, 0, ai.length);
    subTessellators[atessellator.length] = tessellator;
    subTextures[ai.length] = i;
    Config.dbg(
        (new StringBuilder())
            .append("Allocated subtessellator, count: ")
            .append(subTessellators.length)
            .toString());
    return tessellator;
  }
Ejemplo n.º 3
0
 private void endThisLoop() {
   // FPS meter
   if (time <= System.currentTimeMillis() - 1000) {
     Display.setTitle("Simulating gravity @ " + frameNumber + " FPS"); // Normal
     FPS = frameNumber;
     frameNumber = 0;
     time = System.currentTimeMillis();
   } else {
     frameNumber++;
   }
   Display.update();
   Display.sync(60);
 }
Ejemplo n.º 4
0
 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();
 }
Ejemplo n.º 5
0
 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();
 }
Ejemplo n.º 6
0
  public void run() {
    init();
    engine = new Engine();

    long lastTime = System.nanoTime();
    double delta = 0.0;
    // Amout of nanoseconds in 1/60th of a second
    double ns = 1000000000.0 / 60.0;
    long timer = System.currentTimeMillis();
    int updates = 0;
    int frames = 0;
    while (running) {
      long now = System.nanoTime();
      delta += (now - lastTime) / ns;
      lastTime = now;
      // if delta >= than one then the amount of time >= 1/60th of a second
      if (delta >= 1.0) {
        update();
        updates++;
        delta--;
      }
      render();
      frames++;
      // If a second has passed, we print the stats
      if (System.currentTimeMillis() - timer > 1000) {
        timer += 1000;
        System.out.println(updates + " ups, " + frames + " fps");
        updates = 0;
        frames = 0;
      }
      if (glfwWindowShouldClose(window) == GL_TRUE) running = false;
    }
    engine.CleanUp();
    keyCallback.release();
    sizeCallback.release();
    mouseCallback.release();
    focusCallback.release();
    glfwDestroyWindow(window);
    glfwTerminate();
  }
Ejemplo n.º 7
0
  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;
    }
  }
 public void addPoint(
     System s,
     int x,
     int y,
     int oX,
     int oY,
     float r,
     float red,
     float green,
     float blue,
     double force) {
   Point p = new Point(x, y, oX, oY, r, red, green, blue, force);
   s.addPoint(p);
 }
Ejemplo n.º 9
0
 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;
 }
Ejemplo n.º 10
0
  private void checkInput() {
    if (Mouse.isButtonDown(0)) {
      leftHold(Mouse.getX(), Mouse.getY());
    }
    while (Mouse.next()) {
      if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
        leftClick(Mouse.getX(), Mouse.getY());
      }

      if (Mouse.getEventButtonState() && Mouse.getEventButton() == 1) {
        rightClick();
      }
    }
    while (Keyboard.next()) {
      if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
        System.exit(0);
      }

      if (Keyboard.getEventKey() == Keyboard.KEY_SPACE) {
        if (drawVector) {
          drawVector = false;
        } else {
          drawVector = true;
        }
      }
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
      if (vecSlider.y < 85) {
        vecSlider.y++;
      }
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
      if (vecSlider.x > -90) {
        vecSlider.x--;
      }
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
      if (vecSlider.y > -85) {
        vecSlider.y--;
      }
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
      if (vecSlider.x < 85) {
        vecSlider.x++;
      }
    }
  }
Ejemplo n.º 11
0
 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);
 }
Ejemplo n.º 12
0
 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");
     }
   }
 }
Ejemplo n.º 13
0
 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;
   }
 }
Ejemplo n.º 14
0
  @Override
  public void readPageFromXML(Element element) {
    NodeList nodes = element.getElementsByTagName("tooltype");
    if (nodes != null) type = nodes.item(0).getTextContent();

    nodes = element.getElementsByTagName("recipe");
    if (nodes != null) {
      String recipe = nodes.item(0).getTextContent();
      icons = MantleClientRegistry.getRecipeIcons(recipe);

      if (type.equals("travelmulti")) {
        List<ItemStack[]> stacks = new LinkedList<ItemStack[]>();
        List<String> tools = new LinkedList<String>();
        String[] suffixes = new String[] {"goggles", "vest", "wings", "boots", "glove", "belt"};
        for (String suffix : suffixes) {
          ItemStack[] icons2 =
              MantleClientRegistry.getRecipeIcons(nodes.item(0).getTextContent() + suffix);
          if (icons2 != null) {
            stacks.add(icons2);
            tools.add(suffix);
          }
        }

        iconsMulti = new ItemStack[stacks.size()][];
        toolMulti = new ItemStack[stacks.size()];
        for (int i = 0; i < stacks.size(); i++) {
          iconsMulti[i] = stacks.get(i);
          toolMulti[i] = MantleClientRegistry.getManualIcon("travel" + tools.get(i));
        }

        icons = iconsMulti[0];

        lastUpdate = System.currentTimeMillis();
        counter = 0;
      }
    }
  }
Ejemplo n.º 15
0
  private void initGL(int width, int height) {

    try {
      // DisplayMode mode = new DisplayMode(width,height);
      // DisplayMode mode = Display.getDesktopDisplayMode(); Old code, for not-fullscreen stuff
      Display.setDisplayMode(Display.getDesktopDisplayMode());
      Display.setFullscreen(true);
      Display.create();
      Display.setVSyncEnabled(true);
    } catch (LWJGLException e) {
      System.out.println("Catched an error in intiGL");
      e.printStackTrace();
      System.exit(0);
    }

    // init OpenGL
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, width, 0, height, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
  }
Ejemplo n.º 16
0
  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*/);
  }
Ejemplo n.º 17
0
  public SimpleRenderer(int x, int y) {
    this.width = x;
    this.height = y;
    try {
      Display.setDisplayMode(new DisplayMode(x, y));
      Display.setTitle("Crowd Simulation");
      Display.create();
      Display.setVSyncEnabled(true);
    } catch (LWJGLException e) {
      e.printStackTrace();
    }

    Random r = new Random();

    System s = new System(this.width, this.height - 2, 0.0f, 1.0f);
    for (int i = 0; i < 1200; i++) {

      int xX = r.nextInt(this.width);
      int yY = r.nextInt(this.height);
      int oldX = xX; // + r.nextInt(1) ;
      int oldY = yY; // + r.nextInt(2) + 1;

      double size = r.nextGaussian() * 1.2 + 16;
      addPoint(
          s,
          xX,
          yY,
          oldX,
          oldY,
          (float) size, // r.nextFloat() * 20 + 10,
          1,
          i > 600 ? 0 : 1,
          1,
          i > 600 ? -0.9 : 0.9); // r.nextFloat(), r.nextFloat(), r.nextFloat());

      // addPoint(s, xX, yY, oldX, oldY, (float)size,//r.nextFloat() * 20 + 10,
      //		r.nextFloat(), r.nextFloat(), r.nextFloat(),i>400 ?-r.nextFloat():r.nextFloat());

    }

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, x, y, 0, 1, -1);
    glMatrixMode(GL_MODELVIEW);

    boolean isPressed = false;
    while (!Display.isCloseRequested()) // rendering
    {

      glClear(GL_COLOR_BUFFER_BIT);
      // glClearColor(1.0f,1.0f,1.0f,1.0f);
      if (Mouse.isButtonDown(0)) {

        // isPressed = true;
        /*int xX = Mouse.getX();
        int yY = this.height - Mouse.getY();

        int oldX = xX;// + r.nextInt(4) - 2;
        int oldY = yY;
        double size = r.nextGaussian()*1.2 +14;
        addPoint(s, xX, yY, oldX, oldY,(float)size,// r.nextFloat() * 20 + 10,
        		r.nextFloat(), r.nextFloat(), r.nextFloat(),30);
        */
        s.setDestroying(true);
      }

      if (Mouse.isButtonDown(1)) {

        for (int i = -150; i < 150; i += 10) {

          int xX = Mouse.getX();
          int yY = this.height - Mouse.getY();
          s.applyDirerction(s.searchPoint(xX, yY + i), 10);
        }
      }

      // java.lang.System.out.println("Number of objects: " +s.getListOfPoints().size() +"
      // Destroying? "+ s.isDestroying());
      s.step(3);

      int xX = Mouse.getX();
      int yY = this.height - Mouse.getY();

      for (int i = -150; i < 150; i += 10) {
        Point k = s.searchPoint(xX, yY + i);
        if (k != null) {
          glColor3f(0.0f, 0.0f, 0.0f);
          Point.DrawCircle(k.getX(), k.getY(), k.getRadius() - 2, 20);
        }
      }

      Display.update();
      Display.sync(30);
    }

    Display.destroy();
  }
Ejemplo n.º 18
0
  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();
    }
  }
Ejemplo n.º 19
0
 public void func_991_a(double p_991_1_, double p_991_3_, double p_991_5_) {
   if (autoGrow && field_1498_o >= field_1494_B - 32) {
     Config.dbg(
         (new StringBuilder())
             .append("Expand tessellator buffer, old: ")
             .append(field_1494_B)
             .append(", new: ")
             .append(field_1494_B * 2)
             .toString());
     field_1494_B *= 2;
     int ai[] = new int[field_1494_B];
     System.arraycopy(field_1506_g, 0, ai, 0, field_1506_g.length);
     field_1506_g = ai;
     field_1509_d = GLAllocation.func_1127_b(field_1494_B * 4);
     field_1508_e = field_1509_d.asIntBuffer();
     field_1507_f = field_1509_d.asFloatBuffer();
     field_35836_g = field_1509_d.asShortBuffer();
   }
   field_1497_p++;
   if (field_1493_r == 7 && field_1511_b && field_1497_p % 4 == 0) {
     for (int i = 0; i < 2; i++) {
       int j = 8 * (3 - i);
       if (field_1500_m) {
         field_1506_g[field_1498_o + 3] = field_1506_g[(field_1498_o - j) + 3];
         field_1506_g[field_1498_o + 4] = field_1506_g[(field_1498_o - j) + 4];
       }
       if (field_35838_p) {
         field_1506_g[field_1498_o + 7] = field_1506_g[(field_1498_o - j) + 7];
       }
       if (field_1501_l) {
         field_1506_g[field_1498_o + 5] = field_1506_g[(field_1498_o - j) + 5];
       }
       field_1506_g[field_1498_o + 0] = field_1506_g[(field_1498_o - j) + 0];
       field_1506_g[field_1498_o + 1] = field_1506_g[(field_1498_o - j) + 1];
       field_1506_g[field_1498_o + 2] = field_1506_g[(field_1498_o - j) + 2];
       field_1505_h++;
       field_1498_o += 8;
     }
   }
   if (field_1500_m) {
     field_1506_g[field_1498_o + 3] = Float.floatToRawIntBits((float) field_1504_i);
     field_1506_g[field_1498_o + 4] = Float.floatToRawIntBits((float) field_1503_j);
   }
   if (field_35838_p) {
     field_1506_g[field_1498_o + 7] = field_35837_l;
   }
   if (field_1501_l) {
     field_1506_g[field_1498_o + 5] = field_1502_k;
   }
   if (field_1499_n) {
     field_1506_g[field_1498_o + 6] = field_1489_v;
   }
   field_1506_g[field_1498_o + 0] = Float.floatToRawIntBits((float) (p_991_1_ + field_1492_s));
   field_1506_g[field_1498_o + 1] = Float.floatToRawIntBits((float) (p_991_3_ + field_1491_t));
   field_1506_g[field_1498_o + 2] = Float.floatToRawIntBits((float) (p_991_5_ + field_1490_u));
   field_1498_o += 8;
   field_1505_h++;
   if (!autoGrow && field_1497_p % 4 == 0 && field_1498_o >= field_1494_B - 32) {
     func_982_a();
     field_1488_w = true;
   }
 }
Ejemplo n.º 20
0
 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;
 }
Ejemplo n.º 21
0
 private void endProgram() {
   GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
   System.exit(0);
 }
Ejemplo n.º 22
0
  @Override
  public void renderContentLayer(int localWidth, int localHeight, boolean isTranslatable) {
    String tStation = StatCollector.translateToLocal("manual.page.modifier1");
    if (icons.length > 3) tStation = StatCollector.translateToLocal("manual.page.modifier2");
    if (icons.length > 4) tStation = StatCollector.translateToLocal("manual.page.modifier3");
    if (isTranslatable) tStation = StatCollector.translateToLocal(tStation);
    manual.fonts.drawString("\u00a7n" + tStation, localWidth + 60, localHeight + 4, 0);
    GL11.glScalef(2f, 2f, 2f);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.enableGUIStandardItemLighting();

    ItemStack toolstack = MantleClientRegistry.getManualIcon("ironpick");
    if (type.equals("weapon")) toolstack = MantleClientRegistry.getManualIcon("ironlongsword");
    if (type.equals("travelgoggles"))
      toolstack = MantleClientRegistry.getManualIcon("travelgoggles");
    if (type.equals("travelvest")) toolstack = MantleClientRegistry.getManualIcon("travelvest");
    if (type.equals("travelwings")) toolstack = MantleClientRegistry.getManualIcon("travelwings");
    if (type.equals("travelboots")) toolstack = MantleClientRegistry.getManualIcon("travelboots");
    if (type.equals("travelbelt")) toolstack = MantleClientRegistry.getManualIcon("travelbelt");
    if (type.equals("travelglove")) toolstack = MantleClientRegistry.getManualIcon("travelglove");
    if (type.equals("travelmulti")) toolstack = toolMulti[counter];

    // update displayed item
    if (iconsMulti != null
        && iconsMulti.length > 0
        && type.equals("travelmulti")
        && System.currentTimeMillis() - lastUpdate > 1000) {
      lastUpdate = System.currentTimeMillis();
      counter++;
      if (counter >= iconsMulti.length) counter = 0;
      icons = iconsMulti[counter];
      toolstack = toolMulti[counter];
    }

    manual.renderitem.zLevel = 100;
    if (icons.length < 4) {
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          toolstack,
          (localWidth + 54) / 2,
          (localHeight + 54) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[0],
          (localWidth + 130) / 2,
          (localHeight + 54) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[1],
          (localWidth + 18) / 2,
          (localHeight + 36) / 2);
      if (icons[2] != null)
        manual.renderitem.renderItemAndEffectIntoGUI(
            manual.fonts,
            manual.getMC().renderEngine,
            icons[2],
            (localWidth + 18) / 2,
            (localHeight + 74) / 2);
    } else {
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          toolstack,
          (localWidth + 74) / 2,
          (localHeight + 54) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[0],
          (localWidth + 140) / 2,
          (localHeight + 54) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[1],
          (localWidth - 2) / 2,
          (localHeight + 36) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[2],
          (localWidth - 2) / 2,
          (localHeight + 74) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[3],
          (localWidth + 36) / 2,
          (localHeight + 36) / 2);
      if (icons[4] != null)
        manual.renderitem.renderItemAndEffectIntoGUI(
            manual.fonts,
            manual.getMC().renderEngine,
            icons[4],
            (localWidth + 36) / 2,
            (localHeight + 74) / 2);
    }
    manual.renderitem.zLevel = 0;

    GL11.glScalef(0.5F, 0.5F, 0.5F);
    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
  }
Ejemplo n.º 23
0
  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();
  }