Ejemplo n.º 1
0
  @Override
  public void draw(ScaledResolution sr) {
    double width = sr.getScaledWidth_double(), height = sr.getScaledHeight_double();

    AppFreqTransmitter app = AppFreqTransmitter.instance;
    GL11.glPushMatrix();
    {
      GL11.glTranslated(15, 15, 0);

      final float isize = 18;
      final float fsize = 10;
      String str = app.getDisplayName();
      double len = Font.font.strLen(str, fsize);

      drawBox(0, 0, 30 + len, 18);

      ResourceLocation icon = app.getIcon();
      RenderUtils.loadTexture(icon);
      GL11.glColor4d(1, 1, 1, 1);
      HudUtils.rect(2, 0, isize, isize);

      Font.font.draw(str, isize + 6, 4, fsize, 0xffffff);
    }
    GL11.glPopMatrix();

    current.handleDraw(width, height);

    GL11.glColor4d(1, 1, 1, 1);
  }
  @Override
  public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
    TileEntityCustomizeableDecoration tile = (TileEntityCustomizeableDecoration) tileEntity;
    RenderElement[] renderElements = tile.getRenderElements();

    GL11.glPushMatrix();
    GL11.glColor4d(1, 1, 1, 1);
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 771);
    GL11.glTranslated(x, y, z);
    for (RenderElement element : renderElements) {
      if (element != null) {
        try {
          //					if(!GraphicUtilities.isModelPathValid(element.getModel())
          //						/*||*/if(	!GraphicUtilities.isTexturePathValid(element.getTexture()) )
          //						break;
          GL11.glPushMatrix();

          GraphicUtilities.bindTexture(element.getTexture());
          GL11.glColor4d(
              element.getColour()[0],
              element.getColour()[1],
              element.getColour()[2],
              element.getAlpha());
          GL11.glTranslated(0.5, 0.5, 0.5);
          GL11.glRotated(tile.getOrientation(), 0, 1, 0);
          GL11.glTranslated(-0.5, -0.5, -0.5);
          GL11.glTranslated(
              element.getTranslation()[0],
              element.getTranslation()[1],
              element.getTranslation()[2]);

          if (element.getRotation()[2] != 0) GL11.glRotated(element.getRotation()[2], 0, 0, 1);
          if (element.getRotation()[1] != 0) GL11.glRotated(element.getRotation()[1], 0, 1, 0);
          if (element.getRotation()[0] != 0) GL11.glRotated(element.getRotation()[0], 1, 0, 0);

          GL11.glScaled(tile.getScale(), tile.getScale(), tile.getScale());
          if (GraphicUtilities.isModelPathValid(element.getModel())) {
            IModelCustom tempMod = GraphicUtilities.bindModel(element.getModel());
            if (tempMod != null && GraphicUtilities.isModelPartValid(tempMod, element.getPart()))
              tempMod.renderPart(element.getPart());
          }
          GL11.glPopMatrix();
        } catch (Exception except) {
          // except.printStackTrace();
          GL11.glPopMatrix();
        }
      }
    }

    GL11.glDisable(3042);
    GL11.glColor4d(1, 1, 1, 1);
    GL11.glPopMatrix();
  }
  @Override
  public void main(int delta) {

    GameData.render();

    GL11.glLoadIdentity();
    GL11.glOrtho(0, GameSettings.getScreenX(), 0, GameSettings.getScreenY(), -1, 1);

    GL11.glColor4d(0, 0, 0, .7);
    GL11.glBegin(GL11.GL_TRIANGLE_FAN);
    GL11.glVertex2d(0, 0);
    GL11.glVertex2d(GameSettings.getScreenX(), 0);
    GL11.glVertex2d(GameSettings.getScreenX(), GameSettings.getScreenY());
    GL11.glVertex2d(0, GameSettings.getScreenY());
    GL11.glEnd();

    float ratio = ((float) (GameSettings.getScreenY()) / GameSettings.getScreenX());
    GL11.glLoadIdentity();
    GL11.glOrtho(
        -GameData.zoom,
        GameSettings.getScreenX() + GameData.zoom,
        -GameData.zoom * (ratio),
        GameSettings.getScreenY() + GameData.zoom * (ratio),
        -1,
        1);

    for (Button b : buttons) {
      b.render();
    }
  }
  public void doRender(Entity entity, double x, double y, double z, float f, float f1) {
    f = 0.0625f;
    RenderState.blendingOn();
    int timestep = (int) ((System.currentTimeMillis()) % 10000);
    double angle = timestep * Math.PI / 5000.0;
    GL11.glPushMatrix();
    GL11.glRotatef(180.0f, 1.0f, 0, 0);
    GL11.glTranslatef(0.5f, -1.5f, -0.5f);
    middletable.render(f);
    uppertable.render(f);
    footbase.render(f);
    foot1.render(f);
    fatfoot2.render(f);
    fatfoot1.render(f);
    backsupport.render(f);
    tank3.render(f);
    tank2.render(f);
    tank1.render(f);
    wireshort4.render(f);
    wireshort3.render(f);
    wireshort2.render(f);
    Wireshort1.render(f);
    Wirelong1.render(f);

    RenderState.glowOn();
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glTranslated(0.5f, 1.05f, 0.5f);
    GL11.glTranslated(0, 0.02f * Math.sin(angle * 3), 0);
    // GLRotate uses degrees instead of radians for some reason grr
    GL11.glRotatef((float) (angle * 57.2957795131), 0.0f, 1.0f, 0.0f);
    GL11.glRotatef(45f, 1.0f, 0.0f, 0.0f);
    // arctangent of 0.5.
    GL11.glRotatef(35.2643897f, 0, 1, 1);
    // cube.render(0.0625f);
    GL11.glColor4d(1, 1, 1, 0.8);
    cube.render(f / 2.0f);
    // cube.render(0.016000f);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glRotatef(180.0f, 1.0f, 0, 0);
    GL11.glTranslatef(0.5f, -1.5f, -0.5f);
    screen3.render(f);
    screen2.render(f);
    screen1.render(f);
    particles.render(f);
    GL11.glPopMatrix();
    // GL11.glPushMatrix();
    // if (Minecraft.getMinecraft().isFancyGraphicsEnabled()) {
    // if (f1 != 0) {
    // GL11.glDisable(GL11.GL_CULL_FACE);
    // for (int i = 0; i < 1; i++) {
    // drawScanLine(angle);
    // }
    // }
    // }
    // GL11.glPopMatrix();
    RenderState.glowOff();
    RenderState.blendingOff();
  }
Ejemplo n.º 5
0
  @SideOnly(Side.CLIENT)
  public void render(double x, double y, double z, double gunRadius) {
    if (isMinigunActivated()
        && getMinigunSpeed() == MAX_GUN_SPEED
        && gunAimedAtTarget
        && attackTarget != null) {
      GL11.glPushMatrix();
      GL11.glScaled(1, 1, 1);
      GL11.glTranslated(-x, -y, -z);
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      // GL11.glDisable(GL11.GL_LIGHTING);
      RenderUtils.glColorHex(0xFF000000 | getAmmoColor());
      for (int i = 0; i < 5; i++) {

        Vec3 vec =
            Vec3.createVectorHelper(
                    attackTarget.posX - x, attackTarget.posY - y, attackTarget.posZ - z)
                .normalize();
        minigunFire.startX = x + vec.xCoord * gunRadius;
        minigunFire.startY = y + vec.yCoord * gunRadius;
        minigunFire.startZ = z + vec.zCoord * gunRadius;
        minigunFire.endX = attackTarget.posX + rand.nextDouble() - 0.5;
        minigunFire.endY = attackTarget.posY + attackTarget.height / 2 + rand.nextDouble() - 0.5;
        minigunFire.endZ = attackTarget.posZ + rand.nextDouble() - 0.5;
        minigunFire.render();
      }
      GL11.glColor4d(1, 1, 1, 1);
      // GL11.glEnable(GL11.GL_LIGHTING);
      GL11.glEnable(GL11.GL_TEXTURE_2D);
      GL11.glPopMatrix();
    }
  }
Ejemplo n.º 6
0
 public void drawBackGround() {
   float[] color = EntitySheep.fleeceColorTable[~this.bookStack.getItemDamage() & 15];
   int var4 = this.mc.renderEngine.getTexture(this.getBookTexture());
   this.mc.renderEngine.bindTexture(var4);
   GL11.glColor3f(color[0], color[1], color[2]);
   this.drawTexturedModalRect(posX + 20, posY, 0, 0, 78, this.bookImageHeight);
   this.drawTexturedModalRect(posX + 98, posY, 186, 0, 69, this.bookImageHeight);
   GL11.glColor4d(1.0D, 1.0D, 1.0D, 1.0D);
   this.drawTexturedModalRect(posX + 26, posY + 8, 64, 8, 134, this.bookImageHeight - 27);
 }
 private void drawScanLine(double angle) {
   float xtarg = random.nextFloat();
   float ytarg = random.nextFloat();
   GL11.glLineWidth(2);
   GL11.glBegin(GL11.GL_LINES);
   GL11.glColor4d(0.0, 1.0, 0.2, 1.0);
   GL11.glVertex3d(0.5, 1.05 + 0.02f * Math.sin(angle * 3), 0.5);
   GL11.glVertex3d(xtarg, 1.2f, ytarg);
   GL11.glEnd();
   // MuseRenderer.drawGradientRect3D(
   // Vec3.createVectorHelper(Math.floor(xtarg * 16.0) / 16.0, 1.201,
   // Math.floor(ytarg * 16.0) / 16.0),
   // Vec3.createVectorHelper(1.0 / 16.0, 0, 1.0 / 16.0),
   // new Colour(0.0f, 1.0f, 0.0f, 0.4f),
   // new Colour(0.0f, 1.0f, 0.0f, 0.4f));
 }
  @Override
  public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
    GL11.glScalef(1.0F, -1F, -1F);
    RenderHandlerSC.bindTexture(Reference.PATH_TEXTURES_MODELS + "psyaicTotemTop.png");
    this.model.renderModel();
    GL11.glPopMatrix();

    GL11.glPushMatrix();

    TileAstralPillarCap tile = (TileAstralPillarCap) tileentity;

    GL11.glTranslatef((float) d0 + 0.5F, (float) d1, (float) d2 + 0.5F);

    GL11.glTranslated(0, 0.75, 0);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glColor4d(1, 1, 1, 0.95);

    ModelCube cube = new ModelCube();

    RenderHandlerSC.bindTexture(Reference.PATH_TEXTURES_MODELS + "cubeAstralCrystal.png");

    GL11.glRotatef(tile.getTicks() * 2, 0, 1, 0);
    GL11.glRotatef(-(tile.getTicks() * 2), 1, 1, 0);
    GL11.glRotatef(36f + tile.getTicks(), 0, 1, 1);
    GL11.glRotatef(36f + 36f + tile.getTicks() * 2, 1, 1, 0);
    GL11.glRotatef(tile.getTicks(), 1, 1, 1);

    double scale = 0.25;

    GL11.glScaled(scale, scale, scale);

    cube.renderModel();

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);

    GL11.glPopMatrix();
  }
Ejemplo n.º 9
0
  // TODO: considering this is all really GL code perhaps we could instead call a 'visualize'
  // function in a drawer and pass it the fft.
  public void visualizer() {
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glColor4d(1, 1, 1, .2);
    glPolygonMode(GL_FRONT, GL_FILL);
    int w = (int) getFftLog().specSize() / bands;
    int q = Constants.VIEW_HEIGHT;

    for (int i = 0; i < getFftLog().avgSize(); i++) {
      glBegin(GL_POLYGON);
      glVertex2d(i * w, q);
      glVertex2d(i * w + w, q);
      glVertex2d(i * w + w, q - (getFftLog().getAvg(i) * 1));
      glVertex2d(i * w, q - (getFftLog().getAvg(i) * 1));
      glEnd();
    }

    glDisable(GL_BLEND);
  }
Ejemplo n.º 10
0
  /** Draw the background layer for the GuiContainer (everything behind the items) */
  protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
    int var4 = this.mc.renderEngine.getTexture("/luxcraft/gui/luxStorage.png");
    GL11.glColor4f(1.0F, 1F, 1F, 1.0F);
    this.mc.renderEngine.bindTexture(var4);
    int var5 = (this.width - this.xSize) / 2;
    int var6 = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
    int var7;

    for (byte i = 0; i < 7; i++) {
      GL11.glColor4d(LuxHelper.r[i], LuxHelper.g[i], LuxHelper.b[i], 1);
      var7 =
          (int)
              ((double) storageInventory.GetLuxLevel(i)
                  / (double) storageInventory.MaxLuxLevel(i)
                  * 131);
      this.drawTexturedModalRect(
          var5 + 9 + 23 * i, var6 + 27 + 131 - var7, 176, 131 - var7, 20, var7);
    }
  }
Ejemplo n.º 11
0
  /** Draws this button to the screen. */
  @Override
  public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
    if (drawButton) {
      FontRenderer var4 = par1Minecraft.fontRenderer;
      int tex = GL11.GL_TEXTURE_BINDING_2D;
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      boolean var5 =
          par2 >= xPosition
              && par3 >= yPosition
              && par2 < xPosition + width
              && par3 < yPosition + height;

      ReikaGuiAPI.instance.drawItemStack(
          itemRender, par1Minecraft.fontRenderer, iconItem, xPosition, yPosition);

      this.mouseDragged(par1Minecraft, par2, par3);

      GL11.glColor4d(1, 1, 1, 1);
    }
  }
Ejemplo n.º 12
0
  public static void drawLiquidBar(
      int x, int y, int width, int height, int fluidID, int percentage) {
    Fluid fluid = FluidRegistry.getFluid(fluidID);
    if (fluid == null) return;

    Icon icon = fluid.getIcon();

    if (icon == null) return;

    // Bind SpriteNumber=0,texture "/terrain.png"
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    texturemanager.bindTexture(texturemanager.getResourceLocation(0));

    double u = icon.getInterpolatedU(3.0D);
    double u2 = icon.getInterpolatedU(13.0D);
    double v = icon.getInterpolatedV(1.0D);
    double v2 = icon.getInterpolatedV(15.0D);

    int z = height * percentage / 100;

    GL11.glEnable(3553);
    GL11.glColor4d(1.0D, 1.0D, 1.0D, 1.0D);

    GL11.glBegin(7);
    GL11.glTexCoord2d(u, v);
    GL11.glVertex2i(x, y + height - z);

    GL11.glTexCoord2d(u, v2);
    GL11.glVertex2i(x, y + height);

    GL11.glTexCoord2d(u2, v2);
    GL11.glVertex2i(x + width, y + height);

    GL11.glTexCoord2d(u2, v);
    GL11.glVertex2i(x + width, y + height - z);
    GL11.glEnd();
  }
Ejemplo n.º 13
0
  public void render(float partialTicks, boolean justRenderWhenHovering) {
    for (IEntityTrackEntry tracker : trackEntries) {
      tracker.render(entity, partialTicks);
    }
    double x = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
    double y =
        entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks + entity.height / 2D;
    double z = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;

    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glPushMatrix();

    GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);

    float red = 0.5F;
    float green = 0.5F;
    float blue = 1.0F;
    float alpha = 0.5F;
    float size = entity.height * 0.5F;

    if (ticksExisted < 60) {
      size += 5 - Math.abs(ticksExisted) * 0.083F;
      alpha = Math.abs(ticksExisted) * 0.005F;
    }

    GL11.glTranslated(x, y, z);

    GL11.glRotatef(180.0F - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(180.0F - RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
    GL11.glColor4d(red, green, blue, alpha);
    float renderSize = oldSize + (size - oldSize) * partialTicks;
    circle1.render(renderSize, partialTicks);
    circle2.render(renderSize + 0.2D, partialTicks);
    int targetAcquireProgress = (int) ((ticksExisted - 50) / 0.7F);
    if (ticksExisted <= 120 && ticksExisted > 50) {
      GL11.glColor4d(0, 1, 0, 0.8D);
      RenderProgressBar.render(0D, 0.4D, 1.8D, 0.9D, 0, targetAcquireProgress);
    }

    GL11.glEnable(GL11.GL_TEXTURE_2D);

    FontRenderer fontRenderer = RenderManager.instance.getFontRenderer();
    GL11.glScaled(0.02D, 0.02D, 0.02D);
    GL11.glColor4d(red, green, blue, alpha);
    if (ticksExisted > 120) {
      if (justRenderWhenHovering && !isLookingAtTarget) {
        stat.closeWindow();
      } else {
        stat.openWindow();
      }
      textList = new ArrayList<String>();
      for (IEntityTrackEntry tracker : trackEntries) {
        tracker.addInfo(entity, textList);
      }
      stat.setText(textList);
      stat.render(-1, -1, partialTicks);
    } else if (ticksExisted > 50) {
      fontRenderer.drawString("Acquiring Target...", 0, 0, 0x7F7F7F);
      fontRenderer.drawString(targetAcquireProgress + "%", 37, 28, 0x002F00);
    } else if (ticksExisted < -30) {
      stat.closeWindow();

      // if(stat.getWidth() > stat.getMinWidth() || stat.getHeight() > stat.getMinHeight()) {
      //    stat.setText(new ArrayList<String>());
      stat.render(-1, -1, partialTicks);
      //            }
      fontRenderer.drawString("Lost Target!", 0, 0, 0xFF0000);
    }

    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);

    oldSize = size;
  }
  @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();
  }
Ejemplo n.º 15
0
  @SubscribeEvent
  public void eventRenderWorld(RenderWorldLastEvent e) {

    if (delay < 0 && Keyboard.isKeyDown(56) && Keyboard.isKeyDown(57) && Keyboard.isKeyDown(29)) {
      delay = 15;
      this.enabled = !this.enabled;
    }
    delay--;
    if (!this.enabled) return;
    i++;
    if (i > 1000) {
      i = 0;
      System.out.println("Saving Snitch List");
      Config.saveConfig();
    }
    PlayerInteractHandler.timer++;
    try { // Should put this is method yolo
      for (Coordinate c : SnitchField.instance.coordinateList) {
        // Render Snitch Range
        if (c.getDistance() > 81) continue;
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glLineWidth(5F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glEnable(GL13.GL_MULTISAMPLE);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.09F);
        GL11.glDepthMask(false);

        GL11.glPushMatrix();
        double px = -(RenderManager.renderPosX - c.x);
        double py = -(RenderManager.renderPosY - c.y);
        double pz = -(RenderManager.renderPosZ - c.z);
        AxisAlignedBB bb =
            AxisAlignedBB.getBoundingBox(
                px - 10.55d, py - 10.55d, pz - 10.55d, px + 10.55d, py + 10.55d, pz + 10.55d);
        // odd choice because I just ripped this off squeenhowies esp
        int color = getColor(c.hoursToDate());
        if (c.hostile) {
          GL11.glColor4f(1F, 0.0F, 0.0F, 0.25F);
        } else {
          if (color == 0) {
            GL11.glColor4d(0F, 0.56F, 1.0F, 0.25F);
          } else if (color == 1) {
            GL11.glColor4d(0.11F, 0.91F, 0F, 0.25F); // Green
          } else if (color == 2) {
            GL11.glColor4d(0.88F, 0.83F, 0.0F, 0.25F); // Yellow
          } else if (color == 3) {
            GL11.glColor4d(0.75F, 0F, 0.91F, 0.25F);
          }
        }
        drawCrossedOutlinedBoundingBox(bb);
        if (c.hostile) {
          GL11.glColor4f(1F, 0.0F, 0.0F, 0.1F);
        } else {
          if (color == 0) {
            GL11.glColor4d(0F, 0.56F, 1.0F, 0.1F); // Blue
          } else if (color == 1) {
            GL11.glColor4d(0.11F, 0.91F, 0F, 0.1F); // Green
          } else if (color == 2) {
            GL11.glColor4d(0.88F, 0.83F, 0.0F, 0.1F); // Yellow
          } else if (color == 3) {
            GL11.glColor4d(0.75F, 0F, 0.91F, 0.1F); // Purple
          }
        }

        drawBoundingBoxQuads(bb);
        GL11.glPopMatrix();

        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL13.GL_MULTISAMPLE);
        GL11.glEnable(GL11.GL_LIGHTING);

        // Render snitch block
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glLineWidth(5F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glEnable(GL13.GL_MULTISAMPLE);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.09F);
        GL11.glDepthMask(false);

        GL11.glPushMatrix();
        px = -(RenderManager.renderPosX - c.x);
        py = -(RenderManager.renderPosY - c.y);
        pz = -(RenderManager.renderPosZ - c.z);
        bb =
            AxisAlignedBB.getBoundingBox(
                px - 0.5d, py - 0.5d, pz - 0.5d, px + 0.5d, py + 0.5d, pz + 0.5d);
        bb.expand(0.05, 0.05, 0.05);
        // odd choice because I just ripped this off my hacked client's esp
        if (c.hostile) {
          GL11.glColor4f(1F, 0.0F, 0.0F, 0.25F);
        } else {
          if (color == 0) {
            GL11.glColor4d(0F, 0.56F, 1.0F, 0.25F);
          } else if (color == 1) {
            GL11.glColor4d(0.11F, 0.91F, 0F, 0.25F);
          } else if (color == 2) {
            GL11.glColor4d(0.88F, 0.83F, 0.0F, 0.25F); // Yellow
          } else if (color == 3) {
            GL11.glColor4d(0.75F, 0F, 0.91F, 0.25F);
          }
        }
        drawCrossedOutlinedBoundingBox(bb);
        if (c.hostile) {
          GL11.glColor4f(1F, 0.0F, 0.0F, 0.1F);
        } else {
          if (color == 0) {
            GL11.glColor4d(0F, 0.56F, 1.0F, 0.1F);
          } else if (color == 1) {
            GL11.glColor4d(0.11F, 0.91F, 0F, 0.1F);
          } else if (color == 2) {
            GL11.glColor4d(0.88F, 0.83F, 0.0F, 0.1F); // Yellow
          } else if (color == 3) {
            GL11.glColor4d(0.75F, 0F, 0.91F, 0.1F);
          }
        }
        drawBoundingBoxQuads(bb);
        GL11.glPopMatrix();

        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL13.GL_MULTISAMPLE);
        GL11.glEnable(GL11.GL_LIGHTING);
      }

      for (Coordinate c : SnitchField.instance.tempList) {
        // Render Snitch Range
        if (c.getDistance() > 81) continue;

        // Render snitch block
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glLineWidth(5F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glEnable(GL13.GL_MULTISAMPLE);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.09F);
        GL11.glDepthMask(false);

        GL11.glPushMatrix();
        double px = -(RenderManager.renderPosX - c.x);
        double py = -(RenderManager.renderPosY - c.y);
        double pz = -(RenderManager.renderPosZ - c.z);
        AxisAlignedBB bb =
            AxisAlignedBB.getBoundingBox(
                px - 0.5d, py - 0.5d, pz - 0.5d, px + 0.5d, py + 0.5d, pz + 0.5d);
        bb.expand(0.05, 0.05, 0.05);
        // odd choice because I just ripped this off my hacked client's esp
        GL11.glColor4f(1F, 1F, 1F, 0.25F);
        drawCrossedOutlinedBoundingBox(bb);
        GL11.glColor4f(1F, 1F, 1F, 0.1F);
        drawBoundingBoxQuads(bb);
        GL11.glPopMatrix();

        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL13.GL_MULTISAMPLE);
        GL11.glEnable(GL11.GL_LIGHTING);
      }

    } catch (ConcurrentModificationException f) {

    }
  }
