@Override
  public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glPushMatrix();
    GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);
    GL11.glTranslated(x, y, z);

    if (tileentity instanceof IBoxesProvider) {
      for (Box b : ((IBoxesProvider) tileentity).getBoxes()) {
        if (b.isVisible) {
          RenderBox.doRender(
              TileEntityRendererDispatcher.instance.field_147553_e, getTexture(b.kind), b);
        }
      }
    } else if (tileentity instanceof IBoxProvider) {
      Box b = ((IBoxProvider) tileentity).getBox();

      if (b.isVisible) {
        RenderBox.doRender(
            TileEntityRendererDispatcher.instance.field_147553_e, getTexture(b.kind), b);
      }
    }

    GL11.glPopMatrix();

    GL11.glPopAttrib();
    GL11.glPopMatrix();
  }
Beispiel #2
0
    @Override
    public void draw(int startX, int startY) {
      GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
      GL11.glDisable(GL11.GL_LIGHTING);
      GL11.glEnable(GL11.GL_DEPTH_TEST);
      RenderHelper.enableGUIStandardItemLighting();
      OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

      ItemStack output = getOutputStack();
      if (output != null) manager.gui.drawItemStack(output, startX + xPos, startY + yPos);
      // RenderHelper.disableStandardItemLighting();

      GL11.glDisable(GL11.GL_DEPTH_TEST);

      if (worktable.getMemory().isLocked(slotNumber)) {
        manager.gui.setZLevel(110f);
        Proxies.common.bindTexture(SpriteSheet.ITEMS);
        manager.gui.drawTexturedModelRectFromIcon(
            startX + xPos,
            startY + yPos,
            TextureManager.getInstance().getDefault("slots/locked"),
            16,
            16);
        manager.gui.setZLevel(0f);
      }

      GL11.glPopAttrib();
    }
 @SubscribeEvent(priority = EventPriority.LOWEST)
 @Optional.Method(modid = Mods.OpenComputers)
 public void onRobotRender(RobotRenderEvent e) {
   if (!rendering) {
     return;
   }
   if (e.mountPoints == null || e.mountPoints.length < 2) {
     return;
   }
   MountPoint mountPoint = e.mountPoints[1];
   GL11.glPushMatrix();
   GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
   GL11.glTranslatef(0.5f, 0.5f, 0.5f);
   GL11.glColor3f(color.r, color.g, color.b);
   float degrees = 360 - ((time % 160) / 160F * 360F);
   Minecraft.getMinecraft().getTextureManager().bindTexture(modelRadar);
   GL11.glDisable(GL11.GL_CULL_FACE);
   GL11.glRotatef(180, 1, 0, 0);
   GL11.glRotatef(
       mountPoint.rotation.getW(),
       mountPoint.rotation.getX(),
       mountPoint.rotation.getY(),
       mountPoint.rotation.getZ());
   GL11.glTranslatef(0F, -0.8F, 0F);
   GL11.glTranslatef(mountPoint.offset.getX(), mountPoint.offset.getY(), mountPoint.offset.getZ());
   GL11.glScalef(0.3f, 0.3f, 0.3f);
   GL11.glPushMatrix();
   radarModel.render(Math.max(degrees, 0));
   GL11.glPopMatrix();
   GL11.glPopMatrix();
   GL11.glPopAttrib();
 }
