Railcraft

Railcraft

34M Downloads

[1.10.2] Runtime Exception - Electric Locomotive

tomelfring opened this issue ยท 15 comments

commented

After using a Electric Locomotive, placed by another player, I got a client side crash with the following message at the server: "You derped up! Don't call this on the client!"

Relevant error message: http://pastebin.com/tCkDAicY

Edit: Forgot to mention the version, railcraft 10.0.0 beta 2

commented

Oh....one of those exceptions....

commented

Actually....I'm not sure that's the correct fix @liach. I'm reasonably certain that function should never be called clientside. If it is, then something else went wrong somewhere.

commented

it looks like this was called from the networking thread instead of the main MC thread from the stacktrace, forge uses the thread to determine the side so maybe it missidentified the side?

commented

Yep, that appears to be the problem.

commented

also the networking thread is not safe to access the world or anything related to it so you'll probably want to move everything to the main thread

commented

And how the fuck does one do that?

commented

you want to get the minecraft instance or WorldServer instance and use addScheduledTask

ref: http://mcforge.readthedocs.io/en/latest/networking/simpleimpl/ (the big orange warning if you scroll down a little)

commented

Reading that, but it is far from clear where or how you use that.

commented

You should do without that check since the check is supposed to be done before the packet is sent.

commented

basicly on the minecraft instance or the worldserver instance you call that and pass it a lambada/function, it will be added to a que that is constanly checked by main thread and executed from that main thread

commented

No idea if that's right, but it seems to work.

commented

It is the error with the side instead of with threads IMO.

commented

No, it's definitely threads. That much I am sure about. There is no way for that code to be called from the client and the sided check that fails checks the current thread identity and defaults to client.

commented

also any code that interacts with the world, players or anything like that should not be executed on the networking thread as those things are not threadsafe