コード例 #1
0
  public void loadClaimedPlanets() {
    homePlanets.clear();

    for (Quadrant quadrant : theGalaxy.getQuadrants()) {
      for (Star star : quadrant.getStars()) {
        for (Planet planet : star.getPlanets()) {
          if (planet.isHomeworld() && planet.hasOwner()) {
            homePlanets.put(planet.getOwnerUUID(), planet);
          }
        }
      }
    }
  }
コード例 #2
0
 public boolean canSeeStarInfo(Star star, EntityPlayer player) {
   for (Planet planet : star.getPlanets()) {
     if (canSeePlanetInfo(planet, player)) {
       return true;
     }
   }
   return false;
 }
コード例 #3
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);
    }
  }