Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where duplicate Huds can occur if they are added too quickly #266

Closed
wants to merge 2 commits into from

Conversation

Zailer43
Copy link
Contributor

Currently, Huds are bugged if added too rapidly. For instance, in the test mode, if J key is held down, Hud#add can be called twice because it triggers before ClientRenderCallback#BEFORE, resulting in multiple additions. Removing these Huds does not clear previous ones, making it impossible to remove the Hud

ClientTickEvents.END_CLIENT_TICK.register(client -> {
while (binding.wasPressed()) {
if (Hud.hasComponent(hudComponentId)) {
Hud.remove(hudComponentId);
} else {
Hud.add(hudComponentId, hudComponent);
}
}

@gliscowo
Copy link
Member

gliscowo commented Aug 9, 2024

I appreciate the effort in trying to fix this specific problem, but I think it's more fixing a symptom and less a problem - the entire implementation of this class if flawed and needs to be redone, which I'll take care of eventually.

As such, I'll be closing the PR - thanks for pointing this out though!
Cheers

@gliscowo gliscowo closed this Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants