public void transform(ItemRenderType type) {
    if (type == ItemRenderType.EQUIPPED) {
      GL11.glTranslatef(0.5F, 0.5F, 0.5F);
      GL11.glRotatef(185, 1, 0, 0);
      GL11.glRotatef(40, 0, 1, 0);
      GL11.glRotatef(-70, 0, 0, 1);
      GL11.glScalef(3.2F, 3.2F, 3.2F);
    }

    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
      GL11.glScalef(8.2F, 8.2F, 8.2F);
      GL11.glTranslatef(0.291F, -0.15F, 0.1F);
      GL11.glRotatef(180, 0, 0, 1);
    }

    GL11.glScalef(-0.4F, -0.4F, 0.4F);

    if (type == ItemRenderType.INVENTORY || type == ItemRenderType.ENTITY) {
      if (type == ItemRenderType.INVENTORY) {
        GL11.glTranslatef(0.0F, 1.45F, 0.0F);
        GL11.glScalef(2.0F, 2.0F, 2.0F);
        GL11.glRotatef(180, 0, 0, 1);
        GL11.glRotatef(180, 0, 1, 0);
      } else {
        GL11.glRotatef(Sys.getTime() / 90F % 360F, 0F, 1F, 0F);
        GL11.glScalef(2F, -2F, 2F);
      }

      GL11.glScalef(1.3F, 1.3F, 1.3F);
    }
  }
Ejemplo n.º 2
0
 public int getAnimationTime(StateKey state) {
   long curTime = Sys.getTime();
   int idx = getMouseButton(state);
   if (idx >= 0) {
     curTime -= lastTime[idx];
   }
   return (int) curTime & Integer.MAX_VALUE;
 }
Ejemplo n.º 3
0
 public long getTimeMillis() {
   long res = Sys.getTimerResolution();
   long time = Sys.getTime();
   if (res != 1000) {
     time = (time * 1000) / res;
   }
   return time;
 }
Ejemplo n.º 4
0
 @Override
 public void update(float delta) {
   long startTime = 1000 * Sys.getTime() / Sys.getTimerResolution();
   while (current != null && 1000 * Sys.getTime() / Sys.getTimerResolution() - startTime < 20) {
     if (current.step()) {
       popStep();
     }
   }
   if (current == null) {
     nuiManager.popScreen();
     CoreRegistry.get(GameEngine.class).changeState(new StateIngame());
   } else {
     float progressValue =
         (progress + current.getExpectedCost() * current.getProgress()) / maxProgress;
     loadingScreen.updateStatus(current.getMessage(), progressValue);
     nuiManager.update(delta);
   }
 }
  public void transform(ItemStack itemstack, ItemRenderType type) {
    final EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;

    if (type == ItemRenderType.EQUIPPED) {
      GL11.glRotatef(70, 1.0F, 0, 0);
      GL11.glRotatef(-10, 0.0F, 1, 0);
      GL11.glRotatef(50, 0.0F, 1, 1);
      GL11.glTranslatef(-0.8F, -3.2F, 0F);
      GL11.glScalef(5.2F, 5.2F, 5.2F);

      if (player != null
          && player.ridingEntity != null
          && player.ridingEntity instanceof EntityTier1Rocket) {
        GL11.glScalef(0.0F, 0.0F, 0.0F);
      }
    }

    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
      GL11.glTranslatef(2.5F, 5.9F, 1F);
      GL11.glRotatef(28, 0.0F, 0, 1);
      GL11.glRotatef(50 + 180, 0.0F, 1, 0);
      GL11.glRotatef(73, 1.0F, 0, 0);
      GL11.glScalef(5.2F, 5.2F, 5.2F);

      if (player != null
          && player.ridingEntity != null
          && player.ridingEntity instanceof EntityTier1Rocket) {
        GL11.glScalef(0.0F, 0.0F, 0.0F);
      }
    }

    GL11.glTranslatef(0, 0.1F, 0);
    GL11.glScalef(-0.4F, -0.4F, 0.4F);

    if (type == ItemRenderType.INVENTORY || type == ItemRenderType.ENTITY) {
      if (type == ItemRenderType.INVENTORY) {
        GL11.glRotatef(85F, 1F, 0F, 1F);
        GL11.glRotatef(20F, 1F, 0F, 0F);
        GL11.glScalef(0.7F, 0.7F, 0.7F);
        GL11.glTranslatef(0.0F, 1.6F, -0.4F);
      } else {
        GL11.glTranslatef(0, -0.9F, 0);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
      }

      GL11.glScalef(1.3F, 1.3F, 1.3F);
      GL11.glTranslatef(0, -0.6F, 0);
      GL11.glRotatef(Sys.getTime() / 30F % 360F + 45, 0F, 1F, 0F);
    }

    GL11.glRotatef(180, 0, 0, 1);
  }
Ejemplo n.º 6
0
 private long currentTimeInMilliseconds() {
   return (Sys.getTime() * 1000) / ticksPerSecond;
 }
 /**
  * Get the time in milliseconds
  *
  * @return The system time in milliseconds
  */
 private long getTime() {
   return (Sys.getTime() * 1000) / Sys.getTimerResolution();
 }
Ejemplo n.º 8
0
 public float getRandomBasedOnTime() {
   long r = Sys.getTime();
   float q = r / Long.MAX_VALUE;
   float n = q - (r % Long.MAX_VALUE);
   return n;
 }
Ejemplo n.º 9
0
 public static long getTime() {
   return (Sys.getTime() * 1000) / Sys.getTimerResolution();
 }
Ejemplo n.º 10
0
 private static long getTime() {
   return (Sys.getTime() * 1000 / Sys.getTimerResolution());
 }
 /**
  * Get the accurate system time
  *
  * @return The system time in milliseconds
  */
 @Override
 public long getTime() {
   return (Sys.getTime() * 1000) / Sys.getTimerResolution();
 }
Ejemplo n.º 12
0
  // ***************************************************************************
  // run
  // ***************************************************************************
  private void run() {
    // Main camera = new Main(0, 0, 0);

    float dx = 0.0f;
    float dy = 0.0f;
    float dt = 0.0f;

    float lastTime = 0.0f; // when the last frame was
    float time = 0.0f;

    float mouseSensitivity = 0.15f;
    float movementSpeed = 10.0f; // move 10 units per second

    // hide the mouse
    Mouse.setGrabbed(true);

    while ((gameRunning) && (!Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))) {
      // update();

      // render();
      GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
      // GL11.glLoadIdentity();
      GL11.glTranslatef(0.0f, 0.0f, -5.0f);

      axis.draw();
      grid.render();
      // cube.render();

      /*
      {
         Color.white.bind();
         texture.bind(); // or GL11.glBind(texture.getTextureID());

         GL11.glBegin(GL11.GL_QUADS);
         GL11.glTexCoord2f(0,0);
         GL11.glVertex2f(100,100);
         GL11.glTexCoord2f(1,0);
         GL11.glVertex2f(100+texture.getTextureWidth(),100);
         GL11.glTexCoord2f(1,1);
         GL11.glVertex2f(100+texture.getTextureWidth(),100+texture.getTextureHeight());
         GL11.glTexCoord2f(0,1);
         GL11.glVertex2f(100,100+texture.getTextureHeight());
         GL11.glEnd();
      }
      */

      Display.update();

      // keep looping till the display window is closed the ESC key is down
      /*
      while (!Display.isCloseRequested() ||
      !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))
      {
       */
      time = Sys.getTime();

      // here is your movement speed, which can be changed to anything
      dt = 0.0005f;

      lastTime = time;

      // distance in mouse movement from the last getDX() call.
      dx = Mouse.getDX();
      // distance in mouse movement from the last getDY() call.
      dy = Mouse.getDY();

      // control camera yaw from x movement from the mouse
      camera.yaw(dx * mouseSensitivity);
      // control camera pitch from y movement from the mouse
      camera.pitch(-dy * mouseSensitivity);

      // when passing in the distrance to move
      // we times the movementSpeed with dt this is a time scale
      // so if its a slow frame u move more then a fast frame
      // so on a slow computer you move just as fast as on a fast computer

      if (Keyboard.isKeyDown(Keyboard.KEY_W)) {
        camera.moveForward(movementSpeed * dt);
      }
      if (Keyboard.isKeyDown(Keyboard.KEY_S)) {
        camera.moveBackwards(movementSpeed * dt);
      }
      if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
        camera.moveLeft(movementSpeed * dt);
      }
      if (Keyboard.isKeyDown(Keyboard.KEY_D)) {
        camera.moveRight(movementSpeed * dt);
      }
      if (Keyboard.isKeyDown(Keyboard.KEY_D)) {
        camera.moveRight(movementSpeed * dt);
      }

      if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
        camera.moveUp(movementSpeed * dt);
      }

      if (Keyboard.isKeyDown(Keyboard.KEY_P)) {

        // camera.moveRight(movementSpeed * dt);
      }

      // set the modelview matrix back to the identity
      GL11.glLoadIdentity();
      // look through the camera before you draw anything
      camera.lookThrough();

      // you would draw your scene here.

      if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
        Sys.alert("Close", "To continue, press ESCAPE on your keyboard or OK on the screen.");
        System.exit(0);
      }
    }
  }
Ejemplo n.º 13
0
  /** Boucle de rendu 3D. */
  @Override
  public final void run() {
    // Initialisation
    initGL();
    // Boucle du thread de rendu 3D

    matrice.addInterPoint();
    while (Setting.getView3DStart()) {
      // Si la fenêtre n'est pas fermée
      if (!Display.isCloseRequested()) {

        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
        GL11.glClearColor(0.6f, 0.9f, 1.0f, 1.0f);
        GL11.glLoadIdentity();

        Sys.initialize();
        time = Sys.getTime();

        dt = (time - lastTime) / 1000.0f;
        setLastInput(getLastInput() + (time - lastTime) / 1000.0f);
        lastTime = time;

        // Positionne la camera avant d'afficher le rendu
        camera.lookThrough();

        // Si le rendu n'est pas en pause
        if (!Setting.getView3DPause()) {
          int colonne = 0, ligne = 0;

          // Affichage de la matrice
          for (ligne = 0; ligne < Setting.getSide(); ligne++) {
            for (colonne = 0; colonne < Setting.getSide(); colonne++) {

              GL11.glColor3f(1.0f, 1.0f, 1.0f);
              // Si le mode Wireframe est activé
              if (Setting.getWireframe()) {
                GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
              } else {
                GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
              }

              if (Setting.getGradient()) {
                GL11.glBegin(GL11.GL_TRIANGLE_FAN);
                GL11.glColor3f(
                    matrice.getSquare(ligne, colonne).getAltitude() / Setting.getAltitudeMax(),
                    ((Setting.getAltitudeMax() / this.echelle)
                            - (matrice.getSquare(ligne, colonne).getAltitude() / this.echelle))
                        / Setting.getAltitudeMax(),
                    0);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getHauteur(),
                    matrice.getSquare(ligne, colonne).getAltitude() / this.echelle,
                    matrice.getSquare(ligne, colonne).getLargeur());

                GL11.glColor3f(
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[1]
                        / Setting.getAltitudeMax(),
                    (Setting.getAltitudeMax()
                            - matrice.getSquare(ligne, colonne).getCooHautGauche()[1])
                        / Setting.getAltitudeMax(),
                    0);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[0],
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[2]);

                GL11.glColor3f(
                    matrice.getSquare(ligne, colonne).getCooHautDroite()[1]
                        / Setting.getAltitudeMax(),
                    (Setting.getAltitudeMax()
                            - matrice.getSquare(ligne, colonne).getCooHautDroite()[1])
                        / Setting.getAltitudeMax(),
                    0);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooHautDroite()[0],
                    matrice.getSquare(ligne, colonne).getCooHautDroite()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooHautDroite()[2]);

                GL11.glColor3f(
                    matrice.getSquare(ligne, colonne).getCooBasDroite()[1]
                        / Setting.getAltitudeMax(),
                    (Setting.getAltitudeMax()
                            - matrice.getSquare(ligne, colonne).getCooBasDroite()[1])
                        / Setting.getAltitudeMax(),
                    0);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooBasDroite()[0],
                    matrice.getSquare(ligne, colonne).getCooBasDroite()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooBasDroite()[2]);

                GL11.glColor3f(
                    matrice.getSquare(ligne, colonne).getCooBasGauche()[1]
                        / Setting.getAltitudeMax(),
                    (Setting.getAltitudeMax()
                            - matrice.getSquare(ligne, colonne).getCooBasGauche()[1])
                        / Setting.getAltitudeMax(),
                    0);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooBasGauche()[0],
                    matrice.getSquare(ligne, colonne).getCooBasGauche()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooBasGauche()[2]);

                GL11.glColor3f(
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[1]
                        / Setting.getAltitudeMax(),
                    (Setting.getAltitudeMax()
                            - matrice.getSquare(ligne, colonne).getCooHautGauche()[1])
                        / Setting.getAltitudeMax(),
                    0);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[0],
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[2]);
                GL11.glEnd();
              }

              if (Setting.getTexture()) {
                GL11.glEnable(GL11.GL_TEXTURE_2D);
                GL11.glBindTexture(GL11.GL_TEXTURE_2D, matrice.getTextImgFile().getTextureID());
                GL11.glTexParameteri(
                    GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
                GL11.glTexParameteri(
                    GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
                GL11.glEnable(GL11.GL_ALPHA);
                GL11.glEnable(GL11.GL_BLEND);
                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                GL11.glBegin(GL11.GL_TRIANGLES);

                float middlePointTextRow =
                    (1.0f / (float) (Setting.getSide() + 1)) * ligne
                        + ((1.0f / (float) (Setting.getSide() + 1)) / 2.0f);
                float middlePointTextCol =
                    (1.0f / (float) (Setting.getSide() + 1)) * (Setting.getSide() + 1 - colonne)
                        - ((1.0f / (float) (Setting.getSide() + 1)) / 2.0f);
                float percent = (1.0f / (float) (Setting.getSide() + 1));

                // Milieu
                GL11.glTexCoord2f(middlePointTextRow, middlePointTextCol);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getHauteur(),
                    matrice.getSquare(ligne, colonne).getAltitude() / this.echelle,
                    matrice.getSquare(ligne, colonne).getLargeur());
                // bas gauche
                GL11.glTexCoord2f(percent * ligne, percent * (Setting.getSide() + 1 - colonne));
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[0],
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[2]);
                // bas droite
                GL11.glTexCoord2f(
                    percent * ligne, percent * (Setting.getSide() + 1 - (colonne + 1)));
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooHautDroite()[0],
                    matrice.getSquare(ligne, colonne).getCooHautDroite()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooHautDroite()[2]);

                // milieu
                GL11.glTexCoord2f(middlePointTextRow, middlePointTextCol);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getHauteur(),
                    matrice.getSquare(ligne, colonne).getAltitude() / this.echelle,
                    matrice.getSquare(ligne, colonne).getLargeur());
                // bas droite
                GL11.glTexCoord2f(
                    percent * ligne, percent * (Setting.getSide() + 1 - (colonne + 1)));
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooHautDroite()[0],
                    matrice.getSquare(ligne, colonne).getCooHautDroite()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooHautDroite()[2]);
                // haut droite
                GL11.glTexCoord2f(
                    percent * (ligne + 1), percent * (Setting.getSide() + 1 - (colonne + 1)));
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooBasDroite()[0],
                    matrice.getSquare(ligne, colonne).getCooBasDroite()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooBasDroite()[2]);

                // milieu
                GL11.glTexCoord2f(middlePointTextRow, middlePointTextCol);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getHauteur(),
                    matrice.getSquare(ligne, colonne).getAltitude() / this.echelle,
                    matrice.getSquare(ligne, colonne).getLargeur());
                // haut droite
                GL11.glTexCoord2f(
                    percent * (ligne + 1), percent * (Setting.getSide() + 1 - (colonne + 1)));
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooBasDroite()[0],
                    matrice.getSquare(ligne, colonne).getCooBasDroite()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooBasDroite()[2]);
                // haut gauche
                GL11.glTexCoord2f(
                    percent * (ligne + 1), percent * (Setting.getSide() + 1 - colonne));
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooBasGauche()[0],
                    matrice.getSquare(ligne, colonne).getCooBasGauche()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooBasGauche()[2]);

                // milieu
                GL11.glTexCoord2f(middlePointTextRow, middlePointTextCol);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getHauteur(),
                    matrice.getSquare(ligne, colonne).getAltitude() / this.echelle,
                    matrice.getSquare(ligne, colonne).getLargeur());
                // haut gauche
                GL11.glTexCoord2f(
                    percent * (ligne + 1), percent * (Setting.getSide() + 1 - colonne));
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooBasGauche()[0],
                    matrice.getSquare(ligne, colonne).getCooBasGauche()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooBasGauche()[2]);
                // bas gauche
                GL11.glTexCoord2f(percent * ligne, percent * (Setting.getSide() + 1 - colonne));
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[0],
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[2]);

                GL11.glEnd();

              } else {
                GL11.glDisable(GL11.GL_TEXTURE_2D);
              }

              /*
              if (Setting.getTexture()) {
              	GL11.glEnable(GL11.GL_TEXTURE_2D);
              	GL11.glBindTexture(GL11.GL_TEXTURE_2D, textures.getTextureByName(
              		terrains.getTerrainByName(matrice.getSquare(ligne, colonne).getTerrain()).getTexture()).getTextureID());
              	GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
               GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
               GL11.glEnable(GL11.GL_ALPHA);
               GL11.glEnable(GL11.GL_BLEND);
               GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
              	GL11.glBegin(GL11.GL_TRIANGLES);

              	GL11.glTexCoord2f(0.5f, 0.5f);
              	GL11.glVertex3f(matrice.getSquare(ligne, colonne).getHauteur(),
              	matrice.getSquare(ligne, colonne).getAltitude(),
              	matrice.getSquare(ligne, colonne).getLargeur());

              	GL11.glTexCoord2f(0.0f, 0.0f);
              	GL11.glVertex3f(matrice.getSquare(ligne, colonne).getCooHautGauche()[0],
              	matrice.getSquare(ligne, colonne).getCooHautGauche()[1],
              	matrice.getSquare(ligne, colonne).getCooHautGauche()[2]);

              	GL11.glTexCoord2f(0.0f, 1.0f);
              	GL11.glVertex3f(matrice.getSquare(ligne, colonne).getCooHautDroite()[0],
              	matrice.getSquare(ligne, colonne).getCooHautDroite()[1],
              	matrice.getSquare(ligne, colonne).getCooHautDroite()[2]);

              	GL11.glTexCoord2f(0.5f, 0.5f);
              	GL11.glVertex3f(matrice.getSquare(ligne, colonne).getHauteur(),
              	matrice.getSquare(ligne, colonne).getAltitude(),
              	matrice.getSquare(ligne, colonne).getLargeur());
              	GL11.glTexCoord2f(0.0f, 1.0f);
              	GL11.glVertex3f(matrice.getSquare(ligne, colonne).getCooHautDroite()[0],
              	matrice.getSquare(ligne, colonne).getCooHautDroite()[1],
              	matrice.getSquare(ligne, colonne).getCooHautDroite()[2]);

              	GL11.glTexCoord2f(1.0f, 1.0f);
              	GL11.glVertex3f(matrice.getSquare(ligne, colonne).getCooBasDroite()[0],
              	matrice.getSquare(ligne, colonne).getCooBasDroite()[1],
              	matrice.getSquare(ligne, colonne).getCooBasDroite()[2]);

              	GL11.glTexCoord2f(0.5f, 0.5f);
              	GL11.glVertex3f(matrice.getSquare(ligne, colonne).getHauteur(),
              	matrice.getSquare(ligne, colonne).getAltitude(),
              	matrice.getSquare(ligne, colonne).getLargeur());
              	GL11.glTexCoord2f(1.0f, 1.0f);
              	GL11.glVertex3f(matrice.getSquare(ligne, colonne).getCooBasDroite()[0],
              	matrice.getSquare(ligne, colonne).getCooBasDroite()[1],
              	matrice.getSquare(ligne, colonne).getCooBasDroite()[2]);

              	GL11.glTexCoord2f(1.0f, 0.0f);
              	GL11.glVertex3f(matrice.getSquare(ligne, colonne).getCooBasGauche()[0],
              	matrice.getSquare(ligne, colonne).getCooBasGauche()[1],
              	matrice.getSquare(ligne, colonne).getCooBasGauche()[2]);

              	GL11.glTexCoord2f(0.5f, 0.5f);
              	GL11.glVertex3f(matrice.getSquare(ligne, colonne).getHauteur(),
              	matrice.getSquare(ligne, colonne).getAltitude(),
              	matrice.getSquare(ligne, colonne).getLargeur());
              	GL11.glTexCoord2f(1.0f, 0.0f);
              	GL11.glVertex3f(matrice.getSquare(ligne, colonne).getCooBasGauche()[0],
              	matrice.getSquare(ligne, colonne).getCooBasGauche()[1],
              	matrice.getSquare(ligne, colonne).getCooBasGauche()[2]);

              	GL11.glTexCoord2f(0.0f, 0.0f);
              	GL11.glVertex3f(matrice.getSquare(ligne, colonne).getCooHautGauche()[0],
              	matrice.getSquare(ligne, colonne).getCooHautGauche()[1],
              	matrice.getSquare(ligne, colonne).getCooHautGauche()[2]);

              	GL11.glEnd();

              }else {
              	GL11.glDisable(GL11.GL_TEXTURE_2D);
              }
               */

              if (Setting.getWind()) {
                GL11.glBegin(GL11.GL_TRIANGLES);
                double[][] tempWind =
                    wind.getLocalWind(ligne, colonne)
                        .trianglevent(
                            ligne * Setting.getSideUnit(),
                            1,
                            colonne * Setting.getSideUnit(),
                            camera.getZoom());

                GL11.glColor3f(
                    Setting.getColorWind().x, Setting.getColorWind().y, Setting.getColorWind().z);
                GL11.glVertex3d(
                    tempWind[0][0],
                    matrice.getSquare(ligne, colonne).getAltitude() + tempWind[0][1],
                    tempWind[0][2]);
                GL11.glVertex3d(
                    tempWind[1][0],
                    matrice.getSquare(ligne, colonne).getAltitude() + tempWind[1][1],
                    tempWind[1][2]);
                GL11.glVertex3d(
                    tempWind[2][0],
                    matrice.getSquare(ligne, colonne).getAltitude() + tempWind[2][1],
                    tempWind[2][2]);
                GL11.glEnd();
              }

              if (matrice.getSquare(ligne, colonne).getActive()) {
                GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
                GL11.glBegin(GL11.GL_TRIANGLE_FAN);
                GL11.glColor3f(
                    Setting.getColorActive().x,
                    Setting.getColorActive().y,
                    Setting.getColorActive().z);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getHauteur(),
                    (matrice.getSquare(ligne, colonne).getAltitude() + 1) / this.echelle,
                    matrice.getSquare(ligne, colonne).getLargeur());
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[0],
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[2]);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooHautDroite()[0],
                    matrice.getSquare(ligne, colonne).getCooHautDroite()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooHautDroite()[2]);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooBasDroite()[0],
                    matrice.getSquare(ligne, colonne).getCooBasDroite()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooBasDroite()[2]);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooBasGauche()[0],
                    matrice.getSquare(ligne, colonne).getCooBasGauche()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooBasGauche()[2]);
                GL11.glVertex3f(
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[0],
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[1] / this.echelle,
                    matrice.getSquare(ligne, colonne).getCooHautGauche()[2]);
                GL11.glEnd();
              }
            }
          }
        }
        input();

        origin();

        Display.update();

        try {
          Renderer3D.sleep(30);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
      } else {
        Setting.setView3DStart(false);
        Display.destroy();
      }
    }
  }
  @Override
  public void transform(ItemStack itemstack, ItemRenderType type) {
    final EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
    long var10 = this.spaceship.entityId * 493286711L;
    var10 = var10 * var10 * 4392167121L + var10 * 98761L;
    final float var12 = (((var10 >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
    final float var13 = (((var10 >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
    final float var14 = (((var10 >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;

    if (type == ItemRenderType.EQUIPPED) {
      if (itemstack.getItemDamage() >= 10) {
        GL11.glTranslatef(0.5F, 0.2F, 0F);
      }

      GL11.glRotatef(70, 1.0F, 0, 0);
      GL11.glRotatef(-10, 0.0F, 1, 0);
      GL11.glRotatef(50, 0.0F, 1, 1);
      GL11.glTranslatef(0F, 2.0F, 0F);
      GL11.glScalef(5.2F, 5.2F, 5.2F);

      if (itemstack.getItemDamage() >= 10) {
        GL11.glTranslatef(0F, 0.45F, 0F);
        GL11.glScalef(0.45F, 0.45F, 0.45F);
      }

      if (player != null
          && player.ridingEntity != null
          && player.ridingEntity instanceof GCCoreEntityRocketT1) {
        GL11.glScalef(0.0F, 0.0F, 0.0F);
      }
    }

    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
      GL11.glTranslatef(-0.5F, 4.2F, 0F);

      if (itemstack.getItemDamage() >= 10) {
        GL11.glTranslatef(0F, 1.5F, -6.0F);
      }

      GL11.glRotatef(28, 0.0F, 0, 1);
      GL11.glRotatef(50 + 180, 0.0F, 1, 0);
      GL11.glRotatef(73, 1.0F, 0, 0);
      GL11.glScalef(5.2F, 5.2F, 5.2F);

      if (player != null
          && player.ridingEntity != null
          && player.ridingEntity instanceof GCCoreEntityRocketT1) {
        GL11.glScalef(0.0F, 0.0F, 0.0F);
      }
    }

    GL11.glTranslatef(var12, var13 - 0.1F, var14);
    GL11.glScalef(-0.4F, -0.4F, 0.4F);

    if (type == ItemRenderType.INVENTORY || type == ItemRenderType.ENTITY) {
      if (type == ItemRenderType.INVENTORY) {
        GL11.glRotatef(85F, 1F, 0F, 1F);
        GL11.glRotatef(20F, 1F, 0F, 0F);
        GL11.glScalef(0.9F, 0.9F, 0.9F);
      } else {
        GL11.glTranslatef(0, -0.9F, 0);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
      }

      if (itemstack.getItemDamage() >= 10) {
        GL11.glRotatef(90F, 1F, 0F, 1F);
        GL11.glScalef(0.45F, 0.45F, 0.45F);
        GL11.glTranslatef(0, -0.9F, 0);
        GL11.glTranslatef(0, -0.9F, 0);
        GL11.glTranslatef(0, -0.9F, 0);
      }

      GL11.glScalef(1.3F, 1.3F, 1.3F);
      GL11.glTranslatef(0, -0.6F, 0);
      GL11.glRotatef(
          Sys.getTime() / 90F % 360F * (itemstack.getItemDamage() >= 10 ? -1 : 1), 0F, 1F, 0F);
    }
  }
Ejemplo n.º 15
0
 private long getTime() {
   return (Sys.getTime() * 1000) / Sys.getTimerResolution(); // returns time in milliseconds
 }
Ejemplo n.º 16
0
/*     */   private long getTime()
/*     */   {
/* 603 */     return Sys.getTime() * 1000L / Sys.getTimerResolution();
/*     */   }
Ejemplo n.º 17
0
 public long getInputTimeNanos() {
   return Sys.getTime() * LwjglTimer.LWJGL_TIME_TO_NANOS;
 }
Ejemplo n.º 18
0
 void setAnimationState(int idx, boolean isActive) {
   if (idx >= 0 && idx < 3 && active[idx] != isActive) {
     lastTime[idx] = Sys.getTime();
     active[idx] = isActive;
   }
 }
Ejemplo n.º 19
0
 @Override
 public double Timer() {
   return (double) Sys.getTime() / Sys.getTimerResolution();
 }
Ejemplo n.º 20
0
 private static long getCurrentTime() {
   return Sys.getTime() * 1000 / Sys.getTimerResolution();
 }