ChangedBlocks struct stores the json object of type:
p0_0_0: {a: 0, bt: 0}
This object is used inside the savedGame object to keep track
of each changed block in the world:
p0_0_0: position of block in world, where px_y_z
a: 0 if block does match natural generation / 1 if block does not match natural generation
bt: type of block
JSLevel struct stores the object format of a
classic js level of type:
{“worldSeed”:0,“changedBlocks”:{},“worldSize”:128,“version”:1}
References the ChangedBlocks struct
worldSeed: This is the seed of the world
changedBlocks: This is an array of all changedBlocks in the world
worldSize: This is the width/length of the world, must be 128, 256, or 512
version: Yeah, I have no clue what this is, but it’s seemingly always 1 so…
LocalStorage struct stores input from localStorage db files
key: “savedGame”
utf16_length: Length of uncompressed value
conversion_type: 1
compression_type: 1
value: The actual savedGame, so the actual world
Settings struct stores the json object containing all settings for javascript worlds
These settings include typical control and sound settings, but they also contain the username
Following function accepts a world size and seed,
and then passes them to the js world generation
functionality, and then returns the output as a Vec<>
Following function takes a seed and creates a JSLevel from this seed,
and then compares it agains the given tilemap to create a json formatted
JS world save
Following function accepts a path to a db file, and a
json string. The json string is parsed as the value and
compressed using snappy compression, and is then passed
to the db and saved. Note this only applies to Firefox,
as firefox is the only browser that I know of that uses
this structure. Chromium support in the future…
Following function excepts a file location and an array containing both a
world save and settings formatted as json string. It then creates a
localStorage.setItem() command for the key savedGame and settings,
in order for it to be copy pasted into a browser console to
insert the world save
Following function accepts a path to a db file, and a
json string. The json string is parsed as the value and
compressed using snappy compression, and is then passed
to the db and saved. Note this only applies to Firefox,
as firefox is the only browser that I know of that uses
this structure. Chromium support in the future…
Following function excepts a file location and a world save formatted as a
json string. It then creates a localStorage.setItem() command for the key
savedGame, in order for it to be copy pasted into a browser console to
insert the world save
Following function excepts a file location and settings formatted as a
json string. It then creates a localStorage.setItem() command for the key
settings, in order for it to be copy pasted into a browser console to
insert the world save