Beispiel #4
0
  public static void renderSphere(Vector3f center, float radius, Vector3f colour) {
    glPushAttrib(GL_ENABLE_BIT);
    {
      glDisable(GL_TEXTURE_2D); // Texture 2D is disabled so no textures are incorporated
      glDisable(GL_LIGHTING); // Lighting is turned off for 2D
      glBegin(GL_LINE_LOOP);
      {
        glColor3f(colour.x, colour.y, colour.z);
        for (int i = 0; i < 360; i++) {
          double degInRad = i * Math.PI / 180;
          glVertex3f(
              (float) (center.x + Math.cos(degInRad) * radius),
              (float) (center.y + Math.sin(degInRad) * radius),
              center.z);
        }
      }
      glEnd();

      glBegin(GL_LINE_LOOP);
      {
        glColor3f(colour.x, colour.y, colour.z);
        for (int i = 0; i < 360; i++) {
          double degInRad = i * Math.PI / 180;
          glVertex3f(
              center.x,
              (float) (center.y + Math.cos(degInRad) * radius),
              (float) (center.z + Math.sin(degInRad) * radius));
        }
      }
      glEnd();
    }
    glPopAttrib();
  }
  @Optional.Method(modid = Mods.OpenComputers)
  public void render(ItemStack stack, MountPoint mountPoint, Robot robot, float pt) {
    if (!isUpgrade(stack)) {
      return;
    }

    Minecraft mc = Minecraft.getMinecraft();
    TextureManager tm = mc.getTextureManager();

    switch (stack.getItemDamage()) {
      case 1:
        {
          tm.bindTexture(upgradeChatBox);
          drawSimpleBlock(mountPoint, 0, true);
          break;
        }
      case 2:
        {
          if (mountPoint.name.equals(MountPointName.TopLeft)
              || mountPoint.name.equals(MountPointName.TopRight)) {
            float degrees =
                robot.shouldAnimate()
                    ? ((robot.world().getTotalWorldTime() + (robot.hashCode() ^ 0xFF)) % 160 + pt)
                        / 160F
                        * 360F
                    : 0F;
            if (mountPoint.name.equals(MountPointName.TopRight)) {
              degrees = 360 - degrees;
            }
            GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
            tm.bindTexture(modelRadar);
            GL11.glDisable(GL11.GL_CULL_FACE);
            GL11.glRotatef(180, 1, 0, 0);
            GL11.glRotatef(
                mountPoint.rotation.getW(),
                mountPoint.rotation.getX(),
                mountPoint.rotation.getY(),
                mountPoint.rotation.getZ());
            GL11.glTranslatef(0F, -0.8F, 0F);
            GL11.glTranslatef(
                mountPoint.offset.getX(), mountPoint.offset.getY(), mountPoint.offset.getZ());
            GL11.glScalef(0.3f, 0.3f, 0.3f);
            GL11.glPushMatrix();
            radarModel.render(Math.max(degrees, 0));
            GL11.glPopMatrix();
            GL11.glPopAttrib();
          } else {
            tm.bindTexture(upgradeRadar);
            drawSimpleBlock(mountPoint, 0, true);
          }
          break;
        }
      case 5:
        {
          tm.bindTexture(beepCard);
          drawSimpleBlock(mountPoint, 0, true);
          break;
        }
    }
  }
  @Override
  protected void drawGuiContainerForegroundLayer(int par1, int par2) {
    ReikaTextureHelper.bindFontTexture();

    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;
    ReikaGuiAPI.instance.drawCenteredStringNoShadow(
        fontRendererObj,
        StatCollector.translateToLocal("chroma.routerfilter"),
        xSize / 2,
        5,
        0xffffff);

    for (int i = 0; i < 9; i++) {
      ItemRule ir = tile.getFilter(i);
      if (ir != null) {
        int x = 8 + i * 18;
        int y = 33;
        ReikaGuiAPI.instance.drawItemStack(
            itemRender, fontRendererObj, ReikaItemHelper.getSizedItemStack(ir.getItem(), 1), x, y);
        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        ReikaGuiAPI.instance.drawRectFrame(x - 1, y - 1, 18, 18, 0xff000000 | ir.mode.color);
        GL11.glPopAttrib();
      }
    }
  }
  @Override
  public void drawScreen(int x, int y, float par3) {
    super.drawScreen(x, y, par3);

    MerchantRecipeList recipes = this.villager.getRecipes(this.mc.thePlayer);
    if ((recipes != null) && !(recipes.isEmpty())) {
      int xCenter = (this.width - this.xSize) / 2;
      int yCenter = (this.height - this.ySize) / 2;

      MerchantRecipe recipe = (MerchantRecipe) recipes.get(this.currentRecipeIndex);

      ItemStack[] slot = new ItemStack[3];
      slot[0] = recipe.getItemToBuy();
      slot[1] = recipe.getSecondItemToBuy();
      slot[2] = recipe.getItemToSell();

      GL11.glPushMatrix();
      GL11.glPushAttrib(GL11.GL_ENABLE_BIT);

      RenderHelper.enableGUIStandardItemLighting();

      GL11.glEnable(GL12.GL_RESCALE_NORMAL);

      itemRender.zLevel = 100;
      itemRender.renderItemAndEffectIntoGUI(
          this.fontRendererObj, this.mc.renderEngine, slot[0], xCenter + 36, yCenter + 24);
      itemRender.renderItemOverlayIntoGUI(
          this.fontRendererObj, this.mc.renderEngine, slot[0], xCenter + 36, yCenter + 24);

      if (slot[1] != null) {
        itemRender.renderItemAndEffectIntoGUI(
            this.fontRendererObj, this.mc.renderEngine, slot[1], xCenter + 62, yCenter + 24);
        itemRender.renderItemOverlayIntoGUI(
            this.fontRendererObj, this.mc.renderEngine, slot[1], xCenter + 62, yCenter + 24);
      }

      itemRender.renderItemAndEffectIntoGUI(
          this.fontRendererObj, this.mc.renderEngine, slot[2], xCenter + 120, yCenter + 24);
      itemRender.renderItemOverlayIntoGUI(
          this.fontRendererObj, this.mc.renderEngine, slot[2], xCenter + 120, yCenter + 24);

      itemRender.zLevel = 0;

      GL11.glDisable(GL11.GL_LIGHTING);

      if (this.func_146978_c(36, 24, 16, 16, x, y)) {
        this.renderToolTip(slot[0], x, y);
      } else if ((slot[1] != null) && this.func_146978_c(62, 24, 16, 16, x, y)) {
        this.renderToolTip(slot[1], x, y);
      } else if (this.func_146978_c(120, 24, 16, 16, x, y)) {
        this.renderToolTip(slot[2], x, y);
      }

      RenderHelper.enableStandardItemLighting();

      GL11.glPopAttrib();
      GL11.glPopMatrix();
    }
  }
Beispiel #8
0
 @Override
 protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
   glPushAttrib(GL_BLEND);
   glEnable(GL_BLEND);
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
   super.drawGuiContainerBackgroundLayer(f, i, j);
   glPopAttrib();
 }
Beispiel #9
0
  public void update(EnemyControl e) {
    glPopAttrib();

    fftLogUpdate();

    glPushAttrib(GL_ALL_ATTRIB_BITS);

    genEnemies(Constants.VIEW_WIDTH / 2, Constants.VIEW_HEIGHT / 2, e);
  }
Beispiel #10
0
  public void drawLineBox(int x0, int y0, int x1, int y1, boolean stippled) {
    //    glPushMatrix();
    glPushAttrib(GL_ENABLE_BIT);
    glPushAttrib(GL_POLYGON_BIT);
    glPushAttrib(GL_CURRENT_BIT);
    glDisable(GL_LIGHTING);
    if (stippled) {
      glLineStipple(1, (short) 0xAAAA);
      glEnable(GL_LINE_STIPPLE);
    }
    glDisable(GL_TEXTURE_2D);
    glColor3d(1.0, 1.0, 1.0); // White is nice

    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
    // GL11.glRecti(iMouseX, iMouseY, mouseX , mouseY);
    glRecti(x0, y0, x1, y1);

    glPopAttrib();
    glPopAttrib();
    glPopAttrib();
  }
