Example #1
0
 /** binds the texture, adds matrix on stack and sets the state of the tesselator */
 public void begin() {
   TextureManager render = Minecraft.getMinecraft().renderEngine;
   render.bindTexture(new ResourceLocation(this.tex));
   GL11.glPushMatrix();
   rotateQuadBasedOnBlockRotation();
   Tessellator.instance.startDrawingQuads();
 }
  @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;
        }
    }
  }
  protected void bindTexture(ResourceLocation par1ResourceLocation) {
    TextureManager texturemanager = this.tileEntityRenderer.renderEngine;

    if (texturemanager != null) {
      texturemanager.bindTexture(par1ResourceLocation);
    }
  }
    public void bindTexturePackIcon(TextureManager p_110518_1_) {
      if (this.locationTexturePackIcon == null) {
        this.locationTexturePackIcon =
            p_110518_1_.getDynamicTextureLocation(
                "texturepackicon", new DynamicTexture(this.texturePackIcon));
      }

      p_110518_1_.bindTexture(this.locationTexturePackIcon);
    }
Example #5
0
  @SideOnly(Side.CLIENT)
  private static void renderEnderSky() {
    TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager();

    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    RenderHelper.disableStandardItemLighting();
    GL11.glDepthMask(false);
    renderEngine.bindTexture(locationEndSkyPng);
    Tessellator tessellator = Tessellator.instance;

    for (int i = 0; i < 6; ++i) {
      GL11.glPushMatrix();

      if (i == 1) {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
      }

      if (i == 2) {
        GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
      }

      if (i == 3) {
        GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
      }

      if (i == 4) {
        GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
      }

      if (i == 5) {
        GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
      }

      tessellator.startDrawingQuads();
      tessellator.setColorOpaque_I(2631720);
      tessellator.addVertexWithUV(-100.0D, -100.0D, -100.0D, 0.0D, 0.0D);
      tessellator.addVertexWithUV(-100.0D, -100.0D, 100.0D, 0.0D, 16.0D);
      tessellator.addVertexWithUV(100.0D, -100.0D, 100.0D, 16.0D, 16.0D);
      tessellator.addVertexWithUV(100.0D, -100.0D, -100.0D, 16.0D, 0.0D);
      tessellator.draw();
      GL11.glPopMatrix();
    }

    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
  }
  private static ThreadDownloadImageData getDownloadImage(
      ResourceLocation par0ResourceLocation,
      String par1Str,
      ResourceLocation par2ResourceLocation,
      IImageBuffer par3IImageBuffer) {
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    Object object = texturemanager.getTexture(par0ResourceLocation);

    if (object == null) {
      object = new ThreadDownloadImageData(par1Str, par2ResourceLocation, par3IImageBuffer);
      texturemanager.loadTexture(par0ResourceLocation, (ITextureObject) object);
    }

    return (ThreadDownloadImageData) object;
  }
  @SubscribeEvent
  public static void drawElements(RenderGameOverlayEvent.Pre event) {
    if (event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR) {
      GlStateManager.pushMatrix();
      GlStateManager.bindTexture(UITextures.GUI.getGlTextureId());
      for (Component component : components) component.atlasPass(0, event.getPartialTicks());

      GlStateManager.enableRescaleNormal();
      GlStateManager.enableAlpha();
      GlStateManager.alphaFunc(516, 0.1F);
      GlStateManager.enableBlend();
      GlStateManager.blendFunc(
          GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);

      GlStateManager.bindTexture(mc.getTextureMapBlocks().getGlTextureId());
      for (Component component : components) component.itemPass(0, event.getPartialTicks());

      tex.bindTexture(UITextures.RSS_GLINT);
      for (Component component : components) {
        GlStateManager.pushMatrix();
        component.itemEffectPass(0, event.getPartialTicks());
        GlStateManager.popMatrix();
      }

      GlStateManager.disableAlpha();
      GlStateManager.disableRescaleNormal();
      GlStateManager.disableLighting();

      for (Component component : components) component.textPass(0, event.getPartialTicks(), font);
      GlStateManager.popMatrix();
    }
  }
