コード例 #1
0
ファイル: GuiScreen.java プロジェクト: devoidoflife/panoply
  /** Handles mouse input. */
  public void handleMouseInput() throws IOException {
    int i = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
    int k = Mouse.getEventButton();

    if (Mouse.getEventButtonState()) {
      if (this.mc.gameSettings.touchscreen && this.touchValue++ > 0) {
        return;
      }

      this.eventButton = k;
      this.lastMouseEvent = Minecraft.getSystemTime();
      this.mouseClicked(i, j, this.eventButton);
    } else if (k != -1) {
      if (this.mc.gameSettings.touchscreen && --this.touchValue > 0) {
        return;
      }

      this.eventButton = -1;
      this.mouseReleased(i, j, k);
    } else if (this.eventButton != -1 && this.lastMouseEvent > 0L) {
      long l = Minecraft.getSystemTime() - this.lastMouseEvent;
      this.mouseClickMove(i, j, this.eventButton, l);
    }
  }
コード例 #2
0
 public static void renderEnchantmentEffects(Tessellator tessellator) {
   GL11.glDepthFunc(GL11.GL_EQUAL);
   GL11.glDisable(GL11.GL_LIGHTING);
   FMLClientHandler.instance().getClient().renderEngine.bindTexture(ITEM_GLINT);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
   float f7 = 0.76F;
   GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
   GL11.glMatrixMode(GL11.GL_TEXTURE);
   GL11.glPushMatrix();
   float f8 = 0.125F;
   GL11.glScalef(f8, f8, f8);
   float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
   GL11.glTranslatef(f9, 0.0F, 0.0F);
   GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
   RenderManager.instance.itemRenderer.renderItemIn2D(
       tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
   GL11.glPopMatrix();
   GL11.glPushMatrix();
   GL11.glScalef(f8, f8, f8);
   f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
   GL11.glTranslatef(-f9, 0.0F, 0.0F);
   GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
   RenderManager.instance.itemRenderer.renderItemIn2D(
       tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
   GL11.glPopMatrix();
   GL11.glMatrixMode(GL11.GL_MODELVIEW);
   GL11.glDisable(GL11.GL_BLEND);
   GL11.glEnable(GL11.GL_LIGHTING);
   GL11.glDepthFunc(GL11.GL_LEQUAL);
 }
コード例 #3
0
 public static void suspendControllerInput(boolean suspend, long maxTicksToSuspend) {
   if (suspend) {
     suspendStart = Minecraft.getSystemTime();
     suspendMax = maxTicksToSuspend;
   }
   ControllerSettings.suspendControllerInput = suspend;
   JoypadMouse.UnpressButtons();
 }
コード例 #4
0
 public static boolean isSuspended() {
   if (ControllerSettings.suspendControllerInput) {
     if (Minecraft.getSystemTime() - suspendStart > suspendMax) {
       ControllerSettings.suspendControllerInput = false;
     }
   }
   return ControllerSettings.suspendControllerInput;
 }
コード例 #5
0
  /** Draws the screen and all the components in it. */
  public void drawScreen(int par1, int par2, float par3) {
    this.renderSkybox(par1, par2, par3);
    Tessellator var4 = Tessellator.instance;
    short var5 = 274;
    int var6 = this.width / 2 - var5 / 2;
    byte var7 = 30;
    this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
    this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/title/mclogo.png"));
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    if ((double) this.updateCounter < 1.0E-4D) {
      this.drawTexturedModalRect(var6 + 0, var7 + 0, 0, 0, 99, 44);
      this.drawTexturedModalRect(var6 + 99, var7 + 0, 129, 0, 27, 44);
      this.drawTexturedModalRect(var6 + 99 + 26, var7 + 0, 126, 0, 3, 44);
      this.drawTexturedModalRect(var6 + 99 + 26 + 3, var7 + 0, 99, 0, 26, 44);
      this.drawTexturedModalRect(var6 + 155, var7 + 0, 0, 45, 155, 44);
    } else {
      this.drawTexturedModalRect(var6 + 0, var7 + 0, 0, 0, 155, 44);
      this.drawTexturedModalRect(var6 + 155, var7 + 0, 0, 45, 155, 44);
    }

    var4.setColorOpaque_I(16777215);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) (this.width / 2 + 90), 70.0F, 0.0F);
    GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F);
    float var8 =
        1.8F
            - MathHelper.abs(
                MathHelper.sin(
                        (float) (Minecraft.getSystemTime() % 1000L)
                            / 1000.0F
                            * (float) Math.PI
                            * 2.0F)
                    * 0.1F);
    var8 = var8 * 100.0F / (float) (this.fontRenderer.getStringWidth(this.splashText) + 32);
    GL11.glScalef(var8, var8, var8);
    this.drawCenteredString(this.fontRenderer, this.splashText, 0, -8, 16776960);
    GL11.glPopMatrix();
    String var9 = "Minecraft 1.3.2";

    if (this.mc.isDemo()) {
      var9 = var9 + " Demo";
    }

    this.drawString(this.fontRenderer, var9, 2, this.height - 10, 16777215);
    String var10 = "Copyright Mojang AB. Ported by Nick Parker";
    this.drawString(
        this.fontRenderer,
        var10,
        this.width - this.fontRenderer.getStringWidth(var10) - 2,
        this.height - 10,
        16777215);
    super.drawScreen(par1, par2, par3);
  }
コード例 #6
0
ファイル: SAOSlotGUI.java プロジェクト: Bluexin/SAOUI-mirror
  private void renderGlintSlot(int x, int y, int width, int height) {
    for (int j1 = 0; j1 < 2; ++j1) {
      OpenGlHelper.glBlendFunc(772, 1, 0, 0);
      float f = 0.00390625F;
      float f1 = 0.00390625F;
      float f2 =
          (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873))
              / (3000.0F + (float) (j1 * 1873))
              * 256.0F;
      float f3 = 0.0F;
      Tessellator tessellator = Tessellator.getInstance();
      WorldRenderer worldrenderer = tessellator.getWorldRenderer();
      float f4 = 4.0F;

      if (j1 == 1) {
        f4 = -1.0F;
      }

      tessellator.getWorldRenderer().startDrawingQuads();
      tessellator
          .getWorldRenderer()
          .addVertexWithUV(
              (double) (x),
              (double) (y + height),
              (double) itemRender.zLevel,
              (double) ((f2 + (float) height * f4) * f),
              (double) ((f3 + (float) height) * f1));
      tessellator
          .getWorldRenderer()
          .addVertexWithUV(
              (double) (x + width),
              (double) (y + height),
              (double) itemRender.zLevel,
              (double) ((f2 + (float) width + (float) height * f4) * f),
              (double) ((f3 + (float) height) * f1));
      tessellator
          .getWorldRenderer()
          .addVertexWithUV(
              (double) (x + width),
              (double) (y),
              (double) itemRender.zLevel,
              (double) ((f2 + (float) width) * f),
              (double) ((f3 + 0.0F) * f1));
      tessellator
          .getWorldRenderer()
          .addVertexWithUV(
              (double) (x),
              (double) (y),
              (double) itemRender.zLevel,
              (double) ((f2 + 0.0F) * f),
              (double) ((f3 + 0.0F) * f1));
      tessellator.draw();
    }
  }
コード例 #7
0
  private void renderGlint(int par1, int par2, int par3, int par4, int par5) {
    for (int j1 = 0; j1 < 2; ++j1) {
      if (j1 == 0) {
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
      }

      if (j1 == 1) {
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
      }

      float f = 0.00390625F;
      float f1 = 0.00390625F;
      float f2 =
          (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873))
              / (3000.0F + (float) (j1 * 1873))
              * 256.0F;
      float f3 = 0.0F;
      Tessellator tessellator = Tessellator.instance;
      float f4 = 4.0F;

      if (j1 == 1) {
        f4 = -1.0F;
      }

      tessellator.startDrawingQuads();
      tessellator.addVertexWithUV(
          (double) (par2 + 0),
          (double) (par3 + par5),
          (double) this.zLevel,
          (double) ((f2 + (float) par5 * f4) * f),
          (double) ((f3 + (float) par5) * f1));
      tessellator.addVertexWithUV(
          (double) (par2 + par4),
          (double) (par3 + par5),
          (double) this.zLevel,
          (double) ((f2 + (float) par4 + (float) par5 * f4) * f),
          (double) ((f3 + (float) par5) * f1));
      tessellator.addVertexWithUV(
          (double) (par2 + par4),
          (double) (par3 + 0),
          (double) this.zLevel,
          (double) ((f2 + (float) par4) * f),
          (double) ((f3 + 0.0F) * f1));
      tessellator.addVertexWithUV(
          (double) (par2 + 0),
          (double) (par3 + 0),
          (double) this.zLevel,
          (double) ((f2 + 0.0F) * f),
          (double) ((f3 + 0.0F) * f1));
      tessellator.draw();
    }
  }
コード例 #8
0
  public void resetBufferedImage(float translucency) {
    if ((this.resetsOnTick) || (this.image == null)) {
      BufferedImage screen =
          BlurHelper.captureScreenAsImage(
              EnhancedVisuals.mc.displayWidth, EnhancedVisuals.mc.displayHeight);
      BufferedImage scaledImage = BlurHelper.scaleImage(screen, this.blurScaling);
      ((BoxGlowFilter) this.filter).setRadius((int) (this.blurRadius * translucency));
      ((BoxGlowFilter) this.filter).setAmount(this.glowAmount * translucency);

      long time = Minecraft.getSystemTime();
      BufferedImage filtered = this.filter.filter(scaledImage, null);
      this.image = prepareImage(filtered);
    }
  }
コード例 #9
0
ファイル: Timer.java プロジェクト: DaMarine/Alkazia
  /** Updates all fields of the Timer using the current time */
  public void updateTimer() {
    long var1 = Minecraft.getSystemTime();
    long var3 = var1 - this.lastSyncSysClock;
    long var5 = System.nanoTime() / 1000000L;
    double var7 = (double) var5 / 1000.0D;

    if (var3 <= 1000L && var3 >= 0L) {
      this.field_74285_i += var3;

      if (this.field_74285_i > 1000L) {
        long var9 = var5 - this.lastSyncHRClock;
        double var11 = (double) this.field_74285_i / (double) var9;
        this.timeSyncAdjustment += (var11 - this.timeSyncAdjustment) * 0.20000000298023224D;
        this.lastSyncHRClock = var5;
        this.field_74285_i = 0L;
      }

      if (this.field_74285_i < 0L) {
        this.lastSyncHRClock = var5;
      }
    } else {
      this.lastHRTime = var7;
    }

    this.lastSyncSysClock = var1;
    double var13 = (var7 - this.lastHRTime) * this.timeSyncAdjustment;
    this.lastHRTime = var7;

    if (var13 < 0.0D) {
      var13 = 0.0D;
    }

    if (var13 > 1.0D) {
      var13 = 1.0D;
    }

    this.elapsedPartialTicks =
        (float)
            ((double) this.elapsedPartialTicks
                + var13 * (double) this.timerSpeed * (double) this.ticksPerSecond);
    this.elapsedTicks = (int) this.elapsedPartialTicks;
    this.elapsedPartialTicks -= (float) this.elapsedTicks;

    if (this.elapsedTicks > 10) {
      this.elapsedTicks = 10;
    }

    this.renderPartialTicks = this.elapsedPartialTicks;
  }
コード例 #10
0
  public void func_148279_a(
      int p_148279_1_,
      int p_148279_2_,
      int p_148279_3_,
      int p_148279_4_,
      int p_148279_5_,
      Tessellator p_148279_6_,
      int p_148279_7_,
      int p_148279_8_,
      boolean p_148279_9_) {
    int var10 = p_148279_3_ + p_148279_5_ / 2 - this.field_148288_a.fontRenderer.FONT_HEIGHT / 2;
    this.field_148288_a.fontRenderer.drawString(
        I18n.format("lanServer.scanning", new Object[0]),
        this.field_148288_a.currentScreen.width / 2
            - this.field_148288_a.fontRenderer.getStringWidth(
                    I18n.format("lanServer.scanning", new Object[0]))
                / 2,
        var10,
        16777215);
    String var11;

    switch ((int) (Minecraft.getSystemTime() / 300L % 4L)) {
      case 0:
      default:
        var11 = "O o o";
        break;

      case 1:
      case 3:
        var11 = "o O o";
        break;

      case 2:
        var11 = "o o O";
    }

    this.field_148288_a.fontRenderer.drawString(
        var11,
        this.field_148288_a.currentScreen.width / 2
            - this.field_148288_a.fontRenderer.getStringWidth(var11) / 2,
        var10 + this.field_148288_a.fontRenderer.FONT_HEIGHT,
        8421504);
  }
コード例 #11
0
 /** Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks */
 public void drawScreen(int mouseX, int mouseY, float partialTicks) {
   if (this.doesGuiPauseGame) {
     this.drawDefaultBackground();
     this.drawCenteredString(
         this.fontRenderer,
         Translator.format("multiplayer.downloadingStats", new Object[0]),
         this.width / 2,
         this.height / 2,
         16777215);
     this.drawCenteredString(
         this.fontRenderer,
         lanSearchStates[(int) (Minecraft.getSystemTime() / 150L % (long) lanSearchStates.length)],
         this.width / 2,
         this.height / 2 + this.fontRenderer.FONT_HEIGHT * 2,
         16777215);
   } else {
     this.displaySlot.drawScreen(mouseX, mouseY, partialTicks);
     this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215);
     super.drawScreen(mouseX, mouseY, partialTicks);
   }
 }
コード例 #12
0
  private void func_96293_a(int par1, int par2, int par3, McoServer par4McoServer) {
    if (par4McoServer.field_96403_g != null) {
      synchronized (GuiScreenOnlineServers.func_101007_h()) {
        if (GuiScreenOnlineServers.func_101010_i() < 5 && !par4McoServer.field_96411_l) {
          par4McoServer.field_96411_l = true;
          par4McoServer.field_96412_m = -2L;
          par4McoServer.field_96414_k = "";
          GuiScreenOnlineServers.func_101014_j();
          (new ThreadConnectToOnlineServer(this, par4McoServer)).start();
        }
      }

      boolean var5 = par4McoServer.field_96415_h > 60;
      boolean var6 = par4McoServer.field_96415_h < 60;
      boolean var7 = var5 || var6;

      if (par4McoServer.field_96414_k != null) {
        this.field_96294_a.drawString(
            GuiScreenOnlineServers.func_98079_k(this.field_96294_a),
            par4McoServer.field_96414_k,
            par2
                + 215
                - GuiScreenOnlineServers.func_98087_l(this.field_96294_a)
                    .getStringWidth(par4McoServer.field_96414_k),
            par3 + 12,
            8421504);
      }

      if (var7) {
        String var8 = EnumChatFormatting.DARK_RED + par4McoServer.field_96413_j;
        this.field_96294_a.drawString(
            GuiScreenOnlineServers.func_98074_m(this.field_96294_a),
            var8,
            par2
                + 200
                - GuiScreenOnlineServers.func_101000_n(this.field_96294_a).getStringWidth(var8),
            par3 + 1,
            8421504);
      }

      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GuiScreenOnlineServers.func_101004_o(this.field_96294_a)
          .renderEngine
          .func_98187_b("/gui/icons.png");
      byte var13 = 0;
      boolean var9 = false;
      String var10 = "";
      int var14;

      if (var7) {
        var10 = var5 ? "Client out of date!" : "Server out of date!";
        par4McoServer.field_96411_l = false;
        var14 = 5;
      } else if (par4McoServer.field_96411_l && par4McoServer.field_96412_m != -2L) {
        if (par4McoServer.field_96412_m < 0L) {
          var14 = 5;
        } else if (par4McoServer.field_96412_m < 150L) {
          var14 = 0;
        } else if (par4McoServer.field_96412_m < 300L) {
          var14 = 1;
        } else if (par4McoServer.field_96412_m < 600L) {
          var14 = 2;
        } else if (par4McoServer.field_96412_m < 1000L) {
          var14 = 3;
        } else {
          var14 = 4;
        }

        if (par4McoServer.field_96412_m < 0L) {
          var10 = "(no connection)";
          par4McoServer.field_96411_l = false;
        } else {
          var10 = par4McoServer.field_96412_m + "ms";
        }
      } else {
        var13 = 1;
        var14 = (int) (Minecraft.getSystemTime() / 100L + (long) (par1 * 2) & 7L);

        if (var14 > 4) {
          var14 = 8 - var14;
        }

        var10 = "Polling..";
      }

      this.field_96294_a.drawTexturedModalRect(
          par2 + 205, par3, 0 + var13 * 10, 176 + var14 * 8, 10, 8);
      byte var11 = 4;

      if (this.mouseX >= par2 + 205 - var11
          && this.mouseY >= par3 - var11
          && this.mouseX <= par2 + 205 + 10 + var11
          && this.mouseY <= par3 + 8 + var11) {
        GuiScreenOnlineServers.func_101011_a(this.field_96294_a, var10);
      }
    }
  }
コード例 #13
0
  /** Renders a dropped item */
  private void renderDroppedItem(
      ArrowEntity arrow, Icon par2Icon, int par3, float par4, float par5, float par6, float par7) {
    Tessellator tessellator = Tessellator.instance;

    if (par2Icon == null) {
      par2Icon =
          this.renderManager.renderEngine.getMissingIcon(
              arrow.getEntityItem().getItemSpriteNumber());
    }

    float f4 = par2Icon.getMinU();
    float f5 = par2Icon.getMaxU();
    float f6 = par2Icon.getMinV();
    float f7 = par2Icon.getMaxV();
    float f8 = 1.0F;
    float f9 = 0.5F;
    float f10 = 0.25F;
    float f11;

    GL11.glPushMatrix();
    /*float rotation = dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par7;
    GL11.glRotatef(dagger.rotationYaw + 90, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-rotation * 15, 0.0F, 0.0F, 1.0F);*/
    GL11.glRotatef(
        arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par4 - 90.0F,
        0.0F,
        1.0F,
        0.0F);
    GL11.glRotatef(
        arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par4 - 45.0F,
        0.0F,
        0.0F,
        1.0F);
    float f12 = 0.0625F;
    f11 = 0.021875F;
    ItemStack itemstack = arrow.getEntityItem();
    int j = itemstack.stackSize;
    byte b0 = getMiniItemCount(itemstack);

    GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));

    for (int k = 0; k < b0; ++k) {
      GL11.glTranslatef(0f, 0f, f12 + f11);

      if (itemstack.getItemSpriteNumber() == 0) {
        this.loadTexture("/terrain.png");
      } else {
        this.loadTexture("/gui/items.png");
      }

      GL11.glColor4f(par5, par6, par7, 1.0F);
      ItemRenderer.renderItemIn2D(
          tessellator, f5, f6, f4, f7, par2Icon.getSheetWidth(), par2Icon.getSheetHeight(), f12);

      if (itemstack != null && itemstack.hasEffect()) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);
        this.renderManager.renderEngine.bindTexture("%blur%/misc/glint.png");
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        float f13 = 0.76F;
        GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        float f14 = 0.125F;
        GL11.glScalef(f14, f14, f14);
        float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
        GL11.glTranslatef(f15, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(f14, f14, f14);
        f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
        GL11.glTranslatef(-f15, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
      }
    }

    GL11.glPopMatrix();
  }
コード例 #14
0
  public void func_76906_a(
      TileEntityEndPortal par1TileEntityEndPortal,
      double par2,
      double par4,
      double par6,
      float par8) {
    float var9 = (float) this.tileEntityRenderer.playerX;
    float var10 = (float) this.tileEntityRenderer.playerY;
    float var11 = (float) this.tileEntityRenderer.playerZ;
    GL11.glDisable(GL11.GL_LIGHTING);
    Random var12 = new Random(31100L);
    float var13 = 0.75F;

    for (int var14 = 0; var14 < 16; ++var14) {
      GL11.glPushMatrix();
      float var15 = (float) (16 - var14);
      float var16 = 0.0625F;
      float var17 = 1.0F / (var15 + 1.0F);

      if (var14 == 0) {
        this.bindTextureByName("/misc/tunnel.png");
        var17 = 0.1F;
        var15 = 65.0F;
        var16 = 0.125F;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      }

      if (var14 == 1) {
        this.bindTextureByName("/misc/particlefield.png");
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
        var16 = 0.5F;
      }

      float var18 = (float) (-(par4 + (double) var13));
      float var19 = var18 + ActiveRenderInfo.objectY;
      float var20 = var18 + var15 + ActiveRenderInfo.objectY;
      float var21 = var19 / var20;
      var21 += (float) (par4 + (double) var13);
      GL11.glTranslatef(var9, var21, var11);
      GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
      GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.func_76907_a(1.0F, 0.0F, 0.0F, 0.0F));
      GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.func_76907_a(0.0F, 0.0F, 1.0F, 0.0F));
      GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.func_76907_a(0.0F, 0.0F, 0.0F, 1.0F));
      GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, this.func_76907_a(0.0F, 1.0F, 0.0F, 0.0F));
      GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
      GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
      GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
      GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
      GL11.glPopMatrix();
      GL11.glMatrixMode(GL11.GL_TEXTURE);
      GL11.glPushMatrix();
      GL11.glLoadIdentity();
      GL11.glTranslatef(0.0F, (float) (Minecraft.getSystemTime() % 700000L) / 700000.0F, 0.0F);
      GL11.glScalef(var16, var16, var16);
      GL11.glTranslatef(0.5F, 0.5F, 0.0F);
      GL11.glRotatef((float) (var14 * var14 * 4321 + var14 * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
      GL11.glTranslatef(-var9, -var11, -var10);
      var19 = var18 + ActiveRenderInfo.objectY;
      GL11.glTranslatef(
          ActiveRenderInfo.objectX * var15 / var19,
          ActiveRenderInfo.objectZ * var15 / var19,
          -var10);
      Tessellator var24 = Tessellator.instance;
      var24.startDrawingQuads();
      var21 = var12.nextFloat() * 0.5F + 0.1F;
      float var22 = var12.nextFloat() * 0.5F + 0.4F;
      float var23 = var12.nextFloat() * 0.5F + 0.5F;

      if (var14 == 0) {
        var23 = 1.0F;
        var22 = 1.0F;
        var21 = 1.0F;
      }

      var24.setColorRGBA_F(var21 * var17, var22 * var17, var23 * var17, 1.0F);
      var24.addVertex(par2, par4 + (double) var13, par6);
      var24.addVertex(par2, par4 + (double) var13, par6 + 1.0D);
      var24.addVertex(par2 + 1.0D, par4 + (double) var13, par6 + 1.0D);
      var24.addVertex(par2 + 1.0D, par4 + (double) var13, par6);
      var24.draw();
      GL11.glPopMatrix();
      GL11.glMatrixMode(GL11.GL_MODELVIEW);
    }

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_R);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_Q);
    GL11.glEnable(GL11.GL_LIGHTING);
  }