Beispiel #11
0
    @Override
    public void draw(int startX, int startY) {
      GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
      GL11.glDisable(GL11.GL_LIGHTING);
      GL11.glEnable(GL11.GL_DEPTH_TEST);
      RenderHelper.enableGUIStandardItemLighting();
      OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

      manager.gui.drawItemStack(BOOK, startX + xPos, startY + yPos);

      GL11.glPopAttrib();
    }
  @Override
  protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glPushAttrib(GL11.GL_CURRENT_BIT);
    GL11.glColor4f(1, 1, 1, 1);
    this.mc.renderEngine.bindTexture(guiTrading);

    int xCenter = (this.width - this.xSize) / 2;
    int yCenter = (this.height - this.ySize) / 2;

    this.drawTexturedModalRect(xCenter, yCenter, 0, 0, this.xSize, this.ySize);

    GL11.glPopAttrib();
  }
 @Override
 public void renderTileEntityAt(
     TileEntity tile, double par2, double par4, double par6, float par8) {
   TileEntityBiomePainter te = (TileEntityBiomePainter) tile;
   GL11.glPushMatrix();
   GL11.glTranslated(par2, par4, par6);
   this.renderModel(te, outerFrame, this.getTextureFolder() + "biomepainterouter.png");
   this.renderInnerFrame(te, par8);
   GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
   for (int i = 0; i < 6; i++) this.renderGlow(te, par8, i);
   GL11.glPopAttrib();
   GL11.glPopMatrix();
 }
  public boolean renderWorldBlock(
      IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {

    GL11.glPushAttrib(GL11.GL_TEXTURE_BIT);
    Tessellator t = Tessellator.instance;
    t.draw();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, YC_Constants.TreeCrystalTextureID);
    GL11.glPushMatrix();
    double t1 = 0, t2 = 0, t3 = 0;
    if (!YC_Options.EnableOptifineCompability) {
      ResetTranslation(x, y, z);
      GL11.glTranslatef(x, y, z);
      t1 = Tessellator.instance.xOffset;
      t2 = Tessellator.instance.yOffset;
      t3 = Tessellator.instance.zOffset;
      Tessellator.instance.setTranslation(0, 0, 0);
    } else {
      GL11.glTranslated(
          x + Tessellator.instance.xOffset,
          y + Tessellator.instance.yOffset,
          z + Tessellator.instance.zOffset);
    }
    GL11.glColor4f(1f, 1f, 1f, 1f);
    // {
    int md = world.getBlockMetadata(x, y, z);
    GL11.glTranslatef(0.5f, 0.5f, 0.5f);
    GL11.glRotatef(GetRotationXFromMD(md), 1, 0, 0);
    GL11.glRotatef(GetRotationZFromMD(md), 0, 0, 1);
    GL11.glTranslatef(-0.5f, -0.5f, +0.5f);
    YC_Mod.m_TreeCrystal.DrawWOTranslation();
    if (YC_Options.RenderContourSecondPass) {
      GL11.glBindTexture(
          GL11.GL_TEXTURE_2D, Minecraft.getMinecraft().renderEngine.getTexture("/YC/blank.png"));
      GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE);
      GL11.glColor3f(0f, 0f, 0f);
      YC_Mod.m_TreeCrystal.DrawWOTranslation();
      GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    }
    // }
    if (!YC_Options.EnableOptifineCompability) {
      Tessellator.instance.setTranslation(t1, t2, t3);
    }
    GL11.glPopMatrix();
    GL11.glColor4f(1f, 1f, 1f, 1f);
    GL11.glPopAttrib();

    t.startDrawingQuads();

    return true;
  }
Beispiel #15
0
  public void onDraw(double elapsedMillis, GameArena arena, Level gameLevel) {
    glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_ENABLE_BIT);
    glDisable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    drawPlayerIcons(gameLevel.getPlayer(), elapsedMillis);

    drawLabels(elapsedMillis, arena, gameLevel);

    GLHelper.checkAndThrow();

    glPopAttrib();
  }
Beispiel #16
0
  public Chat(Client c) {
    log = new ArrayList<String>();
    messageToSend = new StringBuffer();

    client = c;

    // First message on screen lets client know where they've connected
    log.add("Client connected to " + client.host + " using port " + client.port);

    // Create font
    Font font = new Font("Courier New", Font.PLAIN, 13);
    glPushAttrib(GL_TEXTURE_BIT);
    chatFont = new TrueTypeFont(font, true);
    glPopAttrib();
  }
  protected void drawItem(final int x, final int y, final ItemStack is) {
    this.zLevel = 100.0F;
    itemRender.zLevel = 100.0F;

    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    RenderHelper.enableGUIStandardItemLighting();
    itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.renderEngine, is, x, y);
    GL11.glPopAttrib();

    itemRender.zLevel = 0.0F;
    this.zLevel = 0.0F;
  }
 public void renderVehicle(
     EntityShip entity, double x, double y, double z, float yaw, float pitch) {
   GL11.glPushAttrib(8256);
   RenderHelper.disableStandardItemLighting();
   GL11.glPushMatrix();
   GL11.glTranslatef((float) x, (float) y, (float) z);
   GL11.glRotatef(yaw, 0.0F, 1.0F, 0.0F);
   float fx = entity.getShipChunk().getCenterX();
   float fz = entity.getShipChunk().getCenterZ();
   GL11.glTranslatef(-fx, (float) (-entity.getShipChunk().minY()), -fz);
   float f4 = 0.75F;
   this.func_110777_b(entity);
   entity.getShipChunk().renderer.render(0.0F);
   GL11.glPopMatrix();
   GL11.glPopAttrib();
 }
Beispiel #19
0
  private void renderCursor(float x, float y, Context c) {
    if (blinkTime < blinkPeriod / 2) {
      GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
      GL14.glBlendFuncSeparate(
          GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ZERO, GL11.GL_ZERO, GL11.GL_ZERO);
      GL20.glBlendEquationSeparate(GL14.GL_FUNC_ADD, GL14.GL_FUNC_ADD);

      c.resetColor();
      c.pushTransform();
      c.appendTransform(Matrix.translation(x, y, 0));
      font.getSprite(getCursorChar()).render(c);
      c.popTransform();

      GL11.glPopAttrib();
    }
  }
Beispiel #20
0
 public static void setupView(int width, int height) {
   glPopAttrib();
   glPushAttrib(GL_ENABLE_BIT);
   glEnable(GL_TEXTURE_2D);
   glEnable(GL_BLEND);
   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
   setupLighting();
   glClearDepth(1D);
   glEnable(GL_DEPTH_TEST);
   glEnable(GL_CULL_FACE);
   glDepthFunc(GL_LEQUAL);
   glViewport(0, 0, width, height);
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   gluPerspective(60F, (float) width / height, 0.1F, 1000F);
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
 }
Beispiel #21
0
  /** Renders the chatbox and messages */
  public void render() {
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    // Push currently enabled flags
    glPushAttrib(GL_ENABLE_BIT);
    {
      glDisable(GL_DEPTH_TEST); // Depth is disabled to prevent clipping
      glDisable(GL_TEXTURE_2D); // Texture 2D is disabled so no textures are incorporated
      glDisable(GL_LIGHTING); // Lighting is turned off for 2D
      glEnable(GL_BLEND); // Blend is needed for transparency with game

      drawChatBox(); // Draw the container for chat box
      getMessageFromClient(); // Poll for message from client receiver
      drawText(); // Draw the text to the screen
    }
    glPopAttrib();
  }
 @Override
 public final void renderTileEntityAt(
     TileEntity tile, double par2, double par4, double par6, float par8) {
   GL11.glPushMatrix();
   GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
   GL11.glDisable(GL11.GL_ALPHA_TEST);
   GL11.glDisable(GL11.GL_LIGHTING);
   GL11.glDisable(GL11.GL_CULL_FACE);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glDepthMask(false);
   GL11.glColor4f(1, 1, 1, 1);
   GL11.glTranslated(par2, par4, par6);
   if (MinecraftForgeClient.getRenderPass() == 1 || !tile.hasWorldObj())
     this.renderCore((TileEntityLocusPoint) tile, par2, par4, par6, par8);
   this.doOtherRendering((TileEntityLocusPoint) tile, par8);
   GL11.glPopAttrib();
   GL11.glPopMatrix();
 }
    void unbind() {
      GL11.glPopAttrib();

      GL11.glMatrixMode(GL11.GL_PROJECTION);
      GL11.glPopMatrix();

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

      if (lightmapEnabled) {
        GL13.glActiveTexture(GL13.GL_TEXTURE1);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL13.glActiveTexture(GL13.GL_TEXTURE0);
      }
      GL11.glEnable(GL11.GL_BLEND);
      GLAPI.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

      EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0);
    }
 @Override
 public void renderOverlay(ScaledResolution resolution) {
   int xPos = Config.isBuffBarLeft ? 2 : resolution.getScaledWidth() - (ICON_SPACING + 2);
   int yPos = 2;
   int offset = 0;
   int increment =
       Config.isBuffBarHorizontal && !Config.isBuffBarLeft ? -ICON_SPACING : ICON_SPACING;
   Collection<BuffBase> collection = ZSSEntityInfo.get(mc.thePlayer).getActiveBuffsMap().values();
   if (!collection.isEmpty()) {
     GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
     GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
     GL11.glDisable(GL11.GL_LIGHTING);
     // alpha test and blend needed due to vanilla or Forge rendering bug
     GL11.glEnable(GL11.GL_ALPHA_TEST);
     GL11.glEnable(GL11.GL_BLEND);
     mc.getTextureManager().bindTexture(textures);
     for (Iterator<BuffBase> iterator =
             ZSSEntityInfo.get(mc.thePlayer).getActiveBuffsMap().values().iterator();
         iterator.hasNext();
         offset = increment) {
       BuffBase buff = iterator.next();
       int index = buff.getIconIndex();
       xPos += (Config.isBuffBarHorizontal ? offset : 0);
       yPos += (Config.isBuffBarHorizontal ? 0 : offset);
       drawTexturedModalRect(
           xPos,
           yPos,
           index % ICONS_PER_ROW * ICON_SIZE,
           index / ICONS_PER_ROW * ICON_SIZE,
           ICON_SIZE,
           ICON_SIZE);
       if (buff.displayArrow()) {
         drawTexturedModalRect(
             xPos, yPos, buff.isDebuff() ? ICON_SIZE : 0, 0, ICON_SIZE, ICON_SIZE);
       }
     }
     GL11.glPopAttrib();
   }
 }
Beispiel #25
0
  @Override
  public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {

    TileTank tank = ((TileTank) tileentity);

    FluidStack liquid = tank.tank.getFluid();
    if (liquid == null || liquid.amount <= 0) {
      return;
    }

    int[] displayList = FluidRenderer.getFluidDisplayLists(liquid, tileentity.worldObj, false);
    if (displayList == null) {
      return;
    }

    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    func_110628_a(FluidRenderer.getFluidSheet(liquid));
    FluidRenderer.setColorForFluidStack(liquid);

    GL11.glTranslatef((float) x + 0.125F, (float) y, (float) z + 0.125F);
    GL11.glScalef(0.75F, 0.999F, 0.75F);

    GL11.glCallList(
        displayList[
            (int)
                ((float) liquid.amount
                    / (float) (tank.tank.getCapacity())
                    * (FluidRenderer.DISPLAY_STAGES - 1))]);

    GL11.glPopAttrib();
    GL11.glPopMatrix();
  }
  private void renderFuels(
      TileEntityFuelConverter tile, double par2, double par4, double par6, Fluid fuel) {

    FluidStack liquid = new FluidStack(fuel, 1);

    int amount = tile.getFuel(liquid);
    if (amount == 0) return;

    int[] displayList = ReikaLiquidRenderer.getGLLists(liquid, tile.worldObj, false);

    if (displayList == null) {
      return;
    }

    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    ReikaLiquidRenderer.bindFluidTexture(fuel);
    ReikaLiquidRenderer.setFluidColor(liquid);

    GL11.glTranslated(par2, par4, par6);

    GL11.glTranslated(0, tile.getLiquidModelOffset(liquid), 0);

    GL11.glTranslated(0, 0.001, 0);
    GL11.glScaled(1, 1 / 3D, 1);
    GL11.glScaled(0.99, 0.95, 0.99);

    GL11.glCallList(
        displayList[(int) (amount / ((double) tile.CAPACITY) * (ReikaLiquidRenderer.LEVELS - 1))]);

    GL11.glPopAttrib();
    GL11.glPopMatrix();
  }
  @Override
  protected final void drawGuiContainerBackgroundLayer(final float f, final int x, final int y) {
    final int ox = this.guiLeft; // (width - xSize) / 2;
    final int oy = this.guiTop; // (height - ySize) / 2;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.drawBG(ox, oy, x, y);

    final List<Slot> slots = this.getInventorySlots();
    for (final Slot slot : slots) {
      if (slot instanceof OptionalSlotFake) {
        final OptionalSlotFake fs = (OptionalSlotFake) slot;
        if (fs.renderDisabled()) {
          if (fs.isEnabled()) {
            this.drawTexturedModalRect(
                ox + fs.xDisplayPosition - 1,
                oy + fs.yDisplayPosition - 1,
                fs.getSourceX() - 1,
                fs.getSourceY() - 1,
                18,
                18);
          } else {
            GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.4F);
            GL11.glEnable(GL11.GL_BLEND);
            this.drawTexturedModalRect(
                ox + fs.xDisplayPosition - 1,
                oy + fs.yDisplayPosition - 1,
                fs.getSourceX() - 1,
                fs.getSourceY() - 1,
                18,
                18);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glPopAttrib();
          }
        }
      }
    }
  }
  @Override
  public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    bindTexture(texture);
    GL11.glTranslatef(0.5f, -0.25f, 0.5f);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glScalef(0.35f, 0.35f, 0.35f);
    float[] rot = ITorque.forgeDiretctionToRotationMatrix[2];
    if (rot[0] != 0) {
      GL11.glRotatef(rot[0], 1, 0, 0);
    }
    if (rot[1] != 0) {
      GL11.glRotatef(rot[1], 0, 1, 0);
    }
    if (rot[2] != 0) {
      GL11.glRotatef(rot[2], 0, 0, 1);
    }

    float textureWidth = model.textureWidth();
    float textureHeight = model.textureHeight();
    windmillShaft.setRotation(0, 0, 0);
    windmillShaft.render(textureWidth, textureHeight);
    int height = 5;

    bladeShaft.render(textureWidth, textureHeight);
    for (int k = 1; k < height; k++) {
      blade.render(textureWidth, textureHeight);
      if (k == height - 1) {
        bladeJoint.render(textureWidth, textureHeight);
      }
      if (k < height - 1) {
        GL11.glTranslatef(0, 1, 0);
      }
    }
    GL11.glPopAttrib();
    GL11.glPopMatrix();
  }
