当前位置: 首页>>代码示例>>Java>>正文


Java ElementType.HEALTH属性代码示例

本文整理汇总了Java中net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.HEALTH属性的典型用法代码示例。如果您正苦于以下问题:Java ElementType.HEALTH属性的具体用法?Java ElementType.HEALTH怎么用?Java ElementType.HEALTH使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType的用法示例。


在下文中一共展示了ElementType.HEALTH属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onHudRender

@SubscribeEvent
public static void onHudRender(RenderGameOverlayEvent.Pre event)
{
	if (event.getType() == ElementType.ALL)
	{
		PlayerHUDRenderer.render(event.getPartialTicks());
	}
	
	if (	event.getType() == ElementType.HOTBAR || 
			event.getType() == ElementType.FOOD || 
			event.getType() == ElementType.HEALTH ||
			event.getType() == ElementType.EXPERIENCE)
	{
		event.setCanceled(true);
	}
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:16,代码来源:ExPHandlerClient.java

示例2: onRenderOverlay

@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Pre event)
{	
	if (event.getType() == ElementType.HEALTH)
	{
		event.setCanceled(true);
	}
	
	/*
	 * Repositions other Gui elements. 
	 */
	
	if (event.getType() == ElementType.ARMOR)
	{
		GuiIngameForge.left_height = 49;
	}
	
	if (event.getType() == ElementType.FOOD)
	{
		GuiIngameForge.right_height = 49;
	}
	
	if (event.getType() == ElementType.AIR)
	{
		GuiIngameForge.right_height = 59;
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:27,代码来源:GuiHealth.java

示例3: ReDraw_Health

@SubscribeEvent
public void ReDraw_Health(RenderGameOverlayEvent.Pre event) {
	if(event.type == ElementType.HEALTH) {
		if (Helper.isUnDraw(Helper.getPlayer(), "Health")) {
			return ;
		}
		
    	event.setCanceled(true);
    	Minecraft mc = Minecraft.getMinecraft();
        int width = event.resolution.getScaledWidth();
        int height = event.resolution.getScaledHeight();
        int health = (int) Minecraft.getMinecraft().thePlayer.getHealth();
        int maxhealth = (int) Minecraft.getMinecraft().thePlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue();
        
        int goalwidth = width / 2 - 91;
        int goalheight = height - 39;
        
        if (Helper.getHUDPositionX(Helper.getPlayer(), "Health") != 0) {
        	goalwidth = (int) (width * Helper.getHUDPositionX(Helper.getPlayer(), "Health")) - 45;
        }
        
        if (Helper.getHUDPositionY(Helper.getPlayer(), "Health") != 0) {
        	goalheight = (int) (height * Helper.getHUDPositionY(Helper.getPlayer(), "Health"));
        }
           
        int length = 90 * health / maxhealth;
        Gui.drawRect(goalwidth, goalheight, goalwidth + 90, goalheight + 9, 0x7F000000);
        Gui.drawRect(goalwidth, goalheight, goalwidth + length, goalheight + 9, 0x7F00FF00);
        
        String hp = "Health: " + health + " / " + maxhealth;
        FontRenderer fontRenderer = mc.fontRenderer;
        int color = 0xFFFFFF;
        if (health <= maxhealth * 0.25) {color = 0xFF0000;}
        else if (health <= maxhealth * 0.5) {color = 0xFFFF00;}
        else if (health > maxhealth) {color = 0x00FF00;}
        fontRenderer.drawStringWithShadow(hp, goalwidth, goalheight, color);
        fontRenderer.drawString("", 0, 0, 0xFFFFFF);	//��ʼ��ײ�Ѽ�       
        mc.renderEngine.bindTexture(Gui.icons);
    }
}
 
开发者ID:Kanbe-Kotori,项目名称:BetterHUD,代码行数:40,代码来源:ReDraw_HUD_Health.java


注:本文中的net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.HEALTH属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。