Example #8
0
 private static void renderSun(
     float partialTickTime,
     WorldClient world,
     TextureManager renderEngine,
     Tessellator tessellator,
     float offset,
     float factor,
     float yangle,
     float size,
     ResourceLocation sun) {
   GL11.glTranslatef(0.0F, 0.0F, 0.0F);
   GL11.glRotatef(yangle, 0.0F, 1.0F, 0.0F);
   float angle =
       world.provider.calculateCelestialAngle(
           world.getWorldInfo().getWorldTime(), partialTickTime);
   angle = angle * factor + offset;
   GL11.glRotatef(angle * 360.0F, 1.0F, 0.0F, 0.0F);
   renderEngine.bindTexture(sun);
   tessellator.startDrawingQuads();
   tessellator.addVertexWithUV((-size), 100.0D, (-size), 0.0D, 0.0D);
   tessellator.addVertexWithUV(size, 100.0D, (-size), 1.0D, 0.0D);
   tessellator.addVertexWithUV(size, 100.0D, size, 1.0D, 1.0D);
   tessellator.addVertexWithUV((-size), 100.0D, size, 0.0D, 1.0D);
   tessellator.draw();
 }
 public void drawFluidTank(IFluidTank tank, int x, int y) {
   FluidStack fluid = tank.getFluid();
   TextureManager manager = Minecraft.getMinecraft().renderEngine;
   if (fluid != null) {
     manager.bindTexture(manager.getResourceLocation(0));
     float amount = fluid.amount;
     float capacity = tank.getCapacity();
     float scale = amount / capacity;
     int fluidTankHeight = 60;
     int fluidAmount = (int) (scale * fluidTankHeight);
     drawFluid(
         x, y + fluidTankHeight - fluidAmount, fluid.getFluid().getIcon(fluid), 16, fluidAmount);
     manager.bindTexture(PymParticleProducerGuiTextures);
     drawTexturedModalRect(x - 1, y - 1, 238, 0, 18, 62);
   }
 }
  @SideOnly(Side.CLIENT)
  private ThreadDownloadImageData func_110301_a(
      ResourceLocation par0ResourceLocation,
      String par1Str,
      ResourceLocation par2ResourceLocation,
      IImageBuffer par3IImageBuffer) {
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    Object object = texturemanager.getTexture(par0ResourceLocation);

    if (object == null) {
      object = new ThreadDownloadImageData(null, par1Str, par2ResourceLocation, par3IImageBuffer);
      texturemanager.loadTexture(par0ResourceLocation, (ITextureObject) object);
    }

    return (ThreadDownloadImageData) object;
  }
  public static boolean renderEntityItem(
      EntityItem entity,
      ItemStack item,
      float bobing,
      float rotation,
      Random random,
      TextureManager engine,
      RenderBlocks renderBlocks) {
    IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY);
    if (customRenderer == null) {
      return false;
    }

    if (customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_ROTATION)) {
      GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F);
    }
    if (!customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_BOBBING)) {
      GL11.glTranslatef(0.0F, -bobing, 0.0F);
    }
    boolean is3D = customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D);

    engine.func_110577_a(
        item.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c);
    Block block = (item.itemID < Block.blocksList.length ? Block.blocksList[item.itemID] : null);
    if (is3D || (block != null && RenderBlocks.renderItemIn3d(block.getRenderType()))) {
      int renderType = (block != null ? block.getRenderType() : 1);
      float scale =
          (renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2
              ? 0.5F
              : 0.25F);

      if (RenderItem.renderInFrame) {
        GL11.glScalef(1.25F, 1.25F, 1.25F);
        GL11.glTranslatef(0.0F, 0.05F, 0.0F);
        GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
      }

      GL11.glScalef(scale, scale, scale);

      int size = item.stackSize;
      int count = (size > 40 ? 5 : (size > 20 ? 4 : (size > 5 ? 3 : (size > 1 ? 2 : 1))));

      for (int j = 0; j < count; j++) {
        GL11.glPushMatrix();
        if (j > 0) {
          GL11.glTranslatef(
              ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale,
              ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale,
              ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale);
        }
        customRenderer.renderItem(ENTITY, item, renderBlocks, entity);
        GL11.glPopMatrix();
      }
    } else {
      GL11.glScalef(0.5F, 0.5F, 0.5F);
      customRenderer.renderItem(ENTITY, item, renderBlocks, entity);
    }
    return true;
  }
  protected void bindTexture(TextureManager renderEngine, int spriteNumber) {

    if (spriteNumber == 0) {
      renderEngine.bindTexture(RenderHelper.MC_BLOCK_SHEET);
    } else {
      GL11.glBindTexture(GL11.GL_TEXTURE_2D, spriteNumber);
    }
  }
  protected void bindTexture(TextureManager renderEngine, int spriteNumber) {

    if (spriteNumber == 0) {
      renderEngine.bindTexture(TextureMap.locationBlocksTexture);
    } else {
      GL11.glBindTexture(GL11.GL_TEXTURE_2D, spriteNumber);
    }
  }
  public static boolean renderInventoryItem(
      RenderBlocks renderBlocks,
      TextureManager engine,
      ItemStack item,
      boolean inColor,
      float zLevel,
      float x,
      float y) {
    IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, INVENTORY);
    if (customRenderer == null) {
      return false;
    }

    engine.func_110577_a(
        item.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c);
    if (customRenderer.shouldUseRenderHelper(INVENTORY, item, INVENTORY_BLOCK)) {
      GL11.glPushMatrix();
      GL11.glTranslatef(x - 2, y + 3, -3.0F + zLevel);
      GL11.glScalef(10F, 10F, 10F);
      GL11.glTranslatef(1.0F, 0.5F, 1.0F);
      GL11.glScalef(1.0F, 1.0F, -1F);
      GL11.glRotatef(210F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);

      if (inColor) {
        int color = Item.itemsList[item.itemID].getColorFromItemStack(item, 0);
        float r = (float) (color >> 16 & 0xff) / 255F;
        float g = (float) (color >> 8 & 0xff) / 255F;
        float b = (float) (color & 0xff) / 255F;
        GL11.glColor4f(r, g, b, 1.0F);
      }

      GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
      renderBlocks.useInventoryTint = inColor;
      customRenderer.renderItem(INVENTORY, item, renderBlocks);
      renderBlocks.useInventoryTint = true;
      GL11.glPopMatrix();
    } else {
      GL11.glDisable(GL11.GL_LIGHTING);
      GL11.glPushMatrix();
      GL11.glTranslatef(x, y, -3.0F + zLevel);

      if (inColor) {
        int color = Item.itemsList[item.itemID].getColorFromItemStack(item, 0);
        float r = (float) (color >> 16 & 255) / 255.0F;
        float g = (float) (color >> 8 & 255) / 255.0F;
        float b = (float) (color & 255) / 255.0F;
        GL11.glColor4f(r, g, b, 1.0F);
      }

      customRenderer.renderItem(INVENTORY, item, renderBlocks);
      GL11.glPopMatrix();
      GL11.glEnable(GL11.GL_LIGHTING);
    }

    return true;
  }
