Do you remember this post where I asked you to help me?
Thanks a lot for all who helped! I made some big process now in the code and we can now see how this system works. I found it quite interesting how one can interface different systems so I thought I’d share:
So we have this image file in the minecraft wiki. It’s used to create all the icons in the wiki, instead of using individual files. In order to use it. the website needs to know which item is displayed where. So I created a copy of the image where I outlined the coordinates of each item. Then I created an Excel sheet where the same coordinates are listed and I asked all of you to help me fill in the item names. Then I made a second tab in the excel sheet called “output” where I just translated the 2-dimensional table into a 1-dimensional list of items and had it copy all the numbers of the rows & lines next to it.
Next, I found a function for PHP that allows me to download Google sheets to the webserver via the Google API and parse the data. Then I wrote a function to write the data to a file as a PHP array. The file includes the x/y coordinates in the matrix as well as the line in the second tab of the excel sheet, just in case we need to fix something there.
Sounds complicated, right? Well it is, but only once now when I created it. the advantage that we have now is that once there is a new block (1.12 anyone?) we just need to download the latest image from the wiki (which I do automatically daily now), and edit the excel sheet and put in the item name there. The rest is then also fully automated. So I do not have to maintain clunky lists of items that have now grown to almost 4000 lines. Instead we can crowd-source data in an excel sheet!
You can now already see the results. In the website’s shop manager all the blocks are already there. There are some with question mark blocks that are not working yet (but now I can find them easily), but most of them work perfectly.
There are still some things to do such as having the software write a central CSS file instead of creating the CSS on the fly for every item, properly displaying damaged items and stuff like fireworks etc, but that’s now just some legwork since all the technical hurdles are gone. Yay!