Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.12 to 1.13 conversion data? #216

Closed
uncovery opened this issue Nov 7, 2018 · 20 comments
Closed

1.12 to 1.13 conversion data? #216

uncovery opened this issue Nov 7, 2018 · 20 comments
Labels

Comments

@uncovery
Copy link
Contributor

uncovery commented Nov 7, 2018

Is it possible to extract a json that indicates how block/item data from 1.12 maps is converted to 1.13 maps?

@rom1504
Copy link
Member

rom1504 commented Nov 7, 2018

You can try to do the mapping on the name.
It will probably work for part of the blocks and items.

@uncovery
Copy link
Contributor Author

uncovery commented Nov 7, 2018

I tried that already, but as you said, it works only for part of the items.
I was hoping that, as minecraft upgrades itself, there would be a translation table available somewhere for doing that automatically.

@rom1504
Copy link
Member

rom1504 commented Nov 7, 2018

Ah you meant something provided by Mojang ? Definitely not.

But anyway, it's not possible to make such a table because there are many new items and some new blocks.

Even old blocks are mapped to several 1.13 blocks.

What problem are you trying to solve ?

@uncovery
Copy link
Contributor Author

uncovery commented Nov 7, 2018

How does minecraft load a chest from a 1.12 map and convert it to 1.13? There must be an internal table that translates the old values to the new ones?

I running a minecraft server where we allow people to trade goods via MySQL-driven shop system. Since the shop records items in the database, I need to manually upgrade all the item names from one to the next version. I was hoping to be able to automate it. I can automate a lot already with the historic names, but not everything.

@rom1504
Copy link
Member

rom1504 commented Nov 7, 2018

Ah you're right maybe there's something in the part of Minecraft that read the map files. I'll try looking into that.

@lintx
Copy link

lintx commented Nov 12, 2018

you can use the 1.12 data and 1.13 data to create a script file to update mysql data,change the item id form 1.12 to 1.13,but the 1.13.1 add 5 new item and minecraft-data not update.

@uncovery
Copy link
Contributor Author

@lintx how can I create a script that knows that
"id": 2257, "displayName": "Cat Disc", "name": "record_cat"
needs to be updated to
"id": 770, "displayName": "Music Disc", "name": "music_disc_cat",
without manually making that assignment?

@lintx
Copy link

lintx commented Nov 12, 2018

you can create a python/node.js/php/other file to change the mysql data.
example for node.js and mysql pack:
if you mysql data is

id item_id displayName name
1 770 Music Disc music_disc_cat
2 xxx Xxxxx xxxx_xxx

you can read the json in node.js to data:

{
770:{
item_id:2267,
displayName:'Cat Disc',
name:'record_cat'
},
xxx:{
....
}
}

770is the old item id,2267is the new item id,displayName is the new item displayName,name is the new item name.

            db.query('select * from you_table_name limit 0,100',(err,result)=>{
                if (err){
                    //select error, you must log it
                }
                result.forEach((index)=>{
                    let row = result[index];//mysql row
                    if (data.hasOwnProperty(row.item_id)) {
                        let item = data[row.item_id];//json row
                        db.query('update `you_table_name` set item_id=?, displayName=?, name=?  where `id`=?',[row.id,item.item_id,item.displayNamp,item.name],(err,result)=>{
                            if (err){
                                //change error, you must log it
                            }
                        });
                    }
                });
            });

you must ergodic mysql all row and change success

@uncovery
Copy link
Contributor Author

But where do you get this info from:
770:{ item_id:2267,
How does the code know that the old 1.12 2267 is the same as 1.13 770?

@lintx
Copy link

lintx commented Nov 12, 2018

@uncovery
Copy link
Contributor Author

Well, for one, I don't see the json in there that links stained_glass:1 to orange_stained_glass.

But much more in general terms, if the HTML in the wiki was the answer to all block/item/biome questions, then this whole github project would be redundant. From what I know, this whole project is made so that people do NOT have to do the wiki->JSON conversion themselves.

For what it's worth, I already wrote my conversion code for 95% of the stuff anyhow, but there were still a bunch of them leftover that I had to do manually. I was hoping that manual work would not be needed as the MC code must have this table, with ALL details somewhere already existing.And that there was an easy/automated way to get that conversion table out of the minecraft code (or even from the wiki for that matter) and include the resulting conversion table as JSON in this project.

Last but not least, that page you linked to is only valid for the 12->13 upgrade but not for future releases. If we would know where in the code the map upgrade happens, we could do that conversion also for future version upgrades if item/block renaming happens but not in a scale that warrants it's own wiki page.

@rom1504
Copy link
Member

rom1504 commented Nov 12, 2018 via email

@uncovery
Copy link
Contributor Author

Do you have any idea where the conversion in the mineraft code takes place? Maybe I can get the rest done once I know where to look...

@rom1504
Copy link
Member

rom1504 commented Nov 12, 2018

I would guess it's in the part of Minecraft that read the map (anvil) files.
I don't know more than that though.

@uncovery
Copy link
Contributor Author

I found where it is but it's a part of the compiled code. So I would think this issue is not solvable. Much of the code's functions names are abstracted as well (a,b,c etc)

@rom1504
Copy link
Member

rom1504 commented Nov 23, 2018

Much of Minecraft Data is extracted using the burger tool that is based on decompiling the minecraft code.
So no the fact it is in the compiled code is not necessarily a problem.

Where is it exactly ?

@rom1504 rom1504 reopened this Nov 23, 2018
@uncovery
Copy link
Contributor Author

Of course I might be wrong, but from the class names it should most likely be net.minecraft.server.v1.13_R2.ChunkConverrter.Java (as found in spigot, not spigot-api)

@wgaylord
Copy link
Contributor

If this is still relevant I can look into making some tables from reading the code manually. That way they exist for future use.

@caelunshun
Copy link

Here's a useful file which someone could parse and generate mappings with:

https://bugs.mojang.com/secure/attachment/151784/the_flattening.txt

@rom1504
Copy link
Member

rom1504 commented Jan 11, 2021

we have this data there https://github.com/PrismarineJS/prismarine-schematic/blob/master/lib/legacy.json
adding it in mc data would be good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants