Closed flagmaggot closed 5 years ago
Hi - First, I love that you made it work! And I'm impressed that you waded in to the admittedly sloppy code :) This project started quite a while ago, and the world format has changed dramatically a few times. And all along I was eager to optimize it for speed so the code is a bit crazy in places now.
I'm starting to look at this PR and it's a bit overwhelming. It's hard to get a clear view of exactly what you did w/ all the sub diffs. Looks like it is mostly dealing with looking up things by name/identifier instead of by block/item id. I'm gonna keep at it. More soon.
Nah your code wasnt sloppy!
Ignore some of the commented out blocks, I forgot to clear those out before submitting the PR. To learn how things worked I had to add those for debugging/testing. If I remember correctly I left the ID code as it is but used my "name" code in as a fall back of the IDs weren't found.
Then there's the issue with generating the json for the entities/items so I had to take those I to account since those stopped working too.
Some of it may not make sense but if you need me to explain something let me know! I had a blast getting it to work!
I did a few more changes after the PR if you want to look at my branch that doesn't fill the json file with "unknowns" (which coincidentally ends up being gravel, go figure)
The code in this PR segfaults for me when looking through the contents of chests in one of my older worlds (doesn't happen on a fresh world) I'll see if I can work out what's causing it.
Oh interesting, how old is the world? I just started playing about a month ago.
The world is over a year old, so it has seen a few upgrades. Commenting out the code for looking through the items in chests fixed it for now - I'll see if I can work out exactly which item(s) cause problems tomorrow!
I dug into your PR and set about merging the way you would do it with the way I would do it. Thank you very much for the PR I'm gonna publish the changes soon!
I spent some time learning how the code works (mostly) and got it to work successfully. There's a few caveats, the IDs have to be created for items that don't contain IDs (ie the panda and new cat) but those are added. I'm somewhat happy with the results but I'm positive it could be made prettier so excuse my sleepy coding.