Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

So,

I have two thread : The first one is the one of minecraft, the second one is async thread that I created to do something on the web.

I would like that when the second thread is done, the first thread execute a method ( and not the second thread because minecraft really doesn't like when you use method using another thread).

Before the second thread ended, the first thread must continue working.

Does anyone have any idea of how to do that please ?

 

Edited by uiytt
Clarification

Hi

You could consider using the packet receiving system to do that.

Any time a packet is received, it is in a network thread.  The network thread creates a Runnable lambda which is then executed in either the client thread or the server thread.

Some more info here:

http://greyminecraftcoder.blogspot.com/2020/03/thread-safety-with-network-messages-1144.html

 

There's probably a way for your second thread to add your own Runnable lambda to those queues without using packets.

 

Alternatively, you could perhaps subscribe to a Tick event on the server or the client, and every tick check your second thread to see whether it has finished executing or not.

 

-TGG

  • Author

Well I tried :

Minecraft.getInstance().runImmediately(new Runnable() {
	@Override
	public void run() {
		MultiPlayerGui.this.minecraft.displayGuiScreen(new ConnectingScreen(MultiPlayerGui.this, MultiPlayerGui.this.minecraft, server));
	}
});

And it's really weird...

In my console, I receive everything from the server chat. But on my game, it's stuck on loading the terrain infinitely !!!

MultiPlayerGui is my custome class but the rest is not..

I don't undersant why O_o

  • Author
7 hours ago, diesieben07 said:

Any reason you are using runImmediately? Whats the thread that this is called from?

A thread that I created to check for my server's information.
If I use the screen directly from my thread, minecraft will crash..

Edited by uiytt

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.