コード例 #1
0
ファイル: PageText.java プロジェクト: GrygrFlzr/Botania
  @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
ファイル: PageRecipe.java プロジェクト: nielsx25/Botania
  @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
ファイル: PageRecipe.java プロジェクト: nielsx25/Botania
  @SideOnly(Side.CLIENT)
  public void renderItem(
      IGuiLexiconEntry gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer) {
    RenderItem render = new RenderItem();
    boolean mouseDown = Mouse.isButtonDown(0);

    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    render.renderItemAndEffectIntoGUI(
        Minecraft.getMinecraft().fontRenderer,
        Minecraft.getMinecraft().getTextureManager(),
        stack,
        xPos,
        yPos);
    render.renderItemOverlayIntoGUI(
        Minecraft.getMinecraft().fontRenderer,
        Minecraft.getMinecraft().getTextureManager(),
        stack,
        xPos,
        yPos);
    RenderHelper.disableStandardItemLighting();
    GL11.glPopMatrix();

    if (relativeMouseX >= xPos
        && relativeMouseY >= yPos
        && relativeMouseX <= xPos + 16
        && relativeMouseY <= yPos + 16) {
      tooltipStack = stack;

      EntryData data = LexiconRecipeMappings.getDataForStack(tooltipStack);
      if (data != null && (data.entry != gui.getEntry() || data.page != gui.getPageOn())) {
        tooltipEntry = true;

        if (!mouseDownLastTick && mouseDown && GuiScreen.isShiftKeyDown()) {
          GuiLexiconEntry newGui = new GuiLexiconEntry(data.entry, (GuiScreen) gui);
          newGui.page = data.page;
          Minecraft.getMinecraft().displayGuiScreen(newGui);
        }
      }

      if (accountForContainer) {
        ItemStack containerStack = stack.getItem().getContainerItem(stack);
        if (containerStack != null && containerStack.getItem() != null)
          tooltipContainerStack = containerStack;
      }
    }

    GL11.glDisable(GL11.GL_LIGHTING);
  }
コード例 #4
0
ファイル: PageRecipe.java プロジェクト: nielsx25/Botania
  @SideOnly(Side.CLIENT)
  public void renderItemAtGridPos(
      IGuiLexiconEntry gui, int x, int y, ItemStack stack, boolean accountForContainer) {
    if (stack == null || stack.getItem() == null) return;
    stack = stack.copy();

    if (stack.getItemDamage() == Short.MAX_VALUE) stack.setItemDamage(0);

    int xPos = gui.getLeft() + x * 29 + 7 + (y == 0 && x == 3 ? 10 : 0);
    int yPos = gui.getTop() + y * 29 + 24 - (y == 0 ? 7 : 0);
    ItemStack stack1 = stack.copy();
    if (stack1.getItemDamage() == -1) stack1.setItemDamage(0);

    renderItem(gui, xPos, yPos, stack1, accountForContainer);
  }
コード例 #5
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);
  }
コード例 #6
0
ファイル: PageRecipe.java プロジェクト: nielsx25/Botania
  @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);
  }
コード例 #7
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);
  }
コード例 #8
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);
  }