當前位置: 首頁>>代碼示例>>Java>>正文


Java TextFormatting.BOLD屬性代碼示例

本文整理匯總了Java中net.minecraft.util.text.TextFormatting.BOLD屬性的典型用法代碼示例。如果您正苦於以下問題:Java TextFormatting.BOLD屬性的具體用法?Java TextFormatting.BOLD怎麽用?Java TextFormatting.BOLD使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.minecraft.util.text.TextFormatting的用法示例。


在下文中一共展示了TextFormatting.BOLD屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: drawScreen

@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {

	GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
	Minecraft.getMinecraft().renderEngine.bindTexture(BACKGROUND);
	this.drawTexturedModalRect(left, top, 0, 0, WIDTH, HEIGHT);

	if (currentPage != null) {
		String header = TextFormatting.BOLD + "" + TextFormatting.UNDERLINE + I18n.format(currentPage.getTitle());
		int headerWidth = this.fontRenderer.getStringWidth(header);
		this.fontRenderer.drawString(header, left + (WIDTH - headerWidth) / 2, top + 12, 0);

		if (currentPage instanceof BookPageItemDisplay) {
			renderItemDisplayPage((BookPageItemDisplay) currentPage, mouseX, mouseY);
		} else if (currentPage instanceof BookPageMat) {
			renderMatPage((BookPageMat) currentPage, mouseX, mouseY);
		} else if (currentPage instanceof BookPageText) {
			renderTextPage((BookPageText) currentPage, mouseX, mouseY);
		}

		if (chapters.get(currentChapter).getPageCount() > 1) {
			GlStateManager.pushMatrix();
			float textScale = 0.5F;
			GlStateManager.scale(textScale, textScale, textScale);
			String pageNum = (currentPageNum + 1) + "/" + chapters.get(currentChapter).getPageCount();
			int pageNumWidth = (int) (this.fontRenderer.getStringWidth(pageNum) * textScale);
			int x = (int) ((left + (WIDTH - pageNumWidth) / 2) / textScale);
			this.fontRenderer.drawString(pageNum, x, (int) ((top + 164) / textScale), 0);
			GlStateManager.popMatrix();
		}
	}

	super.drawScreen(mouseX, mouseY, partialTicks);

}
 
開發者ID:the-realest-stu,項目名稱:Adventurers-Toolbox,代碼行數:35,代碼來源:GuiBook.java

示例2: rebake

private static BakedModelSpellPage rebake(ModelSpellPage model, Spell spell) {	
	Matrix4f m = new Matrix4f();
       m.m20 = 1f / 128f;
       m.m01 = m.m12 = -m.m20;
       m.m33 = 1;
       Matrix3f rotation = new Matrix3f();
       m.getRotationScale(rotation);
       Matrix3f angle = new Matrix3f();
       angle.rotZ(1.5708F);
       rotation.mul(rotation, angle);
       m.setRotationScale(rotation);
       m.setScale(0.75F * m.getScale());
       m.setTranslation(new Vector3f(0.8625F, 0.095F, 0.8625F));
	SimpleModelFontRenderer fontRenderer = new SimpleModelFontRenderer(Minecraft.getMinecraft().gameSettings, font, Minecraft.getMinecraft().getTextureManager(), false, m, DefaultVertexFormats.ITEM) {
		@Override
		protected float renderUnicodeChar(char c, boolean italic) {
			return super.renderDefaultChar(126, italic);
		}
	};
	TextureAtlasSprite fontSprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(font2.toString());
	List<BakedQuad> textQuads = new ArrayList<BakedQuad>();
	
	fontRenderer.setSprite(fontSprite);
       fontRenderer.setFillBlanks(false);
       String name = TextFormatting.BOLD + I18n.translateToLocal(spell.getUnlocalizedName() + ".name");
       String text = I18n.translateToLocal(spell.getUnlocalizedName() + ".desc");
       String castingType = "--" + I18n.translateToLocal(spell.getCastingType().getName() + ".name") + "--";
       
       int yOffset = 0;
       fontRenderer.drawString(name, (126 - fontRenderer.getStringWidth(name)) / 2, yOffset, 0x007A0000);
       yOffset += (fontRenderer.FONT_HEIGHT + 1);
       List<String> lines = fontRenderer.listFormattedStringToWidth(text, 126);
       for (int line = 0; line < lines.size(); line++) {
       	int offset = ((126 - fontRenderer.getStringWidth(lines.get(line))) / 2);
       	fontRenderer.drawString(lines.get(line), offset, yOffset, 0x004F0000);
       	yOffset += fontRenderer.FONT_HEIGHT;
       }
       yOffset += 5;
       fontRenderer.drawString(castingType, (126 - fontRenderer.getStringWidth(castingType)) / 2, yOffset, 0x00210000);
	
       textQuads.addAll(fontRenderer.build());
       return new BakedModelSpellPage(model, textQuads);
}
 
開發者ID:the-realest-stu,項目名稱:Infernum,代碼行數:43,代碼來源:ModelSpellPage.java

示例3: drawListHeader

/**
 * Handles drawing a list's header row.
 */
protected void drawListHeader(int insideLeft, int insideTop, Tessellator tessellatorIn)
{
    String s = TextFormatting.UNDERLINE + "" + TextFormatting.BOLD + this.getListHeader();
    this.mc.fontRendererObj.drawString(s, insideLeft + this.width / 2 - this.mc.fontRendererObj.getStringWidth(s) / 2, Math.min(this.top + 3, insideTop), 16777215);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:8,代碼來源:GuiResourcePackList.java


注:本文中的net.minecraft.util.text.TextFormatting.BOLD屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。