Пример #1
0
  @Override
  @SideOnly(Side.CLIENT)
  public void renderScreen(IGuiLexiconEntry gui, int mx, int my) {
    int width = gui.getWidth() - 34;
    int x = gui.getLeft() + 16;
    int y = gui.getTop() + 2;

    renderText(x, y, width, gui.getHeight(), getUnlocalizedName());
  }
Пример #2
0
  @Override
  @SideOnly(Side.CLIENT)
  public void renderScreen(IGuiLexiconEntry gui, int mx, int my) {
    relativeMouseX = mx;
    relativeMouseY = my;

    renderRecipe(gui, mx, my);

    int width = gui.getWidth() - 30;
    int height = gui.getHeight();
    int x = gui.getLeft() + 16;
    int y = gui.getTop() + height - 40;
    PageText.renderText(x, y, width, height, getUnlocalizedName());

    if (tooltipStack != null) {
      List<String> tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
      List<String> parsedTooltip = new ArrayList();
      boolean first = true;

      for (String s : tooltipData) {
        String s_ = s;
        if (!first) s_ = EnumChatFormatting.GRAY + s;
        parsedTooltip.add(s_);
        first = false;
      }

      vazkii.botania.client.core.helper.RenderHelper.renderTooltip(mx, my, parsedTooltip);

      int tooltipY = 8 + tooltipData.size() * 11;

      if (tooltipEntry) {
        vazkii.botania.client.core.helper.RenderHelper.renderTooltipOrange(
            mx,
            my + tooltipY,
            Arrays.asList(
                EnumChatFormatting.GRAY
                    + StatCollector.translateToLocal("botaniamisc.clickToRecipe")));
        tooltipY += 18;
      }

      if (tooltipContainerStack != null)
        vazkii.botania.client.core.helper.RenderHelper.renderTooltipGreen(
            mx,
            my + tooltipY,
            Arrays.asList(
                EnumChatFormatting.AQUA
                    + StatCollector.translateToLocal("botaniamisc.craftingContainer"),
                tooltipContainerStack.getDisplayName()));
    }

    tooltipStack = tooltipContainerStack = null;
    tooltipEntry = false;
    GL11.glDisable(GL11.GL_BLEND);
    mouseDownLastTick = Mouse.isButtonDown(0);
  }
Пример #3
0
  @SideOnly(Side.CLIENT)
  public void renderManaBar(IGuiLexiconEntry gui, T recipe, int mx, int my) {
    FontRenderer font = Minecraft.getMinecraft().fontRenderer;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    int x = gui.getLeft() + gui.getWidth() / 2 - 50;
    int y = gui.getTop() + 120;

    boolean unicode = font.getUnicodeFlag();
    font.setUnicodeFlag(true);
    String stopStr = StatCollector.translateToLocal("botaniamisc.shiftToStopSpin");
    font.drawString(stopStr, x + 50 - font.getStringWidth(stopStr) / 2, y + 15, 0x99000000);
    font.setUnicodeFlag(unicode);

    GL11.glDisable(GL11.GL_BLEND);
  }
Пример #4
0
  @SideOnly(Side.CLIENT)
  public void renderItemAtAngle(IGuiLexiconEntry gui, int angle, ItemStack stack) {
    if (stack == null || stack.getItem() == null) return;

    ItemStack workStack = stack.copy();

    if (workStack.getItemDamage() == Short.MAX_VALUE || workStack.getItemDamage() == -1)
      workStack.setItemDamage(0);

    angle -= 90;
    int radius = 32;
    double xPos =
        gui.getLeft() + Math.cos(angle * Math.PI / 180D) * radius + gui.getWidth() / 2 - 8;
    double yPos = gui.getTop() + Math.sin(angle * Math.PI / 180D) * radius + 53;

    renderItem(gui, (int) xPos, (int) yPos, workStack, false);
  }
Пример #5
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);
  }
Пример #6
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);
  }