コード例 #1
0
  @Override
  public void renderGUIInfo(
      Galaxy galaxy,
      SpaceBody spaceBody,
      TileEntityMachineStarMap starMap,
      float partialTicks,
      float opacity) {
    if (spaceBody instanceof Star) {
      RenderUtils.applyColorWithMultipy(Reference.COLOR_HOLO, opacity);
      glEnable(GL_ALPHA_TEST);

      Planet planet = galaxy.getPlanet(starMap.getDestination());
      if (planet != null) {
        if (GalaxyClient.getInstance()
            .canSeePlanetInfo(planet, Minecraft.getMinecraft().thePlayer)) {
          RenderUtils.drawString(planet.getName(), 72, -42, Reference.COLOR_HOLO, opacity);
        } else {
          RenderUtils.drawString(
              Minecraft.getMinecraft().standardGalacticFontRenderer,
              planet.getName(),
              72,
              -42,
              Reference.COLOR_HOLO,
              opacity);
        }

        RenderUtils.applyColorWithMultipy(Reference.COLOR_HOLO, opacity);
        ClientProxy.holoIcons.renderIcon("icon_size", 72, -28);
        RenderUtils.drawString(
            DecimalFormat.getPercentInstance().format(planet.getSize()),
            92,
            -23,
            Reference.COLOR_HOLO,
            opacity);
      }

      glDisable(GL_TEXTURE_2D);
      glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
      Tessellator.instance.startDrawingQuads();
      for (int i = 0; i < 10; i++) {
        double step = 64d / 10d;
        double x = step * i;
        double y = -10;
        double height = 64 * (0.5 * random.nextGaussian() + 1d) / 2d;
        Tessellator.instance.addVertex(x, y, 0);
        Tessellator.instance.addVertex(x + step - 1, y, 0);
        Tessellator.instance.addVertex(x + step - 1, y - height, 0);
        Tessellator.instance.addVertex(x, y - height, 0);
      }
      Tessellator.instance.draw();
      glEnable(GL_TEXTURE_2D);
    }
  }
コード例 #2
0
  @Override
  public void renderBody(
      Galaxy galaxy,
      SpaceBody spaceBody,
      TileEntityMachineStarMap starMap,
      float partialTicks,
      float distance) {
    if (spaceBody instanceof Star) {

      Star star = (Star) spaceBody;
      random.setSeed(star.getSeed());

      double time = Minecraft.getMinecraft().theWorld.getWorldTime();

      glPushMatrix();
      glScaled(star.getSize(), star.getSize(), star.getSize());

      bindTexture(ClientProxy.renderHandler.getRenderParticlesHandler().getAdditiveTextureSheet());
      Tessellator.instance.startDrawingQuads();
      RenderUtils.tessalateParticle(
          Minecraft.getMinecraft().renderViewEntity,
          star_icon,
          star.getSize(),
          Vec3.createVectorHelper(0, 0, 0),
          Reference.COLOR_HOLO_YELLOW.getFloatR() * 0.1f,
          Reference.COLOR_HOLO_YELLOW.getFloatG() * 0.1f,
          Reference.COLOR_HOLO_YELLOW.getFloatB() * 0.1f,
          Reference.COLOR_HOLO_YELLOW.getFloatA() * 0.1f);
      Tessellator.instance.draw();

      RenderUtils.applyColorWithMultipy(new GuiColor(star.getColor()), 0.25f * (1f / distance));
      glPolygonMode(GL_FRONT, GL_LINE);
      glDisable(GL_TEXTURE_2D);
      double s = 0.9 + Math.sin(time * 0.01) * 0.1;
      glScaled(s, s, s);
      sphere_model.renderAll();
      glPolygonMode(GL_FRONT, GL_POINT);
      glPointSize(10 / (float) Math.max(0.1, distance));

      sphere_model.renderAll();
      if (Minecraft.getMinecraft().theWorld.getWorldTime() % 120 > 80) {
        double t = ((Minecraft.getMinecraft().theWorld.getWorldTime() % 120) - 80) / 40d;
        RenderUtils.applyColorWithMultipy(
            Reference.COLOR_HOLO_YELLOW, (float) MOMathHelper.easeIn(1 - t, 0, 0.1, 1));
        s = MOMathHelper.easeIn(t, 0.0, 10, 1);
        glScaled(1 + s, 1 + s, 1 + s);
        sphere_model.renderAll();
      }
      glPopMatrix();
      glPolygonMode(GL_FRONT, GL_LINE);

      int planetID = 0;
      for (Planet planet : star.getPlanets()) {
        float sizeMultiply = 1;
        if (starMap.getDestination().equals(planet)) {
          sizeMultiply = 1.2f;
        }

        glDisable(GL_ALPHA_TEST);
        GuiColor planetColor = Planet.getGuiColor(planet);
        random.setSeed(planet.getSeed());

        glPushMatrix();
        double axisRotation = random.nextInt(30) - 15;
        glRotated(axisRotation, 1, 0, 0);
        double radius = planet.getOrbit() * 2 + (star.getSize() / 2 + 0.1);
        float planetSize = planet.getSize();
        drawPlanetOrbit(planet, radius);

        glTranslated(
            Math.sin(time * 0.001 + 10 * planetID) * radius,
            0,
            Math.cos(time * 0.001 + 10 * planetID) * radius);

        glPolygonMode(GL_FRONT, GL_FILL);
        glEnable(GL_TEXTURE_2D);

        if (starMap.getDestination().equals(planet)) {
          bindTexture(
              ClientProxy.renderHandler.getRenderParticlesHandler().getAdditiveTextureSheet());
          Tessellator.instance.startDrawingQuads();
          RenderUtils.tessalateParticle(
              Minecraft.getMinecraft().renderViewEntity,
              selectedIcon,
              planet.getSize() * 0.15f * sizeMultiply,
              Vec3.createVectorHelper(0, 0, 0),
              planetColor);
          Tessellator.instance.draw();
        }

        if (starMap.getGalaxyPosition().equals(planet)) {
          bindTexture(
              ClientProxy.renderHandler.getRenderParticlesHandler().getAdditiveTextureSheet());
          Tessellator.instance.startDrawingQuads();
          RenderUtils.tessalateParticle(
              Minecraft.getMinecraft().renderViewEntity,
              currentIcon,
              planet.getSize() * 0.25f,
              Vec3.createVectorHelper(0, 0, 0),
              planetColor);
          Tessellator.instance.draw();
        }

        glPushMatrix();
        glRotated(-axisRotation, 1, 0, 0);
        RenderUtils.rotateTo(Minecraft.getMinecraft().renderViewEntity);
        drawPlanetInfo(planet);
        glPopMatrix();
        glPolygonMode(GL_FRONT, GL_LINE);
        glDisable(GL_TEXTURE_2D);

        RenderUtils.applyColorWithMultipy(planetColor, 0.3f * (1f / distance));
        glRotated(100, 1, 0, 0);
        glRotated(time * 2, 0, 0, 1);
        sphere.draw(
            planetSize * 0.1f * sizeMultiply,
            (int) (16 + planetSize * 2),
            (int) (8 + planetSize * 2));
        planetID++;
        glPopMatrix();
      }
      glEnable(GL_TEXTURE_2D);
      glPolygonMode(GL_FRONT, GL_FILL);
    }
  }