コード例 #15
0
  /** Updates the progress bar on the loading screen to the specified amount. Args: loadProgress */
  public void setLoadingProgress(int progress) {
    if (!this.mc.running) {
      if (!this.field_73724_e) {
        throw new MinecraftError();
      }
    } else {
      long var2 = Minecraft.getSystemTime();

      if (var2 - this.field_73723_d >= 100L) {
        this.field_73723_d = var2;
        ScaledResolution var4 =
            new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
        int var5 = var4.getScaleFactor();
        int var6 = var4.getScaledWidth();
        int var7 = var4.getScaledHeight();

        if (OpenGlHelper.isFramebufferEnabled()) {
          this.field_146588_g.framebufferClear();
        } else {
          GlStateManager.clear(256);
        }

        this.field_146588_g.bindFramebuffer(false);
        GlStateManager.matrixMode(5889);
        GlStateManager.loadIdentity();
        GlStateManager.ortho(
            0.0D,
            var4.getScaledWidth_double(),
            var4.getScaledHeight_double(),
            0.0D,
            100.0D,
            300.0D);
        GlStateManager.matrixMode(5888);
        GlStateManager.loadIdentity();
        GlStateManager.translate(0.0F, 0.0F, -200.0F);

        if (!OpenGlHelper.isFramebufferEnabled()) {
          GlStateManager.clear(16640);
        }

        Tessellator var8 = Tessellator.getInstance();
        WorldRenderer var9 = var8.getWorldRenderer();
        this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
        float var10 = 32.0F;
        var9.startDrawingQuads();
        var9.func_178991_c(4210752);
        var9.addVertexWithUV(0.0D, (double) var7, 0.0D, 0.0D, (double) ((float) var7 / var10));
        var9.addVertexWithUV(
            (double) var6,
            (double) var7,
            0.0D,
            (double) ((float) var6 / var10),
            (double) ((float) var7 / var10));
        var9.addVertexWithUV((double) var6, 0.0D, 0.0D, (double) ((float) var6 / var10), 0.0D);
        var9.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
        var8.draw();

        if (progress >= 0) {
          byte var11 = 100;
          byte var12 = 2;
          int var13 = var6 / 2 - var11 / 2;
          int var14 = var7 / 2 + 16;
          GlStateManager.func_179090_x();
          var9.startDrawingQuads();
          var9.func_178991_c(8421504);
          var9.addVertex((double) var13, (double) var14, 0.0D);
          var9.addVertex((double) var13, (double) (var14 + var12), 0.0D);
          var9.addVertex((double) (var13 + var11), (double) (var14 + var12), 0.0D);
          var9.addVertex((double) (var13 + var11), (double) var14, 0.0D);
          var9.func_178991_c(8454016);
          var9.addVertex((double) var13, (double) var14, 0.0D);
          var9.addVertex((double) var13, (double) (var14 + var12), 0.0D);
          var9.addVertex((double) (var13 + progress), (double) (var14 + var12), 0.0D);
          var9.addVertex((double) (var13 + progress), (double) var14, 0.0D);
          var8.draw();
          GlStateManager.func_179098_w();
        }

        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
        this.mc.fontRendererObj.drawStringWithShadow(
            this.currentlyDisplayedText,
            (float)
                ((var6 - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2),
            (float) (var7 / 2 - 4 - 16),
            16777215);
        this.mc.fontRendererObj.drawStringWithShadow(
            this.field_73727_a,
            (float) ((var6 - this.mc.fontRendererObj.getStringWidth(this.field_73727_a)) / 2),
            (float) (var7 / 2 - 4 + 8),
            16777215);
        this.field_146588_g.unbindFramebuffer();

        if (OpenGlHelper.isFramebufferEnabled()) {
          this.field_146588_g.framebufferRender(var6 * var5, var7 * var5);
        }

        this.mc.func_175601_h();

        try {
          Thread.yield();
        } catch (Exception var15) {;
        }
      }
    }
  }
コード例 #16
0
  public void renderHealth(int width, int height) {
    bind(icons);
    if (pre(HEALTH)) return;
    mc.mcProfiler.startSection("health");
    GlStateManager.enableBlend();

    EntityPlayer player = (EntityPlayer) this.mc.getRenderViewEntity();
    int health = MathHelper.ceiling_float_int(player.getHealth());
    boolean highlight =
        healthUpdateCounter > (long) updateCounter
            && (healthUpdateCounter - (long) updateCounter) / 3L % 2L == 1L;

    if (health < this.playerHealth && player.hurtResistantTime > 0) {
      this.lastSystemTime = Minecraft.getSystemTime();
      this.healthUpdateCounter = (long) (this.updateCounter + 20);
    } else if (health > this.playerHealth && player.hurtResistantTime > 0) {
      this.lastSystemTime = Minecraft.getSystemTime();
      this.healthUpdateCounter = (long) (this.updateCounter + 10);
    }

    if (Minecraft.getSystemTime() - this.lastSystemTime > 1000L) {
      this.playerHealth = health;
      this.lastPlayerHealth = health;
      this.lastSystemTime = Minecraft.getSystemTime();
    }

    this.playerHealth = health;
    int healthLast = this.lastPlayerHealth;

    IAttributeInstance attrMaxHealth = player.getEntityAttribute(SharedMonsterAttributes.maxHealth);
    float healthMax = (float) attrMaxHealth.getAttributeValue();
    float absorb = player.getAbsorptionAmount();

    int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F);
    int rowHeight = Math.max(10 - (healthRows - 2), 3);

    this.rand.setSeed((long) (updateCounter * 312871));

    int left = width / 2 - 91;
    int top = height - left_height;
    left_height += (healthRows * rowHeight);
    if (rowHeight != 10) left_height += 10 - rowHeight;

    int regen = -1;
    if (player.isPotionActive(Potion.regeneration)) {
      regen = updateCounter % 25;
    }

    final int TOP = 9 * (mc.theWorld.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0);
    final int BACKGROUND = (highlight ? 25 : 16);
    int MARGIN = 16;
    if (player.isPotionActive(Potion.poison)) MARGIN += 36;
    else if (player.isPotionActive(Potion.wither)) MARGIN += 72;
    float absorbRemaining = absorb;

    for (int i = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F) - 1; i >= 0; --i) {
      // int b0 = (highlight ? 1 : 0);
      int row = MathHelper.ceiling_float_int((float) (i + 1) / 10.0F) - 1;
      int x = left + i % 10 * 8;
      int y = top - row * rowHeight;

      if (health <= 4) y += rand.nextInt(2);
      if (i == regen) y -= 2;

      drawTexturedModalRect(x, y, BACKGROUND, TOP, 9, 9);

      if (highlight) {
        if (i * 2 + 1 < healthLast) drawTexturedModalRect(x, y, MARGIN + 54, TOP, 9, 9); // 6
        else if (i * 2 + 1 == healthLast) drawTexturedModalRect(x, y, MARGIN + 63, TOP, 9, 9); // 7
      }

      if (absorbRemaining > 0.0F) {
        if (absorbRemaining == absorb && absorb % 2.0F == 1.0F)
          drawTexturedModalRect(x, y, MARGIN + 153, TOP, 9, 9); // 17
        else drawTexturedModalRect(x, y, MARGIN + 144, TOP, 9, 9); // 16
        absorbRemaining -= 2.0F;
      } else {
        if (i * 2 + 1 < health) drawTexturedModalRect(x, y, MARGIN + 36, TOP, 9, 9); // 4
        else if (i * 2 + 1 == health) drawTexturedModalRect(x, y, MARGIN + 45, TOP, 9, 9); // 5
      }
    }

    GlStateManager.disableBlend();
    mc.mcProfiler.endSection();
    post(HEALTH);
  }
コード例 #17
0
  @Override
  public void renderTileEntityAt(
      TileEntity tile, double x, double y, double z, float timeSinceLastTick) {
    if (tile == null || !(tile instanceof TileEnergyStorageCore)) return;
    TileEnergyStorageCore core = (TileEnergyStorageCore) tile;
    if (!core.isOnline()) return;
    float scale = 0;
    float rotation = core.modelRotation + (timeSinceLastTick / 2F);

    switch (core.getTier()) {
      case 0:
        scale = 0.7F;
        break;
      case 1:
        scale = 1.2F;
        break;
      case 2:
        scale = 1.7F;
        break;
      case 3:
        scale = 2.5F;
        break;
      case 4:
        scale = 3.5F;
        break;
      case 5:
        scale = 4.5F;
        break;
      case 6:
        scale = 5.5F;
        break;
    }

    GL11.glPushMatrix();
    GL11.glColor4f(1F, 1F, 1F, 1F);
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 150f, 150f);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(iner_model_texture);

    double colour =
        (double) ((TileEnergyStorageCore) tile).getEnergyStored()
            / (double) ((TileEnergyStorageCore) tile).getMaxEnergyStored();
    float brightness = (float) Math.abs(Math.sin((float) Minecraft.getSystemTime() / 3000f) * 100f);

    colour = 1f - colour;
    GL11.glScalef(scale, scale, scale);
    GL11.glPushMatrix();
    GL11.glRotatef(rotation, 0F, 1F, 0.5F);
    GL11.glColor4d(1F, colour * 0.3f, colour * 0.7f, 1F);
    OpenGlHelper.setLightmapTextureCoords(
        OpenGlHelper.lightmapTexUnit, 80f + brightness, 80f + brightness);
    iner_model.renderAll();
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glScalef(0.8F, 0.8F, 0.8F);
    GL11.glColor4d(1F, 1f, 0.2f, 1F);
    GL11.glRotatef(rotation, 0F, 1F, 0.5F);
    iner_model.renderAll();
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glScalef(0.9F, 0.9F, 0.9F);
    GL11.glColor4d(1F, 0f, 0.2f, 1F);
    GL11.glRotatef(rotation, 0F, 1F, 0.5F);
    iner_model.renderAll();
    GL11.glPopMatrix();

    GL11.glScalef(1.1F, 1.1F, 1.1F);
    GL11.glDepthMask(false);
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(outer_model_texture);
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200F, 200F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glRotatef(rotation * 0.5F, 0F, -1F, -0.5F);
    GL11.glColor4f(0.5F, 2F, 2F, 0.7F);
    iner_model.renderAll();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_LIGHTING);

    GL11.glPopMatrix();
  }
コード例 #18
0
  /** Renders the item stack for being in an entity's hand Args: itemStack */
  public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3) {
    GL11.glPushMatrix();

    Block block = null;
    if (par2ItemStack.getItem() instanceof ItemBlock
        && par2ItemStack.itemID < Block.blocksList.length) {
      block = Block.blocksList[par2ItemStack.itemID];
    }

    IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, EQUIPPED);

    if (customRenderer != null) {
      this.mc.renderEngine.bindTexture(
          par2ItemStack.getItemSpriteNumber() == 0 ? "/terrain.png" : "/gui/items.png");
      ForgeHooksClient.renderEquippedItem(
          customRenderer, renderBlocksInstance, par1EntityLiving, par2ItemStack);
    } else if (block != null
        && par2ItemStack.getItemSpriteNumber() == 0
        && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) {
      this.mc.renderEngine.bindTexture("/terrain.png");
      this.renderBlocksInstance.renderBlockAsItem(
          Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F);
    } else {
      Icon icon = par1EntityLiving.getItemIcon(par2ItemStack, par3);

      if (icon == null) {
        GL11.glPopMatrix();
        return;
      }

      if (par2ItemStack.getItemSpriteNumber() == 0) {
        this.mc.renderEngine.bindTexture("/terrain.png");
      } else {
        this.mc.renderEngine.bindTexture("/gui/items.png");
      }

      Tessellator tessellator = Tessellator.instance;
      float f = icon.getMinU();
      float f1 = icon.getMaxU();
      float f2 = icon.getMinV();
      float f3 = icon.getMaxV();
      float f4 = 0.0F;
      float f5 = 0.3F;
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      GL11.glTranslatef(-f4, -f5, 0.0F);
      float f6 = 1.5F;
      GL11.glScalef(f6, f6, f6);
      GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
      renderItemIn2D(
          tessellator, f1, f2, f, f3, icon.getSheetWidth(), icon.getSheetHeight(), 0.0625F);

      if (par2ItemStack != null && par2ItemStack.hasEffect() && par3 == 0) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);
        this.mc.renderEngine.bindTexture("%blur%/misc/glint.png");
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        float f7 = 0.76F;
        GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        float f8 = 0.125F;
        GL11.glScalef(f8, f8, f8);
        float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
        GL11.glTranslatef(f9, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(f8, f8, f8);
        f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
        GL11.glTranslatef(-f9, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
      }

      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    }

    GL11.glPopMatrix();
  }
コード例 #19
0
ファイル: GuiSlot.java プロジェクト: ammo123/Spoutcraft
  /** draws the slot to the screen, pass in mouse's current x and y and partial ticks */
  public void drawScreen(int par1, int par2, float par3) {
    this.mouseX = par1;
    this.mouseY = par2;
    this.drawBackground();
    int var4 = this.getSize();
    int var5 = this.getScrollBarX();
    int var6 = var5 + 6;
    int var9;
    int var10;
    int var11;
    int var13;
    int var19;

    if (Mouse.isButtonDown(0)) {
      if (this.initialClickY == -1.0F) {
        boolean var7 = true;

        if (par2 >= this.top && par2 <= this.bottom) {
          int var8 = this.width / 2 - 110;
          var9 = this.width / 2 + 110;
          var10 = par2 - this.top - this.field_77242_t + (int) this.amountScrolled - 4;
          var11 = var10 / this.slotHeight;

          if (par1 >= var8 && par1 <= var9 && var11 >= 0 && var10 >= 0 && var11 < var4) {
            boolean var12 =
                var11 == this.selectedElement
                    && Minecraft.getSystemTime() - this.lastClicked < 250L;
            this.elementClicked(var11, var12);
            this.selectedElement = var11;
            this.lastClicked = Minecraft.getSystemTime();
          } else if (par1 >= var8 && par1 <= var9 && var10 < 0) {
            this.func_77224_a(par1 - var8, par2 - this.top + (int) this.amountScrolled - 4);
            var7 = false;
          }

          if (par1 >= var5 && par1 <= var6) {
            this.scrollMultiplier = -1.0F;
            var19 = this.func_77209_d();

            if (var19 < 1) {
              var19 = 1;
            }

            var13 =
                (int)
                    ((float) ((this.bottom - this.top) * (this.bottom - this.top))
                        / (float) this.getContentHeight());

            if (var13 < 32) {
              var13 = 32;
            }

            if (var13 > this.bottom - this.top - 8) {
              var13 = this.bottom - this.top - 8;
            }

            this.scrollMultiplier /= (float) (this.bottom - this.top - var13) / (float) var19;
          } else {
            this.scrollMultiplier = 1.0F;
          }

          if (var7) {
            this.initialClickY = (float) par2;
          } else {
            this.initialClickY = -2.0F;
          }
        } else {
          this.initialClickY = -2.0F;
        }
      } else if (this.initialClickY >= 0.0F) {
        this.amountScrolled -= ((float) par2 - this.initialClickY) * this.scrollMultiplier;
        this.initialClickY = (float) par2;
      }
    } else {
      while (!this.mc.gameSettings.touchscreen && Mouse.next()) {
        int var16 = Mouse.getEventDWheel();

        if (var16 != 0) {
          if (var16 > 0) {
            var16 = -1;
          } else if (var16 < 0) {
            var16 = 1;
          }

          this.amountScrolled += (float) (var16 * this.slotHeight / 2);
        }
      }

      this.initialClickY = -1.0F;
    }

    this.bindAmountScrolled();
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_FOG);
    Tessellator var18 = Tessellator.instance;
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/background.png"));
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    float var17 = 32.0F;
    var18.startDrawingQuads();
    var18.setColorOpaque_I(2105376);
    var18.addVertexWithUV(
        (double) this.left,
        (double) this.bottom,
        0.0D,
        (double) ((float) this.left / var17),
        (double) ((float) (this.bottom + (int) this.amountScrolled) / var17));
    var18.addVertexWithUV(
        (double) this.right,
        (double) this.bottom,
        0.0D,
        (double) ((float) this.right / var17),
        (double) ((float) (this.bottom + (int) this.amountScrolled) / var17));
    var18.addVertexWithUV(
        (double) this.right,
        (double) this.top,
        0.0D,
        (double) ((float) this.right / var17),
        (double) ((float) (this.top + (int) this.amountScrolled) / var17));
    var18.addVertexWithUV(
        (double) this.left,
        (double) this.top,
        0.0D,
        (double) ((float) this.left / var17),
        (double) ((float) (this.top + (int) this.amountScrolled) / var17));
    var18.draw();
    var9 = this.width / 2 - 92 - 16;
    var10 = this.top + 4 - (int) this.amountScrolled;

    if (this.field_77243_s) {
      this.func_77222_a(var9, var10, var18);
    }

    int var14;

    for (var11 = 0; var11 < var4; ++var11) {
      var19 = var10 + var11 * this.slotHeight + this.field_77242_t;
      var13 = this.slotHeight - 4;

      if (var19 <= this.bottom && var19 + var13 >= this.top) {
        if (this.showSelectionBox && this.isSelected(var11)) {
          var14 = this.width / 2 - 110;
          int var15 = this.width / 2 + 110;
          GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
          GL11.glDisable(GL11.GL_TEXTURE_2D);
          var18.startDrawingQuads();
          var18.setColorOpaque_I(8421504);
          var18.addVertexWithUV((double) var14, (double) (var19 + var13 + 2), 0.0D, 0.0D, 1.0D);
          var18.addVertexWithUV((double) var15, (double) (var19 + var13 + 2), 0.0D, 1.0D, 1.0D);
          var18.addVertexWithUV((double) var15, (double) (var19 - 2), 0.0D, 1.0D, 0.0D);
          var18.addVertexWithUV((double) var14, (double) (var19 - 2), 0.0D, 0.0D, 0.0D);
          var18.setColorOpaque_I(0);
          var18.addVertexWithUV(
              (double) (var14 + 1), (double) (var19 + var13 + 1), 0.0D, 0.0D, 1.0D);
          var18.addVertexWithUV(
              (double) (var15 - 1), (double) (var19 + var13 + 1), 0.0D, 1.0D, 1.0D);
          var18.addVertexWithUV((double) (var15 - 1), (double) (var19 - 1), 0.0D, 1.0D, 0.0D);
          var18.addVertexWithUV((double) (var14 + 1), (double) (var19 - 1), 0.0D, 0.0D, 0.0D);
          var18.draw();
          GL11.glEnable(GL11.GL_TEXTURE_2D);
        }

        this.drawSlot(var11, var9, var19, var13, var18);
      }
    }

    GL11.glDisable(GL11.GL_DEPTH_TEST);
    byte var20 = 4;
    this.overlayBackground(0, this.top, 255, 255);
    this.overlayBackground(this.bottom, this.height, 255, 255);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    var18.startDrawingQuads();
    var18.setColorRGBA_I(0, 0);
    var18.addVertexWithUV((double) this.left, (double) (this.top + var20), 0.0D, 0.0D, 1.0D);
    var18.addVertexWithUV((double) this.right, (double) (this.top + var20), 0.0D, 1.0D, 1.0D);
    var18.setColorRGBA_I(0, 255);
    var18.addVertexWithUV((double) this.right, (double) this.top, 0.0D, 1.0D, 0.0D);
    var18.addVertexWithUV((double) this.left, (double) this.top, 0.0D, 0.0D, 0.0D);
    var18.draw();
    var18.startDrawingQuads();
    var18.setColorRGBA_I(0, 255);
    var18.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, 0.0D, 1.0D);
    var18.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, 1.0D, 1.0D);
    var18.setColorRGBA_I(0, 0);
    var18.addVertexWithUV((double) this.right, (double) (this.bottom - var20), 0.0D, 1.0D, 0.0D);
    var18.addVertexWithUV((double) this.left, (double) (this.bottom - var20), 0.0D, 0.0D, 0.0D);
    var18.draw();
    var19 = this.func_77209_d();

    if (var19 > 0) {
      var13 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight();

      if (var13 < 32) {
        var13 = 32;
      }

      if (var13 > this.bottom - this.top - 8) {
        var13 = this.bottom - this.top - 8;
      }

      var14 = (int) this.amountScrolled * (this.bottom - this.top - var13) / var19 + this.top;

      if (var14 < this.top) {
        var14 = this.top;
      }

      var18.startDrawingQuads();
      var18.setColorRGBA_I(0, 255);
      var18.addVertexWithUV((double) var5, (double) this.bottom, 0.0D, 0.0D, 1.0D);
      var18.addVertexWithUV((double) var6, (double) this.bottom, 0.0D, 1.0D, 1.0D);
      var18.addVertexWithUV((double) var6, (double) this.top, 0.0D, 1.0D, 0.0D);
      var18.addVertexWithUV((double) var5, (double) this.top, 0.0D, 0.0D, 0.0D);
      var18.draw();
      var18.startDrawingQuads();
      var18.setColorRGBA_I(8421504, 255);
      var18.addVertexWithUV((double) var5, (double) (var14 + var13), 0.0D, 0.0D, 1.0D);
      var18.addVertexWithUV((double) var6, (double) (var14 + var13), 0.0D, 1.0D, 1.0D);
      var18.addVertexWithUV((double) var6, (double) var14, 0.0D, 1.0D, 0.0D);
      var18.addVertexWithUV((double) var5, (double) var14, 0.0D, 0.0D, 0.0D);
      var18.draw();
      var18.startDrawingQuads();
      var18.setColorRGBA_I(12632256, 255);
      var18.addVertexWithUV((double) var5, (double) (var14 + var13 - 1), 0.0D, 0.0D, 1.0D);
      var18.addVertexWithUV((double) (var6 - 1), (double) (var14 + var13 - 1), 0.0D, 1.0D, 1.0D);
      var18.addVertexWithUV((double) (var6 - 1), (double) var14, 0.0D, 1.0D, 0.0D);
      var18.addVertexWithUV((double) var5, (double) var14, 0.0D, 0.0D, 0.0D);
      var18.draw();
    }

    this.func_77215_b(par1, par2);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_BLEND);
  }
コード例 #20
0
ファイル: GuiAchievements.java プロジェクト: JelkeNelisse/Mod
  protected void genAchievementBackground(int par1, int par2, float par3) {
    int var4 =
        MathHelper.floor_double(
            this.field_74117_m + (this.guiMapX - this.field_74117_m) * (double) par3);
    int var5 =
        MathHelper.floor_double(
            this.field_74115_n + (this.guiMapY - this.field_74115_n) * (double) par3);

    if (var4 < guiMapTop) {
      var4 = guiMapTop;
    }

    if (var5 < guiMapLeft) {
      var5 = guiMapLeft;
    }

    if (var4 >= guiMapBottom) {
      var4 = guiMapBottom - 1;
    }

    if (var5 >= guiMapRight) {
      var5 = guiMapRight - 1;
    }

    int var6 = this.mc.renderEngine.getTexture("/terrain.png");
    int var7 = this.mc.renderEngine.getTexture("/achievement/bg.png");
    int var8 = (this.width - this.achievementsPaneWidth) / 2;
    int var9 = (this.height - this.achievementsPaneHeight) / 2;
    int var10 = var8 + 16;
    int var11 = var9 + 17;
    this.zLevel = 0.0F;
    GL11.glDepthFunc(GL11.GL_GEQUAL);
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, 0.0F, -200.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    this.mc.renderEngine.bindTexture(var6);
    int var12 = var4 + 288 >> 4;
    int var13 = var5 + 288 >> 4;
    int var14 = (var4 + 288) % 16;
    int var15 = (var5 + 288) % 16;
    Random var21 = new Random();
    int var22;
    int var25;
    int var24;
    int var26;

    for (var22 = 0; var22 * 16 - var15 < 155; ++var22) {
      float var23 = 0.6F - (float) (var13 + var22) / 25.0F * 0.3F;
      GL11.glColor4f(var23, var23, var23, 1.0F);

      for (var24 = 0; var24 * 16 - var14 < 224; ++var24) {
        var21.setSeed((long) (1234 + var12 + var24));
        var21.nextInt();
        var25 = var21.nextInt(1 + var13 + var22) + (var13 + var22) / 2;
        var26 = Block.sand.blockIndexInTexture;

        if (var25 <= 37 && var13 + var22 != 35) {
          if (var25 == 22) {
            if (var21.nextInt(2) == 0) {
              var26 = Block.oreDiamond.blockIndexInTexture;
            } else {
              var26 = Block.oreRedstone.blockIndexInTexture;
            }
          } else if (var25 == 10) {
            var26 = Block.oreIron.blockIndexInTexture;
          } else if (var25 == 8) {
            var26 = Block.oreCoal.blockIndexInTexture;
          } else if (var25 > 4) {
            var26 = Block.stone.blockIndexInTexture;
          } else if (var25 > 0) {
            var26 = Block.dirt.blockIndexInTexture;
          }
        } else {
          var26 = Block.bedrock.blockIndexInTexture;
        }

        this.drawTexturedModalRect(
            var10 + var24 * 16 - var14,
            var11 + var22 * 16 - var15,
            var26 % 16 << 4,
            var26 >> 4 << 4,
            16,
            16);
      }
    }

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    int var27;
    int var30;
    List<Achievement> achievementList =
        (currentPage == -1
            ? minecraftAchievements
            : AchievementPage.getAchievementPage(currentPage).getAchievements());

    for (var22 = 0; var22 < achievementList.size(); ++var22) {
      Achievement var33 = achievementList.get(var22);

      if (var33.parentAchievement != null && achievementList.contains(var33.parentAchievement)) {
        var24 = var33.displayColumn * 24 - var4 + 11 + var10;
        var25 = var33.displayRow * 24 - var5 + 11 + var11;
        var26 = var33.parentAchievement.displayColumn * 24 - var4 + 11 + var10;
        var27 = var33.parentAchievement.displayRow * 24 - var5 + 11 + var11;
        boolean var28 = this.statFileWriter.hasAchievementUnlocked(var33);
        boolean var29 = this.statFileWriter.canUnlockAchievement(var33);
        var30 =
            Math.sin((double) (Minecraft.getSystemTime() % 600L) / 600.0D * Math.PI * 2.0D) > 0.6D
                ? 255
                : 130;
        int var31 = -16777216;

        if (var28) {
          var31 = -9408400;
        } else if (var29) {
          var31 = 65280 + (var30 << 24);
        }

        this.drawHorizontalLine(var24, var26, var25, var31);
        this.drawVerticalLine(var26, var25, var27, var31);
      }
    }

    Achievement var32 = null;
    RenderItem var37 = new RenderItem();
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    int var42;
    int var41;

    for (var24 = 0; var24 < achievementList.size(); ++var24) {
      Achievement var35 = achievementList.get(var24);
      var26 = var35.displayColumn * 24 - var4;
      var27 = var35.displayRow * 24 - var5;

      if (var26 >= -24 && var27 >= -24 && var26 <= 224 && var27 <= 155) {
        float var38;

        if (this.statFileWriter.hasAchievementUnlocked(var35)) {
          var38 = 1.0F;
          GL11.glColor4f(var38, var38, var38, 1.0F);
        } else if (this.statFileWriter.canUnlockAchievement(var35)) {
          var38 =
              Math.sin((double) (Minecraft.getSystemTime() % 600L) / 600.0D * Math.PI * 2.0D) < 0.6D
                  ? 0.6F
                  : 0.8F;
          GL11.glColor4f(var38, var38, var38, 1.0F);
        } else {
          var38 = 0.3F;
          GL11.glColor4f(var38, var38, var38, 1.0F);
        }

        this.mc.renderEngine.bindTexture(var7);
        var42 = var10 + var26;
        var41 = var11 + var27;

        if (var35.getSpecial()) {
          this.drawTexturedModalRect(var42 - 2, var41 - 2, 26, 202, 26, 26);
        } else {
          this.drawTexturedModalRect(var42 - 2, var41 - 2, 0, 202, 26, 26);
        }

        if (!this.statFileWriter.canUnlockAchievement(var35)) {
          float var40 = 0.1F;
          GL11.glColor4f(var40, var40, var40, 1.0F);
          var37.field_77024_a = false;
        }

        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_CULL_FACE);
        var37.renderItemAndEffectIntoGUI(
            this.mc.fontRenderer, this.mc.renderEngine, var35.theItemStack, var42 + 3, var41 + 3);
        GL11.glDisable(GL11.GL_LIGHTING);

        if (!this.statFileWriter.canUnlockAchievement(var35)) {
          var37.field_77024_a = true;
        }

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        if (par1 >= var10
            && par2 >= var11
            && par1 < var10 + 224
            && par2 < var11 + 155
            && par1 >= var42
            && par1 <= var42 + 22
            && par2 >= var41
            && par2 <= var41 + 22) {
          var32 = var35;
        }
      }
    }

    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(var7);
    this.drawTexturedModalRect(
        var8, var9, 0, 0, this.achievementsPaneWidth, this.achievementsPaneHeight);
    GL11.glPopMatrix();
    this.zLevel = 0.0F;
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    super.drawScreen(par1, par2, par3);

    if (var32 != null) {
      String var34 = StatCollector.translateToLocal(var32.getName());
      String var36 = var32.getDescription();
      var26 = par1 + 12;
      var27 = par2 - 4;

      if (this.statFileWriter.canUnlockAchievement(var32)) {
        var42 = Math.max(this.fontRenderer.getStringWidth(var34), 120);
        var41 = this.fontRenderer.splitStringWidth(var36, var42);

        if (this.statFileWriter.hasAchievementUnlocked(var32)) {
          var41 += 12;
        }

        this.drawGradientRect(
            var26 - 3,
            var27 - 3,
            var26 + var42 + 3,
            var27 + var41 + 3 + 12,
            -1073741824,
            -1073741824);
        this.fontRenderer.drawSplitString(var36, var26, var27 + 12, var42, -6250336);

        if (this.statFileWriter.hasAchievementUnlocked(var32)) {
          this.fontRenderer.drawStringWithShadow(
              StatCollector.translateToLocal("achievement.taken"),
              var26,
              var27 + var41 + 4,
              -7302913);
        }
      } else {
        var42 = Math.max(this.fontRenderer.getStringWidth(var34), 120);
        String var39 =
            StatCollector.translateToLocalFormatted(
                "achievement.requires",
                new Object[] {StatCollector.translateToLocal(var32.parentAchievement.getName())});
        var30 = this.fontRenderer.splitStringWidth(var39, var42);
        this.drawGradientRect(
            var26 - 3,
            var27 - 3,
            var26 + var42 + 3,
            var27 + var30 + 12 + 3,
            -1073741824,
            -1073741824);
        this.fontRenderer.drawSplitString(var39, var26, var27 + 12, var42, -9416624);
      }

      this.fontRenderer.drawStringWithShadow(
          var34,
          var26,
          var27,
          this.statFileWriter.canUnlockAchievement(var32)
              ? (var32.getSpecial() ? -128 : -1)
              : (var32.getSpecial() ? -8355776 : -8355712));
    }

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_LIGHTING);
    RenderHelper.disableStandardItemLighting();
  }
コード例 #21
0
public class LoadingScreenRenderer implements IProgressUpdate {
  private String field_73727_a = "";

  /** A reference to the Minecraft object. */
  private Minecraft mc;

  /**
   * The text currently displayed (i.e. the argument to the last call to printText or func_73722_d)
   */
  private String currentlyDisplayedText = "";

  private long field_73723_d = Minecraft.getSystemTime();
  private boolean field_73724_e;
  private ScaledResolution field_146587_f;
  private Framebuffer field_146588_g;

  public LoadingScreenRenderer(Minecraft mcIn) {
    this.mc = mcIn;
    this.field_146587_f = new ScaledResolution(mcIn, mcIn.displayWidth, mcIn.displayHeight);
    this.field_146588_g = new Framebuffer(mcIn.displayWidth, mcIn.displayHeight, false);
    this.field_146588_g.setFramebufferFilter(9728);
  }

  /**
   * this string, followed by "working..." and then the "% complete" are the 3 lines shown. This
   * resets progress to 0, and the WorkingString to "working...".
   */
  public void resetProgressAndMessage(String p_73721_1_) {
    this.field_73724_e = false;
    this.func_73722_d(p_73721_1_);
  }

  /** Shows the 'Saving level' string. */
  public void displaySavingString(String message) {
    this.field_73724_e = true;
    this.func_73722_d(message);
  }

  private void func_73722_d(String p_73722_1_) {
    this.currentlyDisplayedText = p_73722_1_;

    if (!this.mc.running) {
      if (!this.field_73724_e) {
        throw new MinecraftError();
      }
    } else {
      GlStateManager.clear(256);
      GlStateManager.matrixMode(5889);
      GlStateManager.loadIdentity();

      if (OpenGlHelper.isFramebufferEnabled()) {
        int var2 = this.field_146587_f.getScaleFactor();
        GlStateManager.ortho(
            0.0D,
            (double) (this.field_146587_f.getScaledWidth() * var2),
            (double) (this.field_146587_f.getScaledHeight() * var2),
            0.0D,
            100.0D,
            300.0D);
      } else {
        ScaledResolution var3 =
            new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
        GlStateManager.ortho(
            0.0D,
            var3.getScaledWidth_double(),
            var3.getScaledHeight_double(),
            0.0D,
            100.0D,
            300.0D);
      }

      GlStateManager.matrixMode(5888);
      GlStateManager.loadIdentity();
      GlStateManager.translate(0.0F, 0.0F, -200.0F);
    }
  }

  /** Displays a string on the loading screen supposed to indicate what is being done currently. */
  public void displayLoadingString(String message) {
    if (!this.mc.running) {
      if (!this.field_73724_e) {
        throw new MinecraftError();
      }
    } else {
      this.field_73723_d = 0L;
      this.field_73727_a = message;
      this.setLoadingProgress(-1);
      this.field_73723_d = 0L;
    }
  }

  /** Updates the progress bar on the loading screen to the specified amount. Args: loadProgress */
  public void setLoadingProgress(int progress) {
    if (!this.mc.running) {
      if (!this.field_73724_e) {
        throw new MinecraftError();
      }
    } else {
      long var2 = Minecraft.getSystemTime();

      if (var2 - this.field_73723_d >= 100L) {
        this.field_73723_d = var2;
        ScaledResolution var4 =
            new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
        int var5 = var4.getScaleFactor();
        int var6 = var4.getScaledWidth();
        int var7 = var4.getScaledHeight();

        if (OpenGlHelper.isFramebufferEnabled()) {
          this.field_146588_g.framebufferClear();
        } else {
          GlStateManager.clear(256);
        }

        this.field_146588_g.bindFramebuffer(false);
        GlStateManager.matrixMode(5889);
        GlStateManager.loadIdentity();
        GlStateManager.ortho(
            0.0D,
            var4.getScaledWidth_double(),
            var4.getScaledHeight_double(),
            0.0D,
            100.0D,
            300.0D);
        GlStateManager.matrixMode(5888);
        GlStateManager.loadIdentity();
        GlStateManager.translate(0.0F, 0.0F, -200.0F);

        if (!OpenGlHelper.isFramebufferEnabled()) {
          GlStateManager.clear(16640);
        }

        Tessellator var8 = Tessellator.getInstance();
        WorldRenderer var9 = var8.getWorldRenderer();
        this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
        float var10 = 32.0F;
        var9.startDrawingQuads();
        var9.func_178991_c(4210752);
        var9.addVertexWithUV(0.0D, (double) var7, 0.0D, 0.0D, (double) ((float) var7 / var10));
        var9.addVertexWithUV(
            (double) var6,
            (double) var7,
            0.0D,
            (double) ((float) var6 / var10),
            (double) ((float) var7 / var10));
        var9.addVertexWithUV((double) var6, 0.0D, 0.0D, (double) ((float) var6 / var10), 0.0D);
        var9.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
        var8.draw();

        if (progress >= 0) {
          byte var11 = 100;
          byte var12 = 2;
          int var13 = var6 / 2 - var11 / 2;
          int var14 = var7 / 2 + 16;
          GlStateManager.func_179090_x();
          var9.startDrawingQuads();
          var9.func_178991_c(8421504);
          var9.addVertex((double) var13, (double) var14, 0.0D);
          var9.addVertex((double) var13, (double) (var14 + var12), 0.0D);
          var9.addVertex((double) (var13 + var11), (double) (var14 + var12), 0.0D);
          var9.addVertex((double) (var13 + var11), (double) var14, 0.0D);
          var9.func_178991_c(8454016);
          var9.addVertex((double) var13, (double) var14, 0.0D);
          var9.addVertex((double) var13, (double) (var14 + var12), 0.0D);
          var9.addVertex((double) (var13 + progress), (double) (var14 + var12), 0.0D);
          var9.addVertex((double) (var13 + progress), (double) var14, 0.0D);
          var8.draw();
          GlStateManager.func_179098_w();
        }

        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
        this.mc.fontRendererObj.drawStringWithShadow(
            this.currentlyDisplayedText,
            (float)
                ((var6 - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2),
            (float) (var7 / 2 - 4 - 16),
            16777215);
        this.mc.fontRendererObj.drawStringWithShadow(
            this.field_73727_a,
            (float) ((var6 - this.mc.fontRendererObj.getStringWidth(this.field_73727_a)) / 2),
            (float) (var7 / 2 - 4 + 8),
            16777215);
        this.field_146588_g.unbindFramebuffer();

        if (OpenGlHelper.isFramebufferEnabled()) {
          this.field_146588_g.framebufferRender(var6 * var5, var7 * var5);
        }

        this.mc.func_175601_h();

        try {
          Thread.yield();
        } catch (Exception var15) {;
        }
      }
    }
  }

  public void setDoneWorking() {}
}
コード例 #22
0
  public static void renderItem(EntityLivingBase entity, ItemStack itemStack, int renderPass) {
    TextureManager texturemanager = FMLClientHandler.instance().getClient().getTextureManager();
    Item item = itemStack.getItem();
    Block block = Block.getBlockFromItem(item);

    GL11.glPushMatrix();
    if (itemStack.getItemSpriteNumber() == 0
        && item instanceof ItemBlock
        && RenderBlocks.renderItemIn3d(block.getRenderType())) {
      texturemanager.bindTexture(texturemanager.getResourceLocation(0));

      if (itemStack != null && block != null && block.getRenderBlockPass() != 0) {
        GL11.glDepthMask(false);
        RenderHelper.BLOCK_RENDERER.renderBlockAsItem(block, itemStack.getItemDamage(), 1.0F);
        GL11.glDepthMask(true);
      } else {
        RenderHelper.BLOCK_RENDERER.renderBlockAsItem(block, itemStack.getItemDamage(), 1.0F);
      }
    } else {
      IIcon iicon = entity.getItemIcon(itemStack, renderPass);
      if (iicon == null) {
        GL11.glPopMatrix();
        return;
      }

      texturemanager.bindTexture(
          texturemanager.getResourceLocation(itemStack.getItemSpriteNumber()));
      TextureUtil.func_152777_a(false, false, 1.0F);
      Tessellator tessellator = Tessellator.instance;
      float minU = iicon.getMinU();
      float maxU = iicon.getMaxU();
      float minV = iicon.getMinV();
      float maxV = iicon.getMaxV();
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      GL11.glTranslatef(0.0F, -0.3F, 0.0F);
      GL11.glScalef(1.5F, 1.5F, 1.5F);
      GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
      ItemRenderer.renderItemIn2D(
          tessellator,
          maxU,
          minV,
          minU,
          maxV,
          iicon.getIconWidth(),
          iicon.getIconHeight(),
          0.0625F);

      if (itemStack.hasEffect(renderPass)) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);
        texturemanager.bindTexture(RenderHelper.RES_ITEM_GLINT);
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(768, 1, 1, 0);
        GL11.glColor4f(0.38F, 0.19F, 0.608F, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);

        GL11.glPushMatrix();
        GL11.glScalef(0.125F, 0.125F, 0.125F);
        float animOffset = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F;
        GL11.glTranslatef(animOffset, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        GL11.glScalef(0.125F, 0.125F, 0.125F);
        animOffset = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F;
        GL11.glTranslatef(-animOffset, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
        GL11.glPopMatrix();

        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
      }

      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
      texturemanager.bindTexture(
          texturemanager.getResourceLocation(itemStack.getItemSpriteNumber()));
      TextureUtil.func_147945_b();
    }
    if (itemStack != null && block != null && block.getRenderBlockPass() != 0) {
      GL11.glDisable(GL11.GL_BLEND);
    }
    GL11.glPopMatrix();
  }
コード例 #23
0
  /** Draws the screen and all the components in it. */
  public void drawScreen(int par1, int par2, float par3) {
    this.renderSkybox(par1, par2, par3);
    Tessellator var4 = Tessellator.instance;
    short var5 = 274;
    int var6 = this.width / 2 - var5 / 2;
    byte var7 = 30;
    this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
    this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
    this.mc.renderEngine.func_98187_b("/title/mclogo.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    if ((double) this.updateCounter < 1.0E-4D) {
      this.drawTexturedModalRect(var6 + 0, var7 + 0, 0, 0, 99, 44);
      this.drawTexturedModalRect(var6 + 99, var7 + 0, 129, 0, 27, 44);
      this.drawTexturedModalRect(var6 + 99 + 26, var7 + 0, 126, 0, 3, 44);
      this.drawTexturedModalRect(var6 + 99 + 26 + 3, var7 + 0, 99, 0, 26, 44);
      this.drawTexturedModalRect(var6 + 155, var7 + 0, 0, 45, 155, 44);
    } else {
      this.drawTexturedModalRect(var6 + 0, var7 + 0, 0, 0, 155, 44);
      this.drawTexturedModalRect(var6 + 155, var7 + 0, 0, 45, 155, 44);
    }

    var4.setColorOpaque_I(16777215);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) (this.width / 2 + 90), 70.0F, 0.0F);
    GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F);
    float var8 =
        1.8F
            - MathHelper.abs(
                MathHelper.sin(
                        (float) (Minecraft.getSystemTime() % 1000L)
                            / 1000.0F
                            * (float) Math.PI
                            * 2.0F)
                    * 0.1F);
    var8 = var8 * 100.0F / (float) (this.fontRenderer.getStringWidth(this.splashText) + 32);
    GL11.glScalef(var8, var8, var8);
    this.drawCenteredString(this.fontRenderer, this.splashText, 0, -8, 16776960);
    GL11.glPopMatrix();
    String var9 = "Minecraft 1.5";

    if (this.mc.isDemo()) {
      var9 = var9 + " Demo";
    }

    this.drawString(this.fontRenderer, var9, 2, this.height - 10, 16777215);
    String var10 = "Copyright Mojang AB. Do not distribute!";
    this.drawString(
        this.fontRenderer,
        var10,
        this.width - this.fontRenderer.getStringWidth(var10) - 2,
        this.height - 10,
        16777215);

    if (this.field_92025_p != null && this.field_92025_p.length() > 0) {
      drawRect(
          this.field_92022_t - 2,
          this.field_92021_u - 2,
          this.field_92020_v + 2,
          this.field_92019_w - 1,
          1428160512);
      this.drawString(
          this.fontRenderer, this.field_92025_p, this.field_92022_t, this.field_92021_u, 16777215);
      this.drawString(
          this.fontRenderer,
          field_96138_a,
          (this.width - this.field_92024_r) / 2,
          ((GuiButton) this.buttonList.get(0)).yPosition - 12,
          16777215);
    }

    super.drawScreen(par1, par2, par3);
  }
コード例 #24
0
ファイル: Timer.java プロジェクト: DaMarine/Alkazia
 public Timer(float par1) {
   this.ticksPerSecond = par1;
   this.lastSyncSysClock = Minecraft.getSystemTime();
   this.lastSyncHRClock = System.nanoTime() / 1000000L;
 }
コード例 #25
0
  private void func_77247_d(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) {
    ServerData serverdata =
        GuiMultiplayer.getInternetServerList(this.parentGui).getServerData(par1);

    synchronized (GuiMultiplayer.getLock()) {
      if (GuiMultiplayer.getThreadsPending() < 5 && !serverdata.field_78841_f) {
        serverdata.field_78841_f = true;
        serverdata.pingToServer = -2L;
        serverdata.serverMOTD = "";
        serverdata.populationInfo = "";
        GuiMultiplayer.increaseThreadsPending();
        (new ThreadPollServers(this, serverdata)).start();
      }
    }

    boolean flag = serverdata.field_82821_f > 61;
    boolean flag1 = serverdata.field_82821_f < 61;
    boolean flag2 = flag || flag1;
    this.parentGui.drawString(
        this.parentGui.fontRenderer, serverdata.serverName, par2 + 2, par3 + 1, 16777215);
    this.parentGui.drawString(
        this.parentGui.fontRenderer, serverdata.serverMOTD, par2 + 2, par3 + 12, 8421504);
    this.parentGui.drawString(
        this.parentGui.fontRenderer,
        serverdata.populationInfo,
        par2 + 215 - this.parentGui.fontRenderer.getStringWidth(serverdata.populationInfo),
        par3 + 12,
        8421504);

    if (flag2) {
      String s = EnumChatFormatting.DARK_RED + serverdata.gameVersion;
      this.parentGui.drawString(
          this.parentGui.fontRenderer,
          s,
          par2 + 200 - this.parentGui.fontRenderer.getStringWidth(s),
          par3 + 1,
          8421504);
    }

    if (!this.parentGui.mc.gameSettings.hideServerAddress && !serverdata.isHidingAddress()) {
      this.parentGui.drawString(
          this.parentGui.fontRenderer, serverdata.serverIP, par2 + 2, par3 + 12 + 11, 3158064);
    } else {
      this.parentGui.drawString(
          this.parentGui.fontRenderer,
          StatCollector.translateToLocal("selectServer.hiddenAddress"),
          par2 + 2,
          par3 + 12 + 11,
          3158064);
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.parentGui.mc.renderEngine.bindTexture("/gui/icons.png");
    byte b0 = 0;
    boolean flag3 = false;
    String s1 = "";
    int i1;

    if (flag2) {
      s1 = flag ? "Client out of date!" : "Server out of date!";
      i1 = 5;
    } else if (serverdata.field_78841_f && serverdata.pingToServer != -2L) {
      if (serverdata.pingToServer < 0L) {
        i1 = 5;
      } else if (serverdata.pingToServer < 150L) {
        i1 = 0;
      } else if (serverdata.pingToServer < 300L) {
        i1 = 1;
      } else if (serverdata.pingToServer < 600L) {
        i1 = 2;
      } else if (serverdata.pingToServer < 1000L) {
        i1 = 3;
      } else {
        i1 = 4;
      }

      if (serverdata.pingToServer < 0L) {
        s1 = "(no connection)";
      } else {
        s1 = serverdata.pingToServer + "ms";
      }
    } else {
      b0 = 1;
      i1 = (int) (Minecraft.getSystemTime() / 100L + (long) (par1 * 2) & 7L);

      if (i1 > 4) {
        i1 = 8 - i1;
      }

      s1 = "Polling..";
    }

    this.parentGui.drawTexturedModalRect(par2 + 205, par3, 0 + b0 * 10, 176 + i1 * 8, 10, 8);
    byte b1 = 4;

    if (this.mouseX >= par2 + 205 - b1
        && this.mouseY >= par3 - b1
        && this.mouseX <= par2 + 205 + 10 + b1
        && this.mouseY <= par3 + 8 + b1) {
      GuiMultiplayer.getAndSetLagTooltip(this.parentGui, s1);
    }
  }
コード例 #26
0
  /** Renders the item stack for being in an entity's hand Args: itemStack */
  public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3) {
    GL11.glPushMatrix();
    Block var4 = null;

    if (par2ItemStack.itemID < Block.blocksList.length) {
      var4 = Block.blocksList[par2ItemStack.itemID];
    }

    if (var4 != null && RenderBlocks.renderItemIn3d(var4.getRenderType())) {
      GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
      this.renderBlocksInstance.renderBlockAsItem(var4, par2ItemStack.getItemDamage(), 1.0F);
    } else {
      if (var4 != null) {
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
      } else {
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/items.png"));
      }

      Tessellator var5 = Tessellator.instance;
      int var6 = par1EntityLiving.getItemIcon(par2ItemStack, par3);
      float var7 = ((float) (var6 % 16 * 16) + 0.0F) / 256.0F;
      float var8 = ((float) (var6 % 16 * 16) + 15.99F) / 256.0F;
      float var9 = ((float) (var6 / 16 * 16) + 0.0F) / 256.0F;
      float var10 = ((float) (var6 / 16 * 16) + 15.99F) / 256.0F;
      float var11 = 0.0F;
      float var12 = 0.3F;
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      GL11.glTranslatef(-var11, -var12, 0.0F);
      float var13 = 1.5F;
      GL11.glScalef(var13, var13, var13);
      GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
      renderItemIn2D(var5, var8, var9, var7, var10, 0.0625F);

      if (par2ItemStack != null && par2ItemStack.hasEffect() && par3 == 0) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);
        this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture("%blur%/misc/glint.png"));
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        float var14 = 0.76F;
        GL11.glColor4f(0.5F * var14, 0.25F * var14, 0.8F * var14, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        float var15 = 0.125F;
        GL11.glScalef(var15, var15, var15);
        float var16 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
        GL11.glTranslatef(var16, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
        renderItemIn2D(var5, 0.0F, 0.0F, 1.0F, 1.0F, 0.0625F);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(var15, var15, var15);
        var16 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
        GL11.glTranslatef(-var16, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
        renderItemIn2D(var5, 0.0F, 0.0F, 1.0F, 1.0F, 0.0625F);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
      }

      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    }

    GL11.glPopMatrix();
  }
コード例 #27
0
ファイル: RenderDimDoor.java プロジェクト: nallar/DimDoors
  /** Renders the dimdoor. */
  public void renderDimDoorTileEntity(
      TileEntityDimDoor tile, double x, double y, double z, float par8) {
    try {
      dimDoor
          .class
          .cast(Block.blocksList[properties.DimensionalDoorID])
          .updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord)
          .getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord);

    } catch (Exception e) {

      e.printStackTrace();
    }

    // float playerX = (float)this.tileEntityRenderer.playerX;
    // float playerY = (float)this.tileEntityRenderer.playerY;
    // float playerZ = (float)this.tileEntityRenderer.playerZ;

    // float distance = (float) tile.getDistanceFrom(playerX, playerY, playerZ);
    GL11.glDisable(GL11.GL_LIGHTING);
    Random rand = new Random(31100L);
    float var13 = 0.75F;

    for (int count = 0; count < 16; ++count) {
      GL11.glPushMatrix();
      float var15 = (float) (16 - count);
      float var16 = 0.2625F;
      float var17 = 1.0F / (var15 + 1.0F);

      if (count == 0) {
        this.bindTextureByName("/RIFT.png");
        var17 = 0.1F;
        var15 = 25.0F;
        var16 = 0.125F;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      }

      if (count == 1) {
        this.bindTextureByName("/WARP.png");
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
        var16 = .5F;
      }

      float startY = (float) (+(y + (double) var13));
      float ratioY = startY + ActiveRenderInfo.objectY;
      float ratioY2 = startY + var15 + ActiveRenderInfo.objectY;
      float yConverted = ratioY / ratioY2;

      float startZ = (float) (+(z + (double) var13));
      float ratioZ = startZ + ActiveRenderInfo.objectZ;
      float ratioZ2 = startZ + var15 + ActiveRenderInfo.objectZ;
      float zConverted = ratioZ / ratioZ2;

      float startX = (float) (+(x + (double) var13));
      float ratioX = startX + ActiveRenderInfo.objectX;
      float ratioX2 = startX + var15 + ActiveRenderInfo.objectX;
      float xConverted = ratioX / ratioX2;

      yConverted += (float) (y + (double) var13);
      xConverted += (float) (x + (double) var13);
      zConverted += (float) (z + (double) var13);

      GL11.glTranslatef((float) (Minecraft.getSystemTime() % 200000L) / 200000.0F, 0, 0.0F);
      GL11.glTranslatef(0, (float) (Minecraft.getSystemTime() % 200000L) / 200000.0F, 0.0F);

      GL11.glTranslatef(0, 0, (float) (Minecraft.getSystemTime() % 200000L) / 200000.0F);

      GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      switch ((tile.orientation % 4) + 4) {
        case 4:
          GL11.glTexGen(
              GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
          GL11.glTexGen(
              GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));

          break;
        case 5:
          GL11.glTexGen(
              GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
          GL11.glTexGen(
              GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
          break;
        case 6:
          GL11.glTexGen(
              GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
          GL11.glTexGen(
              GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));

          break;
        case 7:
          GL11.glTexGen(
              GL11.GL_S, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 1.0F, 0.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_T, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(1.0F, 0.0F, 0.0F, 0.0F));
          GL11.glTexGen(
              GL11.GL_R, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 0.0F, 1.0F));
          GL11.glTexGen(
              GL11.GL_Q, GL11.GL_OBJECT_PLANE, this.getFloatBuffer(0.0F, 0.0F, 1.0F, 0.0F));
          break;
      }

      GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
      GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
      GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
      GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
      GL11.glPopMatrix();
      GL11.glMatrixMode(GL11.GL_TEXTURE);
      GL11.glPushMatrix();
      GL11.glLoadIdentity();
      GL11.glTranslatef(
          0.0F, (float) (Minecraft.getSystemTime() % 200000L) / 200000.0F * var15, 0.0F);
      GL11.glScalef(var16, var16, var16);
      GL11.glTranslatef(0.5F, 0.5F, 0.5F);
      GL11.glRotatef((float) (count * count * 4321 + count * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(0.5F, 0.5F, 0.5F);

      Tessellator var24 = Tessellator.instance;
      var24.startDrawingQuads();

      float var21 = rand.nextFloat() * 0.5F + 0.1F;
      float var22 = rand.nextFloat() * 0.4F + 0.4F;
      float var23 = rand.nextFloat() * 0.6F + 0.5F;

      if (count == 0) {
        var23 = 1.0F;
        var22 = 1.0F;
        yConverted = 1.0F;
      }
      var24.setColorRGBA_F(var21 * var17, var22 * var17, var23 * var17, 1.0F);
      if (tile.openOrClosed) {

        switch (tile.orientation) {
          case 0:
            var24.addVertex(x + .01F, y - 1, z);
            var24.addVertex(x + .01, y - 1, z + 1.0D);
            var24.addVertex(x + .01, y + 1, z + 1.0D);
            var24.addVertex(x + .01, y + 1, z);
            break;
          case 1:
            var24.addVertex(x, y + 1, z + .01);
            var24.addVertex(x + 1, y + 1, z + .01);
            var24.addVertex(x + 1, y - 1, z + .01);
            var24.addVertex(x, y - 1, z + .01);

            break;
          case 2: //
            var24.addVertex(x + .99, y + 1, z);
            var24.addVertex(x + .99, y + 1, z + 1.0D);
            var24.addVertex(x + .99, y - 1, z + 1.0D);
            var24.addVertex(x + .99, y - 1, z);
            break;
          case 3:
            var24.addVertex(x, y - 1, z + .99);
            var24.addVertex(x + 1, y - 1, z + .99);
            var24.addVertex(x + 1, y + 1, z + .99);
            var24.addVertex(x, y + 1, z + .99);
            break;
          case 4: //
            //   GL11.glTranslatef();

            var24.addVertex(x + .15F, y - 1, z);
            var24.addVertex(x + .15, y - 1, z + 1.0D);
            var24.addVertex(x + .15, y + 1, z + 1.0D);
            var24.addVertex(x + .15, y + 1, z);
            break;
          case 5:
            var24.addVertex(x, y + 1, z + .15);
            var24.addVertex(x + 1, y + 1, z + .15);
            var24.addVertex(x + 1, y - 1, z + .15);
            var24.addVertex(x, y - 1, z + .15);

            break;
          case 6: //
            var24.addVertex(x + .85, y + 1, z);
            var24.addVertex(x + .85, y + 1, z + 1.0D);
            var24.addVertex(x + .85, y - 1, z + 1.0D);
            var24.addVertex(x + .85, y - 1, z);
            break;
          case 7:
            var24.addVertex(x, y - 1, z + .85);
            var24.addVertex(x + 1, y - 1, z + .85);
            var24.addVertex(x + 1, y + 1, z + .85);
            var24.addVertex(x, y + 1, z + .85);
            break;
          default:
            break;
        }
      }

      var24.draw();

      GL11.glPopMatrix();
      GL11.glMatrixMode(GL11.GL_MODELVIEW);
    }

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_R);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_Q);
    GL11.glEnable(GL11.GL_LIGHTING);
  }
コード例 #28
0
  /** Draws the screen and all the components in it. */
  public void drawScreen(int par1, int par2, float par3) {
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    this.renderSkybox(par1, par2, par3);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    Tessellator tessellator = Tessellator.instance;
    short short1 = 274;
    int k = this.width / 2 - short1 / 2;
    byte b0 = 30;
    this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
    this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
    this.mc.getTextureManager().bindTexture(minecraftTitleTextures);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    if ((double) this.updateCounter < 1.0E-4D) {
      this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 99, 44);
      this.drawTexturedModalRect(k + 99, b0 + 0, 129, 0, 27, 44);
      this.drawTexturedModalRect(k + 99 + 26, b0 + 0, 126, 0, 3, 44);
      this.drawTexturedModalRect(k + 99 + 26 + 3, b0 + 0, 99, 0, 26, 44);
      this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44);
    } else {
      this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 155, 44);
      this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44);
    }

    tessellator.setColorOpaque_I(-1);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) (this.width / 2 + 90), 70.0F, 0.0F);
    GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F);
    float f1 =
        1.8F
            - MathHelper.abs(
                MathHelper.sin(
                        (float) (Minecraft.getSystemTime() % 1000L)
                            / 1000.0F
                            * (float) Math.PI
                            * 2.0F)
                    * 0.1F);
    f1 = f1 * 100.0F / (float) (this.fontRendererObj.getStringWidth(this.splashText) + 32);
    GL11.glScalef(f1, f1, f1);
    this.drawCenteredString(this.fontRendererObj, this.splashText, 0, -8, -256);
    GL11.glPopMatrix();
    String s = "Minecraft 1.7.2";

    if (this.mc.isDemo()) {
      s = s + " Demo";
    }

    List<String> brandings = Lists.reverse(FMLCommonHandler.instance().getBrandings(true));
    for (int i = 0; i < brandings.size(); i++) {
      String brd = brandings.get(i);
      if (!Strings.isNullOrEmpty(brd)) {
        this.drawString(
            this.fontRendererObj,
            brd,
            2,
            this.height - (10 + i * (this.fontRendererObj.FONT_HEIGHT + 1)),
            16777215);
      }
    }
    ForgeHooksClient.renderMainMenu(this, fontRendererObj, width, height);
    String s1 = "Copyright Mojang AB. Do not distribute!";
    this.drawString(
        this.fontRendererObj,
        s1,
        this.width - this.fontRendererObj.getStringWidth(s1) - 2,
        this.height - 10,
        -1);

    if (this.field_92025_p != null && this.field_92025_p.length() > 0) {
      drawRect(
          this.field_92022_t - 2,
          this.field_92021_u - 2,
          this.field_92020_v + 2,
          this.field_92019_w - 1,
          1428160512);
      this.drawString(
          this.fontRendererObj, this.field_92025_p, this.field_92022_t, this.field_92021_u, -1);
      this.drawString(
          this.fontRendererObj,
          this.field_146972_A,
          (this.width - this.field_92024_r) / 2,
          ((GuiButton) this.buttonList.get(0)).yPosition - 12,
          -1);
    }

    super.drawScreen(par1, par2, par3);
  }
コード例 #29
0
  /** Draws the screen and all the components in it. */
  public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) {
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    this.renderSkybox(p_73863_1_, p_73863_2_, p_73863_3_);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    Tessellator var4 = Tessellator.instance;
    short var5 = 274;
    int var6 = this.width / 2 - var5 / 2;
    byte var7 = 30;
    this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
    this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
    this.mc.getTextureManager().bindTexture(minecraftTitleTextures);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    if ((double) this.updateCounter < 1.0E-4D) {
      this.drawTexturedModalRect(var6 + 0, var7 + 0, 0, 0, 99, 44);
      this.drawTexturedModalRect(var6 + 99, var7 + 0, 129, 0, 27, 44);
      this.drawTexturedModalRect(var6 + 99 + 26, var7 + 0, 126, 0, 3, 44);
      this.drawTexturedModalRect(var6 + 99 + 26 + 3, var7 + 0, 99, 0, 26, 44);
      this.drawTexturedModalRect(var6 + 155, var7 + 0, 0, 45, 155, 44);
    } else {
      this.drawTexturedModalRect(var6 + 0, var7 + 0, 0, 0, 155, 44);
      this.drawTexturedModalRect(var6 + 155, var7 + 0, 0, 45, 155, 44);
    }

    var4.setColorOpaque_I(-1);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) (this.width / 2 + 90), 70.0F, 0.0F);
    GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F);
    float var8 =
        1.8F
            - MathHelper.abs(
                MathHelper.sin(
                        (float) (Minecraft.getSystemTime() % 1000L)
                            / 1000.0F
                            * (float) Math.PI
                            * 2.0F)
                    * 0.1F);
    var8 = var8 * 100.0F / (float) (this.fontRendererObj.getStringWidth(this.splashText) + 32);
    GL11.glScalef(var8, var8, var8);
    this.drawCenteredString(this.fontRendererObj, this.splashText, 0, -8, -256);
    GL11.glPopMatrix();
    String var9 = "Minecraft 1.7.10 (InstanceClient)";

    if (this.mc.isDemo()) {
      var9 = var9 + " Demo";
    }

    this.drawString(this.fontRendererObj, var9, 2, this.height - 10, -1);
    String var10 = "Copyright Mojang AB. Do not distribute!";
    this.drawString(
        this.fontRendererObj,
        var10,
        this.width - this.fontRendererObj.getStringWidth(var10) - 2,
        this.height - 10,
        -1);

    if (this.field_92025_p != null && this.field_92025_p.length() > 0) {
      drawRect(
          this.field_92022_t - 2,
          this.field_92021_u - 2,
          this.field_92020_v + 2,
          this.field_92019_w - 1,
          1428160512);
      this.drawString(
          this.fontRendererObj, this.field_92025_p, this.field_92022_t, this.field_92021_u, -1);
      this.drawString(
          this.fontRendererObj,
          this.field_146972_A,
          (this.width - this.field_92024_r) / 2,
          ((GuiButton) this.buttonList.get(0)).field_146129_i - 12,
          -1);
    }

    super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
  }
コード例 #30
0
ファイル: GuiSlot.java プロジェクト: ZEBLOCK/mod
  /** draws the slot to the screen, pass in mouse's current x and y and partial ticks */
  public void drawScreen(int par1, int par2, float par3) {
    this.mouseX = par1;
    this.mouseY = par2;
    this.drawBackground();
    int k = this.getSize();
    int l = this.getScrollBarX();
    int i1 = l + 6;
    int j1;
    int k1;
    int l1;
    int i2;
    int j2;

    if (Mouse.isButtonDown(0)) {
      if (this.initialClickY == -1.0F) {
        boolean flag = true;

        if (par2 >= this.top && par2 <= this.bottom) {
          int k2 = this.width / 2 - 110;
          j1 = this.width / 2 + 110;
          k1 = par2 - this.top - this.field_77242_t + (int) this.amountScrolled - 4;
          l1 = k1 / this.slotHeight;

          if (par1 >= k2 && par1 <= j1 && l1 >= 0 && k1 >= 0 && l1 < k) {
            boolean flag1 =
                l1 == this.selectedElement && Minecraft.getSystemTime() - this.lastClicked < 250L;
            this.elementClicked(l1, flag1);
            this.selectedElement = l1;
            this.lastClicked = Minecraft.getSystemTime();
          } else if (par1 >= k2 && par1 <= j1 && k1 < 0) {
            this.func_77224_a(par1 - k2, par2 - this.top + (int) this.amountScrolled - 4);
            flag = false;
          }

          if (par1 >= l && par1 <= i1) {
            this.scrollMultiplier = -1.0F;
            j2 = this.func_77209_d();

            if (j2 < 1) {
              j2 = 1;
            }

            i2 =
                (int)
                    ((float) ((this.bottom - this.top) * (this.bottom - this.top))
                        / (float) this.getContentHeight());

            if (i2 < 32) {
              i2 = 32;
            }

            if (i2 > this.bottom - this.top - 8) {
              i2 = this.bottom - this.top - 8;
            }

            this.scrollMultiplier /= (float) (this.bottom - this.top - i2) / (float) j2;
          } else {
            this.scrollMultiplier = 1.0F;
          }

          if (flag) {
            this.initialClickY = (float) par2;
          } else {
            this.initialClickY = -2.0F;
          }
        } else {
          this.initialClickY = -2.0F;
        }
      } else if (this.initialClickY >= 0.0F) {
        this.amountScrolled -= ((float) par2 - this.initialClickY) * this.scrollMultiplier;
        this.initialClickY = (float) par2;
      }
    } else {
      while (!this.mc.gameSettings.touchscreen && Mouse.next()) {
        int l2 = Mouse.getEventDWheel();

        if (l2 != 0) {
          if (l2 > 0) {
            l2 = -1;
          } else if (l2 < 0) {
            l2 = 1;
          }

          this.amountScrolled += (float) (l2 * this.slotHeight / 2);
        }
      }

      this.initialClickY = -1.0F;
    }

    this.bindAmountScrolled();
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_FOG);
    Tessellator tessellator = Tessellator.instance;
    drawContainerBackground(tessellator);
    j1 = this.width / 2 - 92 - 16;
    k1 = this.top + 4 - (int) this.amountScrolled;

    if (this.field_77243_s) {
      this.func_77222_a(j1, k1, tessellator);
    }

    int i3;

    for (l1 = 0; l1 < k; ++l1) {
      j2 = k1 + l1 * this.slotHeight + this.field_77242_t;
      i2 = this.slotHeight - 4;

      if (j2 <= this.bottom && j2 + i2 >= this.top) {
        if (this.showSelectionBox && this.isSelected(l1)) {
          i3 = this.width / 2 - 110;
          int j3 = this.width / 2 + 110;

          Gui.drawRect(i3, (j2 - 2), j3, (j2 + i2 + 2), 0x80000000);

          /*tessellator.addVertex((double)i3, (double)(j2 + i2 + 2), 0.0D);
          tessellator.addVertex((double)j3, (double)(j2 + i2 + 2), 0.0D);
          tessellator.addVertex((double)j3, (double)(j2 - 2), 0.0D);
          tessellator.addVertex((double)i3, (double)(j2 - 2), 0.0D);*/

        }

        this.drawSlot(l1, j1, j2, i2, tessellator);
      }
    }

    GL11.glDisable(GL11.GL_DEPTH_TEST);
    byte b0 = 4;
    Gui.drawRect(0, 0, mc.displayWidth, top, 0x50000000);
    Gui.drawRect(0, bottom, mc.displayWidth, mc.displayHeight, 0x50000000);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    j2 = this.func_77209_d();

    if (j2 > 0) {
      i2 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight();

      if (i2 < 32) {
        i2 = 32;
      }

      if (i2 > this.bottom - this.top - 8) {
        i2 = this.bottom - this.top - 8;
      }

      i3 = (int) this.amountScrolled * (this.bottom - this.top - i2) / j2 + this.top;

      if (i3 < this.top) {
        i3 = this.top;
      }

      Gui.drawRect(l, this.top, i1, i3, 0x50000000);
      Gui.drawRect(l, i3, i1, (i3 + i2 - 1), 0x50ffffff);
      Gui.drawRect(l, (i3 + i2 - 1), i1, this.bottom, 0x50000000);
      /*tessellator.startDrawingQuads();
      tessellator.setColorRGBA_I(0, 255);
      tessellator.addVertexWithUV((double)l, (double)this.bottom, 0.0D, 0.0D, 1.0D);
      tessellator.addVertexWithUV((double)i1, (double)this.bottom, 0.0D, 1.0D, 1.0D);
      tessellator.addVertexWithUV((double)i1, (double)this.top, 0.0D, 1.0D, 0.0D);
      tessellator.addVertexWithUV((double)l, (double)this.top, 0.0D, 0.0D, 0.0D);
      tessellator.draw();
      tessellator.startDrawingQuads();
      tessellator.setColorRGBA_I(8421504, 255);
      tessellator.addVertexWithUV((double)l, (double)(i3 + i2), 0.0D, 0.0D, 1.0D);
      tessellator.addVertexWithUV((double)i1, (double)(i3 + i2), 0.0D, 1.0D, 1.0D);
      tessellator.addVertexWithUV((double)i1, (double)i3, 0.0D, 1.0D, 0.0D);
      tessellator.addVertexWithUV((double)l, (double)i3, 0.0D, 0.0D, 0.0D);
      tessellator.draw();
      tessellator.startDrawingQuads();
      tessellator.setColorRGBA_I(12632256, 255);
      tessellator.addVertexWithUV((double)l, (double)(i3 + i2 - 1), 0.0D, 0.0D, 1.0D);
      tessellator.addVertexWithUV((double)(i1 - 1), (double)(i3 + i2 - 1), 0.0D, 1.0D, 1.0D);
      tessellator.addVertexWithUV((double)(i1 - 1), (double)i3, 0.0D, 1.0D, 0.0D);
      tessellator.addVertexWithUV((double)l, (double)i3, 0.0D, 0.0D, 0.0D);
      tessellator.draw();*/
    }

    this.func_77215_b(par1, par2);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_BLEND);
  }