Jump to content

Recommended Posts

Posted (edited)

I can't figure out why I get the exception "java.lang.IllegalStateException: Rendersystem called from wrong thread"

Exception:

  Reveal hidden contents

 

Custom Screen:

  Reveal hidden contents

 

Custom Entity

  Reveal hidden contents

 

When I show the Custom Screen (QuestScreen) for the first time it's all perfect without any exception or error. Just when I close it by clicking a button or pressing ESC and then right click my QuestGiverVillager again the problem occours.

Edited by Ezio214
forgot title
  • Ezio214 changed the title to [1.19.2] Rendersystem called from wrong thread
Posted

You are calling setScreen() on the server thread. mobInteract() is called on both the client and server.

https://forge.gemwire.uk/wiki/Sides

You shouldn't even be referencing client classes directly, like your QuestScreen, in common classes like an Entity that exists on dedicated servers.

The vanilla villager's mobInteract() uses Player.openMenu() which opens a container menu. i.e. a screen that is managed on the server with a "proxy" on the client.

In particular MerchantMenu with its gui MerchantScreen.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

So do I have to rewrite/modify my QuestScreen to a MenuProvider/SimpleMenuProvider subclass or how can I show my Screen without getting the "Rendersystem called from wrong thread" exception?

Posted

If you don't want to use a container menu, you will need to send a custom network packet to the client that tells it to the open the screen.

I don't know of any vanilla code that does this?

You normally want the linkage between client and server that the container menu provides for making sure state is updated on the server.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

But why dont I get the exception when it opens the first time? Why is it only when it shows the second time?

Also I wouldn't like to rewrite it to a new container menu, because I don't need the players inventory. I just want to show some text and give the player to press the accept or decline.

Since any vanilla code does not send a network packet to the client I think I shouldn't either.

Isn't there any other way I can show a screen to the player when he interacts with an entity?

Posted (edited)

If there is no data or processing relevant on the server, you can check the side.

You basically let the client decide to show the screen with no veto by the server.

You still shouldn't have client classes directly in your entity.

 

But I don't think that is what you want? You have an "isTalking" field which doesn't look to implemented properly no synch server <-> client

I am guessing your intention is that the villager can only talk to one player at once? As it stands, that is kind of true on the server, but not on the client.

The client has no idea if the villager is talking to other players only if the local player is.

And the server has no idea when players stop talking to villagers.

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

Yep you are right. There is no synch between server <-> client with my variable isTalking, which indeed was for my intention, that only one player can talk to the villager at a time. I removed it completly since I already had in mind to change it because it doesn't make any sense for my mod. With that said, thank you again !

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.