当前位置: 首页>>代码示例>>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;未经允许,请勿转载。