Example #15
0
  @SideOnly(Side.CLIENT)
  @Override
  public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
    oreDictRecipe = shapelessRecipe = false;

    renderCraftingRecipe(gui, recipe);

    TextureManager render = Minecraft.getMinecraft().renderEngine;
    render.bindTexture(craftingOverlay);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    ((GuiScreen) gui)
        .drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());

    int iconX = gui.getLeft() + 115;
    int iconY = gui.getTop() + 12;

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

    if (shapelessRecipe) {
      ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 0, 16, 16);

      if (mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16)
        RenderHelper.renderTooltip(
            mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.shapeless")));

      iconY += 20;
    }

    render.bindTexture(craftingOverlay);
    GL11.glEnable(GL11.GL_BLEND);

    if (oreDictRecipe) {
      ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 16, 16, 16);

      if (mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16)
        RenderHelper.renderTooltip(
            mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.oredict")));
    }
    GL11.glDisable(GL11.GL_BLEND);
  }
Example #16
0
  public MapItemRenderer(GameSettings par1GameSettings, TextureManager par2TextureManager) {
    this.gameSettings = par1GameSettings;
    this.bufferedImage = new DynamicTexture(128, 128);
    this.field_111276_e = par2TextureManager.func_110578_a("map", this.bufferedImage);
    this.intArray = this.bufferedImage.func_110565_c();

    for (int i = 0; i < this.intArray.length; ++i) {
      this.intArray[i] = 0;
    }
  }
  @Override
  public ResourceLocation func_152789_a(
      MinecraftProfileTexture texture,
      final Type type,
      final NewSkinManager.SkinAvailableCallback callBack) {
    final ResourceLocation resLocation = new ResourceLocation("skins/" + texture.getHash());
    ITextureObject itextureobject = textureManager.getTexture(resLocation);

    if (itextureobject != null) {
      if (callBack != null) callBack.func_152121_a(type, resLocation);
    } else {
      File file1 = new File(skinFolder, texture.getHash().substring(0, 2));
      File file2 = new File(file1, texture.getHash());
      final NewImageBufferDownload imgDownload =
          type == Type.SKIN ? new NewImageBufferDownload() : null;
      ThreadDownloadImageData imgData =
          new ThreadDownloadImageData(
              file2,
              texture.getUrl(),
              field_152793_a,
              new IImageBuffer() {

                @Override
                public BufferedImage parseUserSkin(BufferedImage buffImg) {
                  if (imgDownload != null) buffImg = imgDownload.parseUserSkin(buffImg);

                  return buffImg;
                }

                @Override
                public void func_152634_a() {
                  if (imgDownload != null) imgDownload.func_152634_a();

                  if (callBack != null) callBack.func_152121_a(type, resLocation);
                }
              });
      textureManager.loadTexture(resLocation, imgData);
    }

    return resLocation;
  }
Example #18
0
  @Override
  @SideOnly(Side.CLIENT)
  public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
    T recipe = recipes.get(recipeAt);
    TextureManager render = Minecraft.getMinecraft().renderEngine;

    renderItemAtGridPos(gui, 3, 0, recipe.getOutput(), false);
    renderItemAtGridPos(gui, 2, 1, getMiddleStack(), false);

    List<Object> inputs = recipe.getInputs();
    int degreePerInput = (int) (360F / inputs.size());
    float currentDegree =
        ConfigHandler.lexiconRotatingItems
            ? (GuiScreen.isShiftKeyDown()
                ? ticksElapsed
                : (float) (ticksElapsed + ClientTickHandler.partialTicks))
            : 0;

    for (Object obj : inputs) {
      Object input = obj;
      if (input instanceof String) input = OreDictionary.getOres((String) input).get(0);

      renderItemAtAngle(gui, currentDegree, (ItemStack) input);

      currentDegree += degreePerInput;
    }

    renderManaBar(gui, recipe, mx, my);

    render.bindTexture(petalOverlay);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    ((GuiScreen) gui)
        .drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
    GL11.glDisable(GL11.GL_BLEND);
  }
  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();
  }
  public void renderParticles(Entity entity, float f) {
    float f1 = ActiveRenderInfo.rotationX;
    float f2 = ActiveRenderInfo.rotationZ;
    float f3 = ActiveRenderInfo.rotationYZ;
    float f4 = ActiveRenderInfo.rotationXY;
    float f5 = ActiveRenderInfo.rotationXZ;
    EntityFX.interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) f;
    EntityFX.interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) f;
    EntityFX.interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) f;

    for (int k = 0; k < fxes.length; ++k) {
      if (!this.fxes[k].isEmpty()) {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDepthMask(false);
        GL11.glEnable(GL11.GL_BLEND);
        switch (k) {
          case 0:
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            renderer.bindTexture(additiveTextureSheet);
            break;
        }

        GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();

        for (int j = 0; j < this.fxes[k].size(); ++j) {
          final EntityFX entityfx = this.fxes[k].get(j);
          if (entityfx == null) continue;
          tessellator.setBrightness(entityfx.getBrightnessForRender(f));

          try {
            entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4);
          } catch (Throwable throwable) {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering Particle");
            CrashReportCategory crashreportcategory =
                crashreport.makeCategory("Particle being rendered");
            crashreportcategory.addCrashSectionCallable("Particle", entityfx::toString);
            throw new ReportedException(crashreport);
          }
        }

        tessellator.draw();
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(true);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
      }
    }
  }
Example #21
0
 private void renderEffectSlot(TextureManager manager, int x, int y) {
   GL11.glDepthFunc(GL11.GL_EQUAL);
   // GL11.glDisable(GL11.GL_LIGHTING);
   GL11.glDepthMask(false);
   manager.bindTexture(RES_ITEM_GLINT);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
   // this.renderGlintSlot(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20);
   this.renderGlintSlot(x, y, 150, 20);
   OpenGlHelper.glBlendFunc(770, 771, 1, 0);
   GL11.glDepthMask(true);
   // GL11.glEnable(GL11.GL_LIGHTING);
   GL11.glDepthFunc(GL11.GL_LEQUAL);
 }
Example #22
0
  public void render(float size, TextureManager manager) {
    GlStateManager.pushMatrix();
    MekanismRenderer.blendOn();

    doRender(size);

    manager.bindTexture(OVERLAY);
    GlStateManager.scale(1.001F, 1.001F, 1.001F);
    GlStateManager.translate(0, -0.0011F, 0);
    MekanismRenderer.glowOn();

    doRender(size);

    MekanismRenderer.glowOff();
    MekanismRenderer.blendOff();
    GlStateManager.popMatrix();
  }
Example #23
0
  private static void renderMoon(
      float partialTickTime,
      WorldClient world,
      TextureManager renderEngine,
      Tessellator tessellator,
      float offset,
      float factor,
      float yangle,
      float size,
      ResourceLocation moon) {
    GL11.glTranslatef(0.0F, 0.0F, 0.0F);
    GL11.glRotatef(yangle, 0.0F, 1.0F, 0.0F);
    float angle =
        world.provider.calculateCelestialAngle(
            world.getWorldInfo().getWorldTime(), partialTickTime);
    angle = angle * factor + offset;
    GL11.glRotatef(angle * 360.0F, 1.0F, 0.0F, 0.0F);

    float f14, f15, f16, f17;
    renderEngine.bindTexture(moon);
    if (!moon.equals(locationMoonPhasesPng)) {
      f14 = 0.0f;
      f15 = 0.0f;
      f16 = 1.0f;
      f17 = 1.0f;
    } else {
      int k = world.getMoonPhase();
      int l = k % 4;
      int i1 = k / 4 % 2;
      f14 = (l + 0) / 4.0F;
      f15 = (i1 + 0) / 2.0F;
      f16 = (l + 1) / 4.0F;
      f17 = (i1 + 1) / 2.0F;
    }
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV((-size), -100.0D, size, f16, f17);
    tessellator.addVertexWithUV(size, -100.0D, size, f14, f17);
    tessellator.addVertexWithUV(size, -100.0D, (-size), f14, f15);
    tessellator.addVertexWithUV((-size), -100.0D, (-size), f16, f15);
    tessellator.draw();
  }
Example #24
0
  public FontRenderer(
      GameSettings p_i1035_1_,
      ResourceLocation p_i1035_2_,
      TextureManager p_i1035_3_,
      boolean p_i1035_4_) {
    this.field_111273_g = p_i1035_2_;
    this.field_78298_i = p_i1035_3_;
    this.field_78293_l = p_i1035_4_;
    p_i1035_3_.func_110577_a(this.field_111273_g);

    for (int var5 = 0; var5 < 32; ++var5) {
      int var6 = (var5 >> 3 & 1) * 85;
      int var7 = (var5 >> 2 & 1) * 170 + var6;
      int var8 = (var5 >> 1 & 1) * 170 + var6;
      int var9 = (var5 >> 0 & 1) * 170 + var6;
      if (var5 == 6) {
        var7 += 85;
      }

      if (p_i1035_1_.field_74337_g) {
        int var10 = (var7 * 30 + var8 * 59 + var9 * 11) / 100;
        int var11 = (var7 * 30 + var8 * 70) / 100;
        int var12 = (var7 * 30 + var9 * 70) / 100;
        var7 = var10;
        var8 = var11;
        var9 = var12;
      }

      if (var5 >= 16) {
        var7 /= 4;
        var8 /= 4;
        var9 /= 4;
      }

      this.field_78285_g[var5] = (var7 & 255) << 16 | (var8 & 255) << 8 | var9 & 255;
    }

    this.func_98306_d();
  }
Example #25
0
  private static void renderCelestialBodies(
      float partialTickTime,
      DimensionInformation information,
      WorldClient world,
      TextureManager renderEngine,
      Tessellator tessellator) {
    List<CelestialBodyDescriptor> celestialBodies = information.getCelestialBodyDescriptors();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.glBlendFunc(770, 1, 1, 0);
    GL11.glPushMatrix();

    float f6 = 1.0F - world.getRainStrength(partialTickTime);
    ResourceLocation sun = getSun(information);
    ResourceLocation moon = getMoon(information);

    if (celestialBodies.isEmpty()) {
      GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
      GL11.glTranslatef(0.0F, 0.0F, 0.0F);
      GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(world.getCelestialAngle(partialTickTime) * 360.0F, 1.0F, 0.0F, 0.0F);
      float f10 = 30.0F;
      renderEngine.bindTexture(sun);
      tessellator.startDrawingQuads();
      tessellator.addVertexWithUV((-f10), 100.0D, (-f10), 0.0D, 0.0D);
      tessellator.addVertexWithUV(f10, 100.0D, (-f10), 1.0D, 0.0D);
      tessellator.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D);
      tessellator.addVertexWithUV((-f10), 100.0D, f10, 0.0D, 1.0D);
      tessellator.draw();
      f10 = 20.0F;
      float f14, f15, f16, f17;
      renderEngine.bindTexture(moon);
      if (!moon.equals(locationMoonPhasesPng)) {
        f14 = 0.0f;
        f15 = 0.0f;
        f16 = 1.0f;
        f17 = 1.0f;
      } else {
        int k = world.getMoonPhase();
        int l = k % 4;
        int i1 = k / 4 % 2;
        f14 = (l + 0) / 4.0F;
        f15 = (i1 + 0) / 2.0F;
        f16 = (l + 1) / 4.0F;
        f17 = (i1 + 1) / 2.0F;
      }
      tessellator.startDrawingQuads();
      tessellator.addVertexWithUV((-f10), -100.0D, f10, f16, f17);
      tessellator.addVertexWithUV(f10, -100.0D, f10, f14, f17);
      tessellator.addVertexWithUV(f10, -100.0D, (-f10), f14, f15);
      tessellator.addVertexWithUV((-f10), -100.0D, (-f10), f16, f15);
      tessellator.draw();
    } else {
      Random random = new Random(world.getSeed());
      for (CelestialBodyDescriptor body : celestialBodies) {
        float offset = 0.0f;
        float factor = 1.0f;
        float yangle = -90.0f;
        if (!body.isMain()) {
          offset = random.nextFloat() * 200.0f;
          factor = random.nextFloat() * 3.0f;
          yangle = random.nextFloat() * 180.0f;
        }
        switch (body.getType()) {
          case BODY_NONE:
            break;
          case BODY_SUN:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderSun(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                30.0F,
                sun);
            break;
          case BODY_LARGESUN:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderSun(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                80.0F,
                sun);
            break;
          case BODY_SMALLSUN:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderSun(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                10.0F,
                sun);
            break;
          case BODY_REDSUN:
            GL11.glColor4f(1.0F, 0.0F, 0.0F, f6);
            renderSun(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                30.0F,
                sun);
            break;
          case BODY_MOON:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderMoon(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                20.0F,
                moon);
            break;
          case BODY_LARGEMOON:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderMoon(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                60.0F,
                moon);
            break;
          case BODY_SMALLMOON:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderMoon(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                10.0F,
                moon);
            break;
          case BODY_REDMOON:
            GL11.glColor4f(1.0F, 0.0F, 0.0F, f6);
            renderMoon(
                partialTickTime,
                world,
                renderEngine,
                tessellator,
                offset,
                factor,
                yangle,
                20.0F,
                moon);
            break;
          case BODY_PLANET:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderPlanet(
                partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 10.0F);
            break;
          case BODY_LARGEPLANET:
            GL11.glColor4f(1.0F, 1.0F, 1.0F, f6);
            renderPlanet(
                partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 30.0F);
            break;
        }
      }
    }

    GL11.glDisable(GL11.GL_TEXTURE_2D);

    float f18 = world.getStarBrightness(partialTickTime) * f6;

    if (f18 > 0.0F) {
      GL11.glColor4f(f18, f18, f18, f18);
      GL11.glCallList(starGLCallList);
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
  }
Example #26
0
 public static void bindIconSheet(TextureManager manager, int type) {
   final ResourceLocation resourceLocation = manager.getResourceLocation(type);
   manager.bindTexture(resourceLocation);
 }
Example #27
0
  @SideOnly(Side.CLIENT)
  private static void renderSkyTexture(ResourceLocation sky, ResourceLocation sky2, int type) {
    TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager();

    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    RenderHelper.disableStandardItemLighting();
    GL11.glDepthMask(false);
    Tessellator tessellator = Tessellator.instance;

    for (int i = 0; i < 6; ++i) {
      GL11.glPushMatrix();

      UV[] uv = faceDown;
      int col = 0xffffff;

      if (i == 0) { // Down face
        uv = faceDown;
        switch (type) {
          case SKYTYPE_ALL:
            renderEngine.bindTexture(sky);
            break;
          case SKYTYPE_ALLHORIZONTAL:
          case SKYTYPE_ALTERNATING:
            renderEngine.bindTexture(sky2);
            break;
          default:
            col = 0;
            break;
        }
      } else if (i == 1) { // North face
        renderEngine.bindTexture(sky);
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        uv = faceNorth;
      } else if (i == 2) { // South face
        renderEngine.bindTexture(sky);
        GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
        uv = faceSouth;
      } else if (i == 3) { // Up face
        GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
        uv = faceUp;
        switch (type) {
          case SKYTYPE_ALL:
            renderEngine.bindTexture(sky);
            break;
          case SKYTYPE_ALLHORIZONTAL:
          case SKYTYPE_ALTERNATING:
            renderEngine.bindTexture(sky2);
            break;
          default:
            col = 0;
            break;
        }
      } else if (i == 4) { // East face
        if (type == SKYTYPE_ALTERNATING && sky2 != null) {
          renderEngine.bindTexture(sky2);
        } else {
          renderEngine.bindTexture(sky);
        }
        GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
        uv = faceEast;
      } else if (i == 5) { // West face
        if (type == SKYTYPE_ALTERNATING && sky2 != null) {
          renderEngine.bindTexture(sky2);
        } else {
          renderEngine.bindTexture(sky);
        }
        GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
        uv = faceWest;
      }

      tessellator.startDrawingQuads();
      tessellator.setColorOpaque_I(col);
      tessellator.addVertexWithUV(-100.0D, -100.0D, -100.0D, uv[0].u, uv[0].v);
      tessellator.addVertexWithUV(-100.0D, -100.0D, 100.0D, uv[1].u, uv[1].v);
      tessellator.addVertexWithUV(100.0D, -100.0D, 100.0D, uv[2].u, uv[2].v);
      tessellator.addVertexWithUV(100.0D, -100.0D, -100.0D, uv[3].u, uv[3].v);
      tessellator.draw();
      GL11.glPopMatrix();
    }

    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
  }
Example #28
0
  @SideOnly(Side.CLIENT)
  public static void renderClouds(
      GenericWorldProvider provider, DimensionInformation information, float partialTicks) {
    GL11.glDisable(GL11.GL_CULL_FACE);
    Minecraft mc = Minecraft.getMinecraft();
    TextureManager renderEngine = mc.getTextureManager();
    float f1 =
        (float)
            (mc.renderViewEntity.lastTickPosY
                + (mc.renderViewEntity.posY - mc.renderViewEntity.lastTickPosY) * partialTicks);
    Tessellator tessellator = Tessellator.instance;
    float f2 = 12.0F;
    float f3 = 4.0F;
    RenderGlobal renderGlobal = mc.renderGlobal;
    double d0 = (CloudRenderAccessHelper.getCloudTickCounter(renderGlobal) + partialTicks);

    double entityX =
        mc.renderViewEntity.prevPosX
            + (mc.renderViewEntity.posX - mc.renderViewEntity.prevPosX) * partialTicks;
    double entityZ =
        mc.renderViewEntity.prevPosZ
            + (mc.renderViewEntity.posZ - mc.renderViewEntity.prevPosZ) * partialTicks;

    double d1 = (entityX + d0 * 0.029999999329447746D) / f2;
    double d2 = entityZ / f2 + 0.33000001311302185D;
    float y = provider.getCloudHeight() - f1 + 0.33F;
    int i = MathHelper.floor_double(d1 / 2048.0D);
    int j = MathHelper.floor_double(d2 / 2048.0D);
    d1 -= (i * 2048);
    d2 -= (j * 2048);
    renderEngine.bindTexture(locationCloudsPng);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    Vec3 vec3 = provider.worldObj.getCloudColour(partialTicks);
    float red = (float) vec3.xCoord;
    float green = (float) vec3.yCoord;
    float blue = (float) vec3.zCoord;
    float f8;
    float f9;
    float f10;

    if (mc.gameSettings.anaglyph) {
      f8 = (red * 30.0F + green * 59.0F + blue * 11.0F) / 100.0F;
      f9 = (red * 30.0F + green * 70.0F) / 100.0F;
      f10 = (red * 30.0F + blue * 70.0F) / 100.0F;
      red = f8;
      green = f9;
      blue = f10;
    }

    f10 = 0.00390625F;
    f8 = MathHelper.floor_double(d1) * f10;
    f9 = MathHelper.floor_double(d2) * f10;
    float f11 = (float) (d1 - MathHelper.floor_double(d1));
    float f12 = (float) (d2 - MathHelper.floor_double(d2));
    byte b0 = 8;
    byte b1 = 4;
    float f13 = 9.765625E-4F;
    GL11.glScalef(f2, 1.0F, f2);

    float cr = information.getSkyDescriptor().getCloudColorFactorR();
    float cg = information.getSkyDescriptor().getCloudColorFactorG();
    float cb = information.getSkyDescriptor().getCloudColorFactorB();
    boolean randomColors = information.isPatreonBitSet(Patreons.PATREON_KENNEY);

    for (int k = 0; k < 2; ++k) {
      if (k == 0) {
        GL11.glColorMask(false, false, false, false);
      } else if (mc.gameSettings.anaglyph) {
        if (EntityRenderer.anaglyphField == 0) {
          GL11.glColorMask(false, true, true, true);
        } else {
          GL11.glColorMask(true, false, false, true);
        }
      } else {
        GL11.glColorMask(true, true, true, true);
      }

      for (int l = -b1 + 1; l <= b1; ++l) {
        for (int i1 = -b1 + 1; i1 <= b1; ++i1) {
          tessellator.startDrawingQuads();
          float u = (l * b0);
          float v = (i1 * b0);
          float x = u - f11;
          float z = v - f12;
          if (randomColors) {
            //                        cr = (float) ((u % 10.0f) / 10.0f);
            //                        cg = (float) (((u + v) % 10.0f) / 10.0f);
            //                        cb = (float) ((v % 10.0f) / 10.0f);
            cr = x % 1.0f;
            cg = (x + z) % 1.0f;
            cb = z % 1.0f;
          }

          if (y > -f3 - 1.0F) {
            tessellator.setColorRGBA_F(red * 0.7F * cr, green * 0.7F * cg, blue * 0.7F * cb, 0.8F);
            tessellator.setNormal(0.0F, -1.0F, 0.0F);
            tessellator.addVertexWithUV(
                (x + 0.0F), (y + 0.0F), (z + b0), ((u + 0.0F) * f10 + f8), ((v + b0) * f10 + f9));
            tessellator.addVertexWithUV(
                (x + b0), (y + 0.0F), (z + b0), ((u + b0) * f10 + f8), ((v + b0) * f10 + f9));
            tessellator.addVertexWithUV(
                (x + b0), (y + 0.0F), (z + 0.0F), ((u + b0) * f10 + f8), ((v + 0.0F) * f10 + f9));
            tessellator.addVertexWithUV(
                (x + 0.0F),
                (y + 0.0F),
                (z + 0.0F),
                ((u + 0.0F) * f10 + f8),
                ((v + 0.0F) * f10 + f9));
          }

          if (y <= f3 + 1.0F) {
            tessellator.setColorRGBA_F(red * cr, green * cg, blue * cb, 0.8F);
            tessellator.setNormal(0.0F, 1.0F, 0.0F);
            tessellator.addVertexWithUV(
                (x + 0.0F),
                (y + f3 - f13),
                (z + b0),
                ((u + 0.0F) * f10 + f8),
                ((v + b0) * f10 + f9));
            tessellator.addVertexWithUV(
                (x + b0), (y + f3 - f13), (z + b0), ((u + b0) * f10 + f8), ((v + b0) * f10 + f9));
            tessellator.addVertexWithUV(
                (x + b0),
                (y + f3 - f13),
                (z + 0.0F),
                ((u + b0) * f10 + f8),
                ((v + 0.0F) * f10 + f9));
            tessellator.addVertexWithUV(
                (x + 0.0F),
                (y + f3 - f13),
                (z + 0.0F),
                ((u + 0.0F) * f10 + f8),
                ((v + 0.0F) * f10 + f9));
          }

          tessellator.setColorRGBA_F(red * 0.9F * cr, green * 0.9F * cg, blue * 0.9F * cb, 0.8F);
          int j1;

          if (l > -1) {
            tessellator.setNormal(-1.0F, 0.0F, 0.0F);

            for (j1 = 0; j1 < b0; ++j1) {
              tessellator.addVertexWithUV(
                  (x + j1 + 0.0F),
                  (y + 0.0F),
                  (z + b0),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + b0) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + j1 + 0.0F),
                  (y + f3),
                  (z + b0),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + b0) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + j1 + 0.0F),
                  (y + f3),
                  (z + 0.0F),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + 0.0F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + j1 + 0.0F),
                  (y + 0.0F),
                  (z + 0.0F),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + 0.0F) * f10 + f9));
            }
          }

          if (l <= 1) {
            tessellator.setNormal(1.0F, 0.0F, 0.0F);

            for (j1 = 0; j1 < b0; ++j1) {
              tessellator.addVertexWithUV(
                  (x + j1 + 1.0F - f13),
                  (y + 0.0F),
                  (z + b0),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + b0) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + j1 + 1.0F - f13),
                  (y + f3),
                  (z + b0),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + b0) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + j1 + 1.0F - f13),
                  (y + f3),
                  (z + 0.0F),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + 0.0F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + j1 + 1.0F - f13),
                  (y + 0.0F),
                  (z + 0.0F),
                  ((u + j1 + 0.5F) * f10 + f8),
                  ((v + 0.0F) * f10 + f9));
            }
          }

          tessellator.setColorRGBA_F(red * 0.8F * cr, green * 0.8F * cg, blue * 0.8F * cb, 0.8F);

          if (i1 > -1) {
            tessellator.setNormal(0.0F, 0.0F, -1.0F);

            for (j1 = 0; j1 < b0; ++j1) {
              tessellator.addVertexWithUV(
                  (x + 0.0F),
                  (y + f3),
                  (z + j1 + 0.0F),
                  ((u + 0.0F) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + b0),
                  (y + f3),
                  (z + j1 + 0.0F),
                  ((u + b0) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + b0),
                  (y + 0.0F),
                  (z + j1 + 0.0F),
                  ((u + b0) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + 0.0F),
                  (y + 0.0F),
                  (z + j1 + 0.0F),
                  ((u + 0.0F) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
            }
          }

          if (i1 <= 1) {
            tessellator.setNormal(0.0F, 0.0F, 1.0F);

            for (j1 = 0; j1 < b0; ++j1) {
              tessellator.addVertexWithUV(
                  (x + 0.0F),
                  (y + f3),
                  (z + j1 + 1.0F - f13),
                  ((u + 0.0F) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + b0),
                  (y + f3),
                  (z + j1 + 1.0F - f13),
                  ((u + b0) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + b0),
                  (y + 0.0F),
                  (z + j1 + 1.0F - f13),
                  ((u + b0) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
              tessellator.addVertexWithUV(
                  (x + 0.0F),
                  (y + 0.0F),
                  (z + j1 + 1.0F - f13),
                  ((u + 0.0F) * f10 + f8),
                  ((v + j1 + 0.5F) * f10 + f9));
            }
          }

          tessellator.draw();
        }
      }
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
  }
Example #29
0
  // RenderGlobal.drawBlockDamageTexture
  public void drawBlockDamageTexture(
      Tessellator tessellatorIn,
      WorldRenderer worldRendererIn,
      Entity entityIn,
      float partialTicks,
      World world,
      List<BlockPos> blocks) {
    double d0 =
        entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double) partialTicks;
    double d1 =
        entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double) partialTicks;
    double d2 =
        entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double) partialTicks;

    TextureManager renderEngine = Minecraft.getMinecraft().renderEngine;
    int progress =
        (int) (Minecraft.getMinecraft().playerController.curBlockDamageMP * 10f) - 1; // 0-10

    if (progress < 0) return;

    renderEngine.bindTexture(TextureMap.locationBlocksTexture);
    // preRenderDamagedBlocks BEGIN
    GlStateManager.tryBlendFuncSeparate(774, 768, 1, 0);
    GlStateManager.enableBlend();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F);
    GlStateManager.doPolygonOffset(-3.0F, -3.0F);
    GlStateManager.enablePolygonOffset();
    GlStateManager.alphaFunc(516, 0.1F);
    GlStateManager.enableAlpha();
    GlStateManager.pushMatrix();
    // preRenderDamagedBlocks END

    worldRendererIn.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
    worldRendererIn.setTranslation(-d0, -d1, -d2);
    worldRendererIn.markDirty();

    for (BlockPos blockpos : blocks) {
      double d3 = (double) blockpos.getX() - d0;
      double d4 = (double) blockpos.getY() - d1;
      double d5 = (double) blockpos.getZ() - d2;
      Block block = world.getBlockState(blockpos).getBlock();
      TileEntity te = world.getTileEntity(blockpos);
      boolean hasBreak =
          block instanceof BlockChest
              || block instanceof BlockEnderChest
              || block instanceof BlockSign
              || block instanceof BlockSkull;
      if (!hasBreak) hasBreak = te != null && te.canRenderBreaking();

      if (!hasBreak) {
        IBlockState iblockstate = world.getBlockState(blockpos);

        if (iblockstate.getBlock().getMaterial() != Material.air) {
          TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[progress];
          BlockRendererDispatcher blockrendererdispatcher =
              Minecraft.getMinecraft().getBlockRendererDispatcher();
          blockrendererdispatcher.renderBlockDamage(
              iblockstate, blockpos, textureatlassprite, world);
        }
      }
    }

    tessellatorIn.draw();
    worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D);
    // postRenderDamagedBlocks BEGIN
    GlStateManager.disableAlpha();
    GlStateManager.doPolygonOffset(0.0F, 0.0F);
    GlStateManager.disablePolygonOffset();
    GlStateManager.enableAlpha();
    GlStateManager.depthMask(true);
    GlStateManager.popMatrix();
    // postRenderDamagedBlocks END
  }
 public void renderOverlay(GuiEntry entry, int width, int height, int left, int top) {
   TextureManager tm = Minecraft.getMinecraft().getTextureManager();
   tm.bindTexture(new ResourceLocation("bloodutils:textures/gui/altar.png"));
   entry.drawTexturedModalRect(left, (height / 2 - 36) + (18 * 0) - 17, 0, 0, width, height);
 }