Beispiel #29
0
  public static void renderEntityBounds(Entity entity, float partialTick) {
    Minecraft mc = Minecraft.getMinecraft();

    if (!mc.gameSettings.hideGUI) {
      // Render bounding box around entity if it is being looked at.
      MovingObjectPosition lookingAt = mc.objectMouseOver;

      if (lookingAt != null
          && lookingAt.typeOfHit == MovingObjectType.ENTITY
          && lookingAt.entityHit == entity) {
        GL11.glPushAttrib(GL11.GL_CURRENT_BIT);

        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
        GlStateManager.color(0, 0, 0, 0.4F);
        GL11.glLineWidth(2);
        GlStateManager.disableTexture2D();
        GlStateManager.depthMask(false);
        float expand = entity.getCollisionBorderSize() + 0.002F;

        double offX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTick;
        double offY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTick;
        double offZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTick;
        RenderGlobal.drawOutlinedBoundingBox(
            entity
                .getEntityBoundingBox()
                .expand(expand, expand, expand)
                .offset(-offX, -offY, -offZ),
            -1);

        GlStateManager.depthMask(true);
        GlStateManager.enableTexture2D();
        GlStateManager.disableBlend();

        GL11.glPopAttrib();
      }
    }
  }
 @Override
 public void renderTileEntityAt(
     TileEntity te, double x, double y, double z, float partialTicks, int destroyStage) {
   EntityPlayer player = Minecraft.getMinecraft().thePlayer;
   if (player.getHeldItem(EnumHand.MAIN_HAND) == null
       || !(player.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof ItemLightDebugTool)
       || te instanceof TileEntityUVLightBlock) {
     return;
   }
   try {
     GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
     GL11.glPushMatrix();
     GL11.glColor3f(1F, 1F, 0.0F);
     GL11.glLineWidth(2.0F);
     GL11.glDisable(GL11.GL_TEXTURE_2D);
     GL11.glTranslatef((float) x, (float) y, (float) z);
     AxisAlignedBB boundingBox = new AxisAlignedBB(0.002D, 0.002D, 0.002D, 0.998D, 0.998D, 0.998D);
     drawCube(boundingBox);
   } finally {
     GL11.glPopMatrix();
     GL11.glPopAttrib();
   }
 }