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


Java ElementType.FOOD屬性代碼示例

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


在下文中一共展示了ElementType.FOOD屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: onRenderMountHealth

@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderMountHealth(RenderGameOverlayEvent event)
{
    if (event.type == ElementType.EXPERIENCE || event.type == ElementType.FOOD || event.type == ElementType.JUMPBAR )
    {
        YesOrNo = true;
    }

    if (!event.isCancelable() || !YesOrNo)return;

    if(this.mc.thePlayer.ridingEntity != null)
    {
        GuiIngameForge.renderFood = true;
    }

    if(GuiIngameForge.renderExperiance)
    {
        if(this.mc.thePlayer.ridingEntity instanceof EntityHorse)
        {
            GuiIngameForge.renderJumpBar = Keyboard.isKeyDown(Keyboard.KEY_SPACE);
        }
    }
}
 
開發者ID:DouweKoopmans,項目名稱:BetterHorseHud,代碼行數:23,代碼來源:ModGui.java

示例3: drawOverlay

@ForgeSubscribe
public void drawOverlay(final RenderGameOverlayEvent.Post event)
{
    if (!Loader.isModLoaded("tukmc_Vz"))
    {
        if (event.type == ElementType.FOOD)
        {
            final Minecraft client = Minecraft.getMinecraft();

            client.renderEngine.bindTexture(texture);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

            final int bars = (int) (9 * HungerSystem.getPercentage(client.thePlayer));
            // int bars = 4;

            for (int x = bars; x > 0; x--)
            {
                drawTexturedModalRect(event.resolution.getScaledWidth() / 2 + width + -x * 8 + 9 * width, event.resolution.getScaledHeight() - 39, u, v, width, height);
            }
            client.renderEngine.bindTexture(HungerOverlay.icons);
        }
    }
}
 
開發者ID:TeamMetallurgy,項目名稱:Agriculture,代碼行數:23,代碼來源:HungerOverlay.java

示例4: 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

示例5: renderGameOverlay

/** Alters HUD rendering. */
@SubscribeEvent
public void renderGameOverlay(RenderGameOverlayEvent.Pre event) {
    
    EntityPlayer player = Geomastery.proxy.getClientPlayer();
    int centreX = event.getResolution().getScaledWidth() / 2;
    int resHeight = event.getResolution().getScaledHeight();
    
    if (event.getType() == ElementType.HOTBAR &&
            GeoConfig.gameplay.temperature) {
        
        drawTempIcon(player, centreX, resHeight);
    }
    
    if (event.getType() == ElementType.AIR) {

        if (player.isInsideOfMaterial(Material.WATER)) {
            
            drawAirBubbles(player, centreX, resHeight);
        }
        
        event.setCanceled(true);
    }
    
    if (event.getType() == ElementType.FOOD && GeoConfig.gameplay.food) {

        drawFoodBars(player, centreX, resHeight);
        event.setCanceled(true);
    }
}
 
開發者ID:JayAvery,項目名稱:geomastery,代碼行數:30,代碼來源:ClientEvents.java

示例6: ReDraw_Food

@SubscribeEvent
public void ReDraw_Food(RenderGameOverlayEvent.Pre event) {
	if(event.type == ElementType.FOOD) {
		if (Helper.isUnDraw(Helper.getPlayer(), "Food")) {
			return ;
		}
		
    	event.setCanceled(true);
    	Minecraft mc = Minecraft.getMinecraft();
    	int width = event.resolution.getScaledWidth();
    	int height = event.resolution.getScaledHeight();
    	int hunger = Minecraft.getMinecraft().thePlayer.getFoodStats().getFoodLevel();
    	int maxhunger = 20;
    	
    	int goalwidth = width / 2;
        int goalheight = height - 39;
        
        if (Helper.getHUDPositionX(Helper.getPlayer(), "Food") != 0) {
        	goalwidth = (int) (width * Helper.getHUDPositionX(Helper.getPlayer(), "Food")) - 45;
        }
        
        if (Helper.getHUDPositionY(Helper.getPlayer(), "Food") != 0) {
        	goalheight = (int) (height * Helper.getHUDPositionY(Helper.getPlayer(), "Food"));
        }
    
    	int length = 90 * hunger / maxhunger;
    	Gui.drawRect(goalwidth, goalheight, goalwidth + 90, goalheight + 9, 0x7F000000);
    	Gui.drawRect(goalwidth, goalheight, goalwidth + length, goalheight + 9, 0x7F7F3F00);

    	String hup = "Hunger: " + hunger + " / " + maxhunger;
    	FontRenderer fontRenderer = mc.fontRenderer;
    	int color = 0xFFFFFF;
        if (hunger <= maxhunger * 0.25) {color = 0xFF0000;}
        else if (hunger <= maxhunger * 0.5) {color = 0xFFFF00;}
        else if (hunger > maxhunger) {color = 0x00FF00;}
    	fontRenderer.drawStringWithShadow(hup, goalwidth, goalheight, color);
    	fontRenderer.drawString("", 0, 0, 0xFFFFFF);	//��ʼ��ײ�Ѽ�    
    	
    	mc.renderEngine.bindTexture(Gui.icons);
    }
}
 
開發者ID:Kanbe-Kotori,項目名稱:BetterHUD,代碼行數:41,代碼來源:ReDraw_HUD_Food.java


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