EventHandler.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:ItemZoom 作者:
private static void renderZoomedStack(ItemStack itemStack, GuiContainer guiContainer, Minecraft minecraft) {
    ScaledResolution scaledResolution = new ScaledResolution(minecraft);
    final float scale = Config.getZoomAmount() / 100f * guiContainer.getGuiLeft() / 17f; // item is 16 wide, give it some extra space on each side
    final float xPosition = (guiContainer.getGuiLeft() / scale - 16f) / 2f;
    final float yPosition = (scaledResolution.getScaledHeight() / scale - 16f) / 2f;
    FontRenderer font = getFontRenderer(minecraft, itemStack);

    GlStateManager.pushMatrix();
    GlStateManager.scale(scale, scale, 1);
    GlStateManager.translate(xPosition, yPosition, 0);
    ZoomRenderHelper.enableGUIStandardItemLighting(scale);

    minecraft.getRenderItem().zLevel += 100;
    minecraft.getRenderItem().renderItemAndEffectIntoGUI(minecraft.player, itemStack, 0, 0);
    renderItemOverlayIntoGUI(font, itemStack);
    minecraft.getRenderItem().zLevel -= 100;
    GlStateManager.disableBlend();
    RenderHelper.disableStandardItemLighting();

    GlStateManager.popMatrix();

    if (Config.showHelpText()) {
        String modName = ItemZoom.MOD_NAME;
        int stringWidth = font.getStringWidth(modName);
        int x = (guiContainer.getGuiLeft() - stringWidth) / 2;
        int y = (scaledResolution.getScaledHeight() + Math.round(17 * scale)) / 2;
        font.drawString(modName, x, y, 4210752);

        if (Config.isToggledEnabled()) {
            String toggleText = KeyBindings.TOGGLE.getDisplayName();
            stringWidth = font.getStringWidth(toggleText);
            x = (guiContainer.getGuiLeft() - stringWidth) / 2;
            y += font.FONT_HEIGHT;
            font.drawString(toggleText, x, y, 4210752);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号