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


Java FontRenderer.getUnicodeFlag方法代碼示例

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


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

示例1: renderItemOverlayIntoGUI

import net.minecraft.client.gui.FontRenderer; //導入方法依賴的package包/類
@Override
public void renderItemOverlayIntoGUI(FontRenderer fontRenderer, @Nonnull ItemStack is, int par4, int par5, String par6Str) {
	if (!is.isEmpty() && !dankNull.isEmpty()) {
		float scaleFactor = useLg ? 1.0F : 0.5F;
		float inverseScaleFactor = 1.0F / scaleFactor;
		int offset = useLg ? 0 : -1;
		String stackSize = "";

		boolean unicodeFlag = fontRenderer.getUnicodeFlag();
		fontRenderer.setUnicodeFlag(false);
		if (is.getItem().showDurabilityBar(is)) {
			double health = is.getItem().getDurabilityForDisplay(is);
			int j = (int) Math.round(13.0D - health * 13.0D);
			int i = (int) Math.round(255.0D - health * 255.0D);

			GlStateManager.disableDepth();
			GlStateManager.disableTexture2D();

			Tessellator tessellator = Tessellator.getInstance();
			VertexBuffer vertexbuffer = tessellator.getBuffer();
			draw(vertexbuffer, par4 + 2, par5 + 13, 13, 2, 0, 0, 0, 255);
			draw(vertexbuffer, par4 + 2, par5 + 13, 12, 1, (255 - i) / 4, 64, 0, 255);
			draw(vertexbuffer, par4 + 2, par5 + 13, j, 1, 255 - i, i, 0, 255);

			GlStateManager.enableTexture2D();

			GlStateManager.enableDepth();
		}
		int amount = 0;
		amount = is.getCount();
		if (container != null) {
			//amount = container.getDankNullInventory().getSizeForSlot(DankNullUtils.getIndexForStack(container.getDankNullInventory(), is));
		}
		if (amount < 0 || amount > 127) {
			//amount = (byte) amount & (0xff);
		}
		if (amount != 0) {
			scaleFactor = 0.5F;
			inverseScaleFactor = 1.0F / scaleFactor;
			offset = -1;
			stackSize = getToBeRenderedStackSize(amount);
		}
		GlStateManager.disableLighting();
		GlStateManager.disableAlpha();
		GlStateManager.disableBlend();
		GlStateManager.disableDepth();
		GlStateManager.pushMatrix();
		GlStateManager.scale(scaleFactor, scaleFactor, scaleFactor);
		int X = (int) ((par4 + offset + 16.0F - fontRenderer.getStringWidth(stackSize) * scaleFactor) * inverseScaleFactor);
		int Y = (int) ((par5 + offset + 16.0F - 7.0F * scaleFactor) * inverseScaleFactor);
		if (amount > 1L) {
			fontRenderer.drawStringWithShadow(stackSize, X, Y, 16777215);
		}
		GlStateManager.popMatrix();
		GlStateManager.enableDepth();
		GlStateManager.enableBlend();
		GlStateManager.enableAlpha();
		GlStateManager.enableLighting();

		fontRenderer.setUnicodeFlag(unicodeFlag);
	}
}
 
開發者ID:p455w0rd,項目名稱:DankNull,代碼行數:63,代碼來源:DankNullRenderItem.java


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