Ejemplo n.º 16
0
  private void render2D(float partialTicks) {
    Minecraft minecraft = FMLClientHandler.instance().getClient();
    EntityPlayer player = minecraft.thePlayer;
    ItemStack helmetStack = player.inventory.armorInventory[3];
    if (helmetStack != null
        && minecraft.inGameHasFocus
        && helmetStack.getItem() == Itemss.pneumaticHelmet) {
      ScaledResolution sr =
          new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
      GL11.glDepthMask(false);
      GL11.glDisable(GL11.GL_CULL_FACE);
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      GL11.glPushMatrix();
      GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
      GL11.glColor4d(0, 1, 0, 0.8D);
      CommonHUDHandler comHudHandler = CommonHUDHandler.getHandlerForPlayer(player);
      if (comHudHandler.ticksExisted <= comHudHandler.getStartupTime()) {
        // blockTrackInfo = null;
        gaveEmptyWarning = false;
        gaveNearlyEmptyWarning = false;
        RenderProgressBar.render(
            sr.getScaledWidth() / 2,
            10,
            sr.getScaledWidth() - 10,
            30,
            -90F,
            comHudHandler.ticksExisted * 100 / comHudHandler.getStartupTime());
      } else {

        if (comHudHandler.helmetPressure < 0.05F && !gaveEmptyWarning) {
          addMessage(
              new ArmorMessage(
                  "The helmet is out of air!", new ArrayList<String>(), 100, 0x70FF0000));
          gaveEmptyWarning = true;
        }
        if (comHudHandler.helmetPressure > 0.2F
            && comHudHandler.helmetPressure < 0.5F
            && !gaveNearlyEmptyWarning) {
          addMessage(
              new ArmorMessage(
                  "The helmet almost out of air!", new ArrayList<String>(), 60, 0x70FF0000));
          gaveNearlyEmptyWarning = true;
        }
        if (GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents")
            .checked) {
          for (int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) {
            IUpgradeRenderHandler upgradeRenderHandler =
                UpgradeRenderHandlerList.instance().upgradeRenderers.get(i);
            if (comHudHandler.upgradeRenderersInserted[i]
                && GuiKeybindCheckBox.trackedCheckboxes.get(
                        "pneumaticHelmet.upgrade." + upgradeRenderHandler.getUpgradeName())
                    .checked) {
              IGuiAnimatedStat stat = upgradeRenderHandler.getAnimatedStat();
              if (stat != null) {
                stat.render(-1, -1, partialTicks);
              }
              upgradeRenderHandler.render2D(partialTicks, comHudHandler.helmetPressure > 0F);
            }
          }
        }
      }

      // render every item in the list.
      for (ArmorMessage message : messageList) {
        message.renderMessage(minecraft.fontRenderer, partialTicks);
      }

      GL11.glPopMatrix();
      GL11.glEnable(GL11.GL_CULL_FACE);
      GL11.glDepthMask(true);
      GL11.glEnable(GL11.GL_TEXTURE_2D);
      if (comHudHandler.ticksExisted <= comHudHandler.getStartupTime())
        minecraft.fontRenderer.drawString(
            CommonHUDHandler.getHandlerForPlayer().ticksExisted
                    * 100
                    / comHudHandler.getStartupTime()
                + "%",
            sr.getScaledWidth() * 3 / 4 - 8,
            16,
            0x000000);
    } else if (helmetStack == null) {
      messageList.clear();
    }
  }
Ejemplo n.º 17
0
 private void setColour(double age, double alpha) {
   double life = (age / (double) EntityGapingVoid.maxLifetime);
   double f = Math.max(0, (life - EntityGapingVoid.collapse) / (1 - EntityGapingVoid.collapse));
   f = Math.max(f, 1 - (life * 30));
   GL11.glColor4d(f, f, f, alpha);
 }
Ejemplo n.º 18
0
  @Override
  public void doRender(
      Entity ent, double x, double y, double z, float p_76986_8_, float partialTicks) {
    EntityGapingVoid egv = (EntityGapingVoid) ent;
    Minecraft mc = Minecraft.getMinecraft();
    mc.renderEngine.bindTexture(this.halo);
    Tessellator tess = Tessellator.instance;

    double age = egv.getAge() + partialTicks;

    setColour(age, 1.0);

    double scale = EntityGapingVoid.getVoidScale(age);

    double fullfadedist = 0.6 * scale;
    double fadedist = fullfadedist + 1.5;

    double halocoord = 0.58 * scale;
    double haloscaledist = 2.2 * scale;

    double dx = ent.posX - RenderManager.renderPosX;
    double dy = ent.posY - RenderManager.renderPosY;
    double dz = ent.posZ - RenderManager.renderPosZ;

    double xzlen = Math.sqrt(dx * dx + dz * dz);
    double len = Math.sqrt(dx * dx + dy * dy + dz * dz);

    if (len <= haloscaledist) {
      double close = (haloscaledist - len) / haloscaledist;
      halocoord *= 1.0 + close * close * close * close * 1.5;
    }

    double yang = Math.atan2(xzlen, dy) * ClientProxy.toDeg;
    double xang = Math.atan2(dx, dz) * ClientProxy.toDeg;

    // Lumberjack.info("dx: "+dx+", dy: "+dy+", dz: "+dz+", xang: "+xang);
    // Lumberjack.info("x: "+x+", y: "+y+", z: "+z);

    GL11.glDisable(GL11.GL_LIGHTING);
    mc.entityRenderer.disableLightmap(0.0);

    GL11.glPushMatrix();
    {
      GL11.glTranslated(x, y, z);

      GL11.glRotated(xang, 0, 1, 0);
      GL11.glRotated(yang + 90, 1, 0, 0);

      GL11.glPushMatrix();
      {
        GL11.glRotated(90, 1, 0, 0);

        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDepthMask(false);

        tess.startDrawingQuads();
        tess.addVertexWithUV(-halocoord, 0.0, -halocoord, 0.0, 0.0);
        tess.addVertexWithUV(-halocoord, 0.0, halocoord, 0.0, 1.0);
        tess.addVertexWithUV(halocoord, 0.0, halocoord, 1.0, 1.0);
        tess.addVertexWithUV(halocoord, 0.0, -halocoord, 1.0, 0.0);
        tess.draw();

        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
      }
      GL11.glPopMatrix();

      Minecraft.getMinecraft().renderEngine.bindTexture(this.fill);

      GL11.glScaled(scale, scale, scale);

      model.renderAll();
    }
    GL11.glPopMatrix();

    if (len <= fadedist) {
      double alpha = 1.0;
      if (len >= fullfadedist) {
        alpha = 1.0 - ((len - fullfadedist) / (fadedist - fullfadedist));
        alpha = alpha * alpha * (3 - 2 * alpha);
      }
      setColour(age, alpha);
      GL11.glPushMatrix();
      {
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glEnable(GL11.GL_BLEND);

        GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);

        double d = 0;

        tess.startDrawingQuads();
        tess.addVertexWithUV(-100, 100, d, 0.0, 0.0);
        tess.addVertexWithUV(-100, -100, d, 0.0, 1.0);
        tess.addVertexWithUV(100, -100, d, 1.0, 1.0);
        tess.addVertexWithUV(100, 100, d, 1.0, 0.0);
        tess.draw();

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
      }
      GL11.glPopMatrix();
    }

    mc.entityRenderer.enableLightmap(0.0);
    GL11.glEnable(GL11.GL_LIGHTING);

    GL11.glColor4d(1, 1, 1, 1);
  }