Jump to content

Recommended Posts

Posted

I'm trying to hide the hunger bar. I've done the same with the renderHealth, and works properly, but for some reasons doesn't work with the hunger bar.

This is the method called in a LivingUpdateEvent

public static void HideHungerBar(EntityPlayer player) {
	if (player.getFoodStats().getFoodLevel() >= Properties.Hud.hideHungerBarThreshold)
	{
		GuiIngameForge.renderFood = false;
	}
}

Using the logger I know that the game enter in the method, and placing a log for renderFood before GuiIngameForge.renderFood = false will return true before and false after, but the bar doesn't disappear.

 

ForgeVersion: 14.23.0.2545

Posted (edited)
On 15/1/2018 at 4:02 PM, diesieben07 said:
  • To disable/enable HUD elements dynamically (not permanently) you need to use RenderGameOverlayEvent.Pre, not the static fields in GuiIngameForge.

Does RenderGameOverlayEvent run every frame and not every tick? I'm the bar should hide after 5 seconds but the timer increases at crazy speed and hides after less than 1 sec

Edited by Insane96MCP
Posted
4 hours ago, Insane96MCP said:

Does RenderGameOverlayEvent run every frame and not every tick? I'm the bar should hide after 5 seconds but the timer increases at crazy speed and hides after less than 1 sec

Yes, it runs every frame, not every tick. Rendering must always happen every frame.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

world#getWorldTime

world#getTotalWorldTime

And one other I can't remember the name of at the moment. One tells you the game's "date" (non-resetting value that increments by 1 tick per tick and is modified by the /time command) the other gets you the curernt "time" (midnight to midnight) and another gets you how long the world has existed (1 tick per tick, does not get modified by sleeping or /time).

  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
18 hours ago, Draco18s said:

world#getWorldTime

world#getTotalWorldTime

And one other I can't remember the name of at the moment. One tells you the game's "date" (non-resetting value that increments by 1 tick per tick and is modified by the /time command) the other gets you the curernt "time" (midnight to midnight) and another gets you how long the world has existed (1 tick per tick, does not get modified by sleeping or /time).

Thanks a lot. World.getTotalWorldTime() and a subtraction did the job.

 

5 hours ago, diesieben07 said:

Note that these will pause when you pause the game. If you truly want a 5-second fade-out, you need to count ticks (or use System.currentTimeMillis).

Not a problem in my case.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.