本文整理汇总了Java中net.minecraft.client.gui.FontRenderer.listFormattedStringToWidth方法的典型用法代码示例。如果您正苦于以下问题:Java FontRenderer.listFormattedStringToWidth方法的具体用法?Java FontRenderer.listFormattedStringToWidth怎么用?Java FontRenderer.listFormattedStringToWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.gui.FontRenderer
的用法示例。
在下文中一共展示了FontRenderer.listFormattedStringToWidth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeTooltipLines
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
private String[] makeTooltipLines(int width, List<String> args)
{
FontRenderer fontrenderer = Config.getMinecraft().fontRendererObj;
List<String> list = new ArrayList();
for (int i = 0; i < args.size(); ++i)
{
String s = (String)args.get(i);
if (s != null && s.length() > 0)
{
for (Object s1 : fontrenderer.listFormattedStringToWidth(s, width))
{
list.add((String) s1);
}
}
}
String[] astring = (String[])((String[])list.toArray(new String[list.size()]));
return astring;
}
示例2: makeTooltipLines
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
private String[] makeTooltipLines(int width, List<String> args)
{
FontRenderer fontrenderer = Config.getMinecraft().fontRendererObj;
List<String> list = new ArrayList();
for (int i = 0; i < args.size(); ++i)
{
String s = (String)args.get(i);
if (s != null && s.length() > 0)
{
for (String s1 : fontrenderer.listFormattedStringToWidth(s, width))
{
list.add(s1);
}
}
}
String[] astring = (String[])((String[])list.toArray(new String[list.size()]));
return astring;
}
示例3: generateNewRandomName
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
/**
* Randomly generates a new name built up of 3 or 4 randomly selected words.
*/
public String generateNewRandomName(FontRenderer p_148334_1_, int p_148334_2_)
{
int i = this.rand.nextInt(2) + 3;
String s = "";
for (int j = 0; j < i; ++j)
{
if (j > 0)
{
s = s + " ";
}
s = s + this.namePartsArray[this.rand.nextInt(this.namePartsArray.length)];
}
List<String> list = p_148334_1_.listFormattedStringToWidth(s, p_148334_2_);
return org.apache.commons.lang3.StringUtils.join((Iterable)(list.size() >= 2 ? list.subList(0, 2) : list), " ");
}
示例4: drawCenteredSplitString
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
public static void drawCenteredSplitString(FontRenderer fontRenderer, String text, float x, float y, int wrap,
int color)
{
List<String> strings = fontRenderer.listFormattedStringToWidth(text, wrap);
for (String s : strings)
{
fontRenderer.drawString(s, (float) (x - fontRenderer.getStringWidth(s) / 2), y, color, false);
y += fontRenderer.FONT_HEIGHT;
}
}
示例5: init
import net.minecraft.client.gui.FontRenderer; //导入方法依赖的package包/类
@Override
public void init(IGuideRenderer guide) {
FontRenderer font = guide.getFontRenderer();
text = font.listFormattedStringToWidth(StringUtils.join(text, '\n'), guide.getPageWidth());
}