Backups of worskpace.mcreator

Published by DaanMC on
Status
Fixed
Issue description

Original title: Stuck at "Loading workspace data" after computer crash

Hi, I've got a problem that I can't solve myself:

I've been working on my mod continuously for many hours today, and just as I had happily finished a big chunk of boring and repetitive work, my computer crashed.

I immediately restarted my computer, only to find out that MCreator 1.8.2 wouldn't load anymore and instead get stuck on the "Loading workspace data..." part. I read some other forum topics about the getting stuck part, and decided to run the .bat file, which gave this output:   (post continues underneath)

[Thu Jan 31 23:21:09 CET 2019] [Launcher] Java version: 1.8.0_192, specification: 1.8
[Thu Jan 31 23:21:09 CET 2019] [Launcher] Current JAVA_HOME for running instance: D:\MCreator\MCreator182\jdk\jre
[Thu Jan 31 23:21:10 CET 2019] [Launcher] Installation path: D:\MCreator\MCreator182
[Thu Jan 31 23:21:10 CET 2019] [Launcher] User home of MCreator: C:\Users\daanv\.mcreator\
[Thu Jan 31 23:21:10 CET 2019] [WebIO] Reading from URL: https://mcreator.net/app
[Thu Jan 31 23:21:10 CET 2019] Skipping update message ...
[Thu Jan 31 23:21:10 CET 2019] [WebIO] Reading from URL: https://mcreator.net/app/motw
[Thu Jan 31 23:21:10 CET 2019] [WebIO] Reading from URL: https://mcreator.net/app/news
[Thu Jan 31 23:21:11 CET 2019] Exception in thread "AWT-EventQueue-0" [Thu Jan 31 23:21:11 CET 2019] com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
[Thu Jan 31 23:21:11 CET 2019]  at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
[Thu Jan 31 23:21:11 CET 2019]  at com.google.gson.Gson.fromJson(Gson.java:888)
[Thu Jan 31 23:21:11 CET 2019]  at com.google.gson.Gson.fromJson(Gson.java:853)
[Thu Jan 31 23:21:11 CET 2019]  at com.google.gson.Gson.fromJson(Gson.java:802)
[Thu Jan 31 23:21:11 CET 2019]  at com.google.gson.Gson.fromJson(Gson.java:774)
[Thu Jan 31 23:21:11 CET 2019]  at co.pylo.mcreator.workspace.c.d(SourceFile:110)
[Thu Jan 31 23:21:11 CET 2019]  at co.pylo.mcreator.workspace.Workspace.getCurrentWorkspace(SourceFile:232)
[Thu Jan 31 23:21:11 CET 2019]  at co.pylo.mcreator.workspace.b.a.c(SourceFile:675)
[Thu Jan 31 23:21:11 CET 2019]  at co.pylo.mcreator.a.<init>(SourceFile:904)
[Thu Jan 31 23:21:11 CET 2019]  at co.pylo.mcreator.Launcher.lambda$main$1(SourceFile:158)
[Thu Jan 31 23:21:11 CET 2019]  at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
[Thu Jan 31 23:21:11 CET 2019]  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
[Thu Jan 31 23:21:11 CET 2019]  at java.awt.EventQueue.access$500(EventQueue.java:97)
[Thu Jan 31 23:21:11 CET 2019]  at java.awt.EventQueue$3.run(EventQueue.java:709)
[Thu Jan 31 23:21:11 CET 2019]  at java.awt.EventQueue$3.run(EventQueue.java:703)
[Thu Jan 31 23:21:11 CET 2019]  at java.security.AccessController.doPrivileged(Native Method)
[Thu Jan 31 23:21:11 CET 2019]  at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
[Thu Jan 31 23:21:11 CET 2019]  at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
[Thu Jan 31 23:21:11 CET 2019]  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
[Thu Jan 31 23:21:11 CET 2019]  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
[Thu Jan 31 23:21:11 CET 2019]  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
[Thu Jan 31 23:21:11 CET 2019]  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[Thu Jan 31 23:21:11 CET 2019]  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
[Thu Jan 31 23:21:11 CET 2019]  at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
[Thu Jan 31 23:21:11 CET 2019] Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
[Thu Jan 31 23:21:11 CET 2019]  at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
[Thu Jan 31 23:21:11 CET 2019]  at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213)
[Thu Jan 31 23:21:11 CET 2019]  ... 23 more

Now the real problem is: I've heard about the option to secure the workspace backup file and reinstalling MCreator, but the workspace file isn't up-to-date. In fact: it doesn't contain any of the things that I spent half my day on. On the other hand, the rest of the MCreator182 directory does contain everything, all mods are present in the user folder and the forge/src folder too. Is there a way to restore everything I had from the files that are still in the program's folders? Any help would be appreciated, as I am NOT looking forward to having to do all the hard work AGAIN.

Issue comments

Check if there are any mcreator.workspace.lock files in the user folder. If so, rename it to mcreator.workspace and it should work. If not, you are out of luck as the file got corrupted during the crash.

The best option would be to add all mod elements with the same names back to the workspace, but simply add them, don't bother with textures and other data, so you "recreate" the workspace file. Then copy all other files from user folder while MCreator is closed so you restore the actual mod data.

mcreator.workspace file that got corrupted links all mod elements together.

As this happened to a few people already, we will consider adding a backup mechanic to workspace file. I will keep this ticket open for the purpose of this and change it to a feature request.

Unfortunately, both methods didn't work and I ended up starting where I was before my session. I think it is a good thing that this will be a feature, as that would save a lot of people's time and effort if something happens to go wrong. Thanks for your support though.

Automated backups of workspace file will be added in MCreator 1.8.3. I am closing this ticket now.