minecraft-data icon indicating copy to clipboard operation
minecraft-data copied to clipboard

1.12 to 1.13 conversion data?

Open uncovery opened this issue 6 years ago • 20 comments

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

uncovery avatar Nov 07 '18 04:11 uncovery

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

rom1504 avatar Nov 07 '18 07:11 rom1504

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.

uncovery avatar Nov 07 '18 07:11 uncovery

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 ?

rom1504 avatar Nov 07 '18 07:11 rom1504

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.

uncovery avatar Nov 07 '18 07:11 uncovery

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

rom1504 avatar Nov 07 '18 07:11 rom1504

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.

lintx avatar Nov 12 '18 03:11 lintx

@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?

uncovery avatar Nov 12 '18 03:11 uncovery

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

lintx avatar Nov 12 '18 03:11 lintx

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?

uncovery avatar Nov 12 '18 04:11 uncovery

https://minecraft.gamepedia.com/1.13/Flattening

lintx avatar Nov 12 '18 04:11 lintx

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.

uncovery avatar Nov 12 '18 04:11 uncovery

I agree it would be nice to have that conversion data. If someone has time to do it, feel free !

On Mon, Nov 12, 2018, 05:34 Uncovery [email protected] wrote:

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.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/minecraft-data/issues/216#issuecomment-437752230, or mute the thread https://github.com/notifications/unsubscribe-auth/ACPN_qWcBuz8ED2F_wNhD4vsYh7bkpqQks5uuPpvgaJpZM4YRxNA .

rom1504 avatar Nov 12 '18 08:11 rom1504

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...

uncovery avatar Nov 12 '18 08:11 uncovery

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

rom1504 avatar Nov 12 '18 10:11 rom1504

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)

uncovery avatar Nov 23 '18 11:11 uncovery

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 avatar Nov 23 '18 11:11 rom1504

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)

uncovery avatar Nov 23 '18 11:11 uncovery

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

wgaylord avatar Jan 21 '20 19:01 wgaylord

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

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

caelunshun avatar Mar 10 '20 04:03 caelunshun

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

rom1504 avatar Jan 11 '21 00:01 rom1504