Ejemplo n.º 1
0
 public void init(
     Texture par1Texture, List par2List, int par3, int par4, int par5, int par6, boolean par7) {
   this.textureSheet = par1Texture;
   this.textureList = par2List;
   this.originX = par3;
   this.originY = par4;
   this.width = par5;
   this.height = par6;
   this.rotated = par7;
   float f = 0.01F / (float) par1Texture.getWidth();
   float f1 = 0.01F / (float) par1Texture.getHeight();
   this.minU = (float) par3 / (float) par1Texture.getWidth() + f;
   this.maxU = (float) (par3 + par5) / (float) par1Texture.getWidth() - f;
   this.minV = (float) par4 / (float) par1Texture.getHeight() + f1;
   this.maxV = (float) (par4 + par6) / (float) par1Texture.getHeight() - f1;
   this.widthNorm = (float) par5 / 16.0F;
   this.heightNorm = (float) par6 / 16.0F;
   TextureFXManager.instance().getHelper().doTextureUpload(this);
   if (this.rotated) {
     TextureFXManager.instance()
         .getHelper()
         .rotateTexture(this.textureSheet, this.textureSheet.getTextureData());
   }
 }
  @Override

  /** Draws the screen and all the components in it. */
  public void drawScreen(int p_571_1_, int p_571_2_, float p_571_3_) {
    this.modList.drawScreen(p_571_1_, p_571_2_, p_571_3_);
    this.drawCenteredString(this.fontRenderer, "Mod List", this.width / 2, 16, 0xFFFFFF);
    int offset = this.listWidth + 20;
    if (selectedMod != null) {
      GL11.glEnable(GL11.GL_BLEND);
      if (!selectedMod.getMetadata().autogenerated) {
        int shifty = 35;
        if (!selectedMod.getMetadata().logoFile.isEmpty()) {
          int texture = this.mc.renderEngine.getTexture(selectedMod.getMetadata().logoFile);
          GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
          this.mc.renderEngine.bindTexture(texture);
          Dimension dim = TextureFXManager.instance().getTextureDimensions(texture);
          int top = 32;
          Tessellator tess = Tessellator.instance;
          tess.startDrawingQuads();
          tess.addVertexWithUV(offset, top + dim.height, zLevel, 0, 1);
          tess.addVertexWithUV(offset + dim.width, top + dim.height, zLevel, 1, 1);
          tess.addVertexWithUV(offset + dim.width, top, zLevel, 1, 0);
          tess.addVertexWithUV(offset, top, zLevel, 0, 0);
          tess.draw();

          shifty += 65;
        }
        this.fontRenderer.drawStringWithShadow(
            selectedMod.getMetadata().name, offset, shifty, 0xFFFFFF);
        shifty += 12;

        shifty =
            drawLine(
                String.format(
                    "Version: %s (%s)",
                    selectedMod.getMetadata().version, selectedMod.getVersion()),
                offset,
                shifty);
        shifty =
            drawLine(
                String.format("Mod State: %s", Loader.instance().getModState(selectedMod)),
                offset,
                shifty);
        if (!selectedMod.getMetadata().credits.isEmpty()) {
          shifty =
              drawLine(
                  String.format("Credits: %s", selectedMod.getMetadata().credits), offset, shifty);
        }
        shifty =
            drawLine(
                String.format("Authors: %s", selectedMod.getMetadata().getAuthorList()),
                offset,
                shifty);
        shifty = drawLine(String.format("URL: %s", selectedMod.getMetadata().url), offset, shifty);
        shifty =
            drawLine(
                selectedMod.getMetadata().childMods.isEmpty()
                    ? "No child mods for this mod"
                    : String.format("Child mods: %s", selectedMod.getMetadata().getChildModList()),
                offset,
                shifty);
        this.getFontRenderer()
            .drawSplitString(
                selectedMod.getMetadata().description,
                offset,
                shifty + 10,
                this.width - offset - 20,
                0xDDDDDD);
      } else {
        offset = (this.listWidth + this.width) / 2;
        this.drawCenteredString(this.fontRenderer, selectedMod.getName(), offset, 35, 0xFFFFFF);
        this.drawCenteredString(
            this.fontRenderer,
            String.format("Version: %s", selectedMod.getVersion()),
            offset,
            45,
            0xFFFFFF);
        this.drawCenteredString(
            this.fontRenderer,
            String.format("Mod State: %s", Loader.instance().getModState(selectedMod)),
            offset,
            55,
            0xFFFFFF);
        this.drawCenteredString(
            this.fontRenderer, "No mod information found", offset, 65, 0xDDDDDD);
        this.drawCenteredString(
            this.fontRenderer,
            "Ask your mod author to provide a mod mcmod.info file",
            offset,
            75,
            0xDDDDDD);
      }
      GL11.glDisable(GL11.GL_BLEND);
    }
    super.drawScreen(p_571_1_, p_571_2_, p_571_3_);
  }