当前位置: 首页>>代码示例>>Java>>正文


Java GuiUtilRenderComponents类代码示例

本文整理汇总了Java中net.minecraft.client.gui.GuiUtilRenderComponents的典型用法代码示例。如果您正苦于以下问题:Java GuiUtilRenderComponents类的具体用法?Java GuiUtilRenderComponents怎么用?Java GuiUtilRenderComponents使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GuiUtilRenderComponents类属于net.minecraft.client.gui包,在下文中一共展示了GuiUtilRenderComponents类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resizeContent

import net.minecraft.client.gui.GuiUtilRenderComponents; //导入依赖的package包/类
private List<ITextComponent> resizeContent(List<String> lines)
{
    List<ITextComponent> ret = new ArrayList<ITextComponent>();
    for (String line : lines)
    {
        if (line == null)
        {
            ret.add(null);
            continue;
        }

        ITextComponent chat = ForgeHooks.newChatWithLinks(line, false);
        ret.addAll(GuiUtilRenderComponents.splitText(chat, this.listWidth-8, GuiModList.this.fontRendererObj, false, true));
    }
    return ret;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:GuiModList.java

示例2: draw

import net.minecraft.client.gui.GuiUtilRenderComponents; //导入依赖的package包/类
@Override
public void draw(int mouseX, int mouseY, int y, int virtualWidth) {
	List<ITextComponent> lines = GuiUtilRenderComponents.splitText(text, virtualWidth - 20, fontRenderer, false,
			false);

	int runningY = y;

	for (ITextComponent line : lines) {
		String strLine = line.getFormattedText();
		int halfLineWidth = fontRenderer.getStringWidth(strLine) / 2;
		int lineLeft = virtualWidth / 2 - halfLineWidth;
		fontRenderer.drawString(strLine, lineLeft, runningY, 0xffffff);

		runningY += fontRenderer.FONT_HEIGHT;
	}

	ITextComponent hoveredComponent = getHoveredComponent(virtualWidth, y, mouseX, mouseY);
	if (hoveredComponent != null)
		GeneralUtils.handleHoverEvent(hoveredComponent.getStyle().getHoverEvent(), mouseX, mouseY);

}
 
开发者ID:Earthcomputer,项目名称:Easy-Editors,代码行数:22,代码来源:CommandHelpManager.java

示例3: getHoveredComponent

import net.minecraft.client.gui.GuiUtilRenderComponents; //导入依赖的package包/类
private ITextComponent getHoveredComponent(int virtualWidth, int y, int mouseX, int mouseY) {
	List<ITextComponent> lines = GuiUtilRenderComponents.splitText(text, virtualWidth - 20, fontRenderer, false,
			false);

	for (ITextComponent line : lines) {
		String strLine = line.getFormattedText();
		int halfLineWidth = fontRenderer.getStringWidth(strLine) / 2;
		int lineLeft = virtualWidth / 2 - halfLineWidth;
		int lineRight = virtualWidth / 2 + halfLineWidth;

		if (mouseY >= y && mouseY < y + fontRenderer.FONT_HEIGHT && mouseX >= lineLeft && mouseX < lineRight) {
			ITextComponent hoveredComponent = null;
			for (ITextComponent sibling : line) {
				hoveredComponent = sibling;
				lineLeft += fontRenderer.getStringWidth(GuiUtilRenderComponents
						.removeTextColorsIfConfigured(sibling.getUnformattedComponentText(), false));
				if (mouseX < lineLeft)
					break;
			}
			return hoveredComponent;
		}

		y += fontRenderer.FONT_HEIGHT;
	}
	return null;
}
 
开发者ID:Earthcomputer,项目名称:Easy-Editors,代码行数:27,代码来源:CommandHelpManager.java

示例4: resizeContent

import net.minecraft.client.gui.GuiUtilRenderComponents; //导入依赖的package包/类
private List<ITextComponent> resizeContent(List<String> lines)
{
    List<ITextComponent> ret = new ArrayList<ITextComponent>();
    for (String line : lines)
    {
        if (line == null)
        {
            ret.add(null);
            continue;
        }

        ITextComponent chat = ForgeHooks.newChatWithLinks(line, false);
        ret.addAll(GuiUtilRenderComponents.splitText(chat, this.listWidth-8, GuiCustomizeWorld.this.fontRenderer, false, true));
    }
    return ret;
}
 
开发者ID:LexManos,项目名称:YUNoMakeGoodMap,代码行数:17,代码来源:GuiCustomizeWorld.java

示例5: getHeight

import net.minecraft.client.gui.GuiUtilRenderComponents; //导入依赖的package包/类
@Override
public int getHeight(int virtualWidth) {
	return GuiUtilRenderComponents.splitText(text, virtualWidth - 20, fontRenderer, false, false).size()
			* fontRenderer.FONT_HEIGHT;
}
 
开发者ID:Earthcomputer,项目名称:Easy-Editors,代码行数:6,代码来源:CommandHelpManager.java

示例6: split

import net.minecraft.client.gui.GuiUtilRenderComponents; //导入依赖的package包/类
public static List<ITextComponent> split(ITextComponent chat, int width) {
    FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
    return GuiUtilRenderComponents.splitText(chat, width, fr, false, false);
}
 
开发者ID:killjoy1221,项目名称:TabbyChat-2,代码行数:5,代码来源:ChatTextUtils.java


注:本文中的net.minecraft.client.gui.GuiUtilRenderComponents类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。