コード例 #1
0
 private void registerSubscribtions() {
   FMLCommonHandler.instance().bus().register(keyHandler);
   FMLCommonHandler.instance().bus().register(mouseHandler);
   MinecraftForge.EVENT_BUS.register(GalaxyClient.getInstance());
   MinecraftForge.EVENT_BUS.register(new MatterOverdriveIcons());
   MinecraftForge.EVENT_BUS.register(renderHandler);
   MinecraftForge.EVENT_BUS.register(new TooltipHandler());
   MinecraftForge.EVENT_BUS.register(androidHud);
   MinecraftForge.EVENT_BUS.register(mouseHandler);
   MinecraftForge.EVENT_BUS.register(questHud);
   FMLCommonHandler.instance().bus().register(renderHandler);
   FMLCommonHandler.instance().bus().register(GalaxyClient.getInstance());
   FMLCommonHandler.instance().bus().register(androidHud);
 }
コード例 #2
0
  private void drawPlanetInfo(Planet planet) {
    glTranslated(0, planet.getSize() * 0.13f + 0.05f, 0);
    glScaled(0.005, 0.005, 0.005);
    glRotated(180, 0, 0, 1);
    if (GalaxyClient.getInstance().canSeePlanetInfo(planet, Minecraft.getMinecraft().thePlayer)) {
      int width = Minecraft.getMinecraft().fontRenderer.getStringWidth(planet.getName());
      Minecraft.getMinecraft()
          .fontRenderer
          .drawString(planet.getName(), -width / 2, 0, Planet.getGuiColor(planet).getColor());

      if (planet.isHomeworld(Minecraft.getMinecraft().thePlayer)) {
        width = Minecraft.getMinecraft().fontRenderer.getStringWidth("[Home]");
        Minecraft.getMinecraft()
            .fontRenderer
            .drawString(EnumChatFormatting.GOLD + "[Home]", -width / 2, -10, 0xFFFFFF);
      }
    } else {
      int width =
          Minecraft.getMinecraft().standardGalacticFontRenderer.getStringWidth(planet.getName());
      Minecraft.getMinecraft()
          .standardGalacticFontRenderer
          .drawString(planet.getName(), -width / 2, 0, Planet.getGuiColor(planet).getColor());

      if (planet.hasOwner()) {
        EntityPlayer owner = Minecraft.getMinecraft().theWorld.func_152378_a(planet.getOwnerUUID());
        if (owner != null) {
          String info = String.format("[%s]", owner.getDisplayName());
          width = Minecraft.getMinecraft().fontRenderer.getStringWidth(info);
          Minecraft.getMinecraft()
              .fontRenderer
              .drawString(EnumChatFormatting.GOLD + info, -width / 2, -10, 0xFFFFFF);
        }
      }
    }
  }
コード例 #3
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);
    }
  }