This a Post which talks about the introduction of the DataStores and the capability of Resets to the RS.
When I initially introduced the RS a couple of months ago, there was one flaw with it: Its data was distributed over several classes and several places inside those classes, all losely coupled using ITokens.
This was a problem when something broke. So I decided to change it.
Using our factory systems and a simple Map I was quickly able to create a nice central storage for our SRM:
This storage is now the central place were the RS stores data that it needs, I gave it an endpoint in its API:
Now that we have a central place to store the Data. We need a way to get it out. To make this possible we make use of TypeTokens (Google GenericType catchers) and again ITokens to identify which store we are looking for. As you can see the StandardDataStoreManager, will create a DataStore if it is not already known using our factory system:
Now that we have all our ducks in a row so to speak resetting the RS to its defaults was easy as this:
We resetup our SRM to create a new DataStoreManager and to get new ITokens for the respective datastores:
After that we run our SRM Update logik to register all components back into it again.
Done.
Now it is possible to use a single command to reset the RS, incase it breaks, without having to dig through several NBT files that Minecolonies uses.