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

How to update without reopening #205

Open
Gorayan opened this issue Apr 11, 2022 · 1 comment
Open

How to update without reopening #205

Gorayan opened this issue Apr 11, 2022 · 1 comment
Assignees
Labels

Comments

@Gorayan
Copy link

Gorayan commented Apr 11, 2022

I would like a way to update items without reopening inventory.

When the update function is called, HumanEntity reopens the inventory. However, this has the following problems.

Problems

  • If a player closes their inventory at about the same time as the update, it will re-open on the client side
  • Flickering occurs the moment I refresh

These problems become more pronounced when creating UIs that require frequent updates(every ticks), such as timers

  public void update() {
      updating = true;

      for (HumanEntity viewer : getViewers()) {
          ItemStack cursor = viewer.getItemOnCursor();
          viewer.setItemOnCursor(new ItemStack(Material.AIR));

          show(viewer);  // <-Here

          viewer.setItemOnCursor(cursor);
      }

      if (!updating)
          throw new AssertionError("Gui#isUpdating became false before Gui#update finished");

      updating = false;
  }
@Vespertilo
Copy link

any update on this? I'm having the same issue.

@stefvanschie stefvanschie self-assigned this Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants