[1.10.2] Runtime Exception - Electric Locomotive
tomelfring opened this issue ยท 15 comments
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
It can be fixed by adding a !world.isRemote
check on https://github.com/CovertJaguar/Railcraft/blob/mc-1.10.2/src/main/java/mods/railcraft/common/carts/EntityLocomotive.java#L641
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.
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?
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
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)
You should do without that check since the check is supposed to be done before the packet is sent.
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
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.