本文整理匯總了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());
}