Replay Mod Forums

[Question] .mcpr Format
    • User
    • 47 forum posts
    User12470
    #1

    Sep 05 15, 02:26 PM

    So I have an odd question. I am wondering how the recordings are formatted. I am attempting to write a script to import these recordings into Blender (An animation and rendering software) so I can then render them out and add custom animations and models and such. I realize this is a large task, but I just want to at least get the world importing nicely.

    tl;dr
    So, how are the .mcpr files formatted? All help is appreciated.


    • Moderator
    • Beta Tester
    • 357 forum posts

    The mcpr file format is actually a zip file. There is a recording.tmcpr in it. That is the actual recording.
    It contains all the packets you got from the server, so if you want to load that, into Blender.. Good luck!


    • User
    • 47 forum posts


    The mcpr file format is actually a zip file. There is a recording.tmcpr in it. That is the actual recording.
    It contains all the packets you got from the server, so if you want to load that, into Blender.. Good luck!

    Thanks! That will definitely help me!


    • Developer
    • 818 forum posts
    User1
    #4

    Sep 05 15, 02:59 PM

    I highly doubt you'll be able to convert the packets from the .tmcpr into an .obj file (or a similar file type that Blender can read) representing the Replay's World.

    I suggest you try to use a tool like WorldDownloader while in the Replay (not sure if that's possible) and convert the extracted World into an .obj File - there are plenty of tools out there to fulfill such a task.


    • User
    • 47 forum posts


    I highly doubt you'll be able to convert the packets from the .tmcpr into an .obj file (or a similar file type that Blender can read) representing the Replay's World.

    I suggest you try to use a tool like WorldDownloader while in the Replay (not sure if that's possible) and convert the extracted World into an .obj File - there are plenty of tools out there to fulfill such a task.

    The recording contains the chunk packets correct? If it does I should be able to create the corresponding cubes and materials from some presets.



    • Developer
    • 818 forum posts



    I highly doubt you'll be able to convert the packets from the .tmcpr into an .obj file (or a similar file type that Blender can read) representing the Replay's World.

    I suggest you try to use a tool like WorldDownloader while in the Replay (not sure if that's possible) and convert the extracted World into an .obj File - there are plenty of tools out there to fulfill such a task.

    The recording contains the chunk packets correct? If it does I should be able to create the corresponding cubes and materials from some presets.

    Yes, it does. Good luck.


    • User
    • 47 forum posts




    I highly doubt you'll be able to convert the packets from the .tmcpr into an .obj file (or a similar file type that Blender can read) representing the Replay's World.

    I suggest you try to use a tool like WorldDownloader while in the Replay (not sure if that's possible) and convert the extracted World into an .obj File - there are plenty of tools out there to fulfill such a task.

    The recording contains the chunk packets correct? If it does I should be able to create the corresponding cubes and materials from some presets.

    Yes, it does. Good luck.

    Thanks :)


    • Moderator
    • Beta Tester
    • 249 forum posts
    User20
    #8

    Sep 05 15, 06:22 PM

    Please inform us in this thread once you got something showable. I'm pretty keen if you'll manage it :)


    • User
    • 47 forum posts
    User12470
    #9

    Sep 05 15, 06:43 PM


    Please inform us in this thread once you got something showable. I'm pretty keen if you'll manage it :)

    Ok, can do.

    @User1
    How is the packet file structured? Is each line a packet? Also I'm guessing your just saving the raw tcp packets right? So I should just be able to decode them pretty easily? Sorry if I sound like a noob, but I just want to ask every question I can so I don't end up wasting hours trying to figure something out on my own.


    • Developer
    • 818 forum posts
    User1

    in response to User12470

    #10

    Sep 05 15, 10:02 PM | Last edited: Sep 05 15, 10:03 PM

    Spoiler: Quote


    The .tmcpr file can be read using a DataInputStream in Java.
    The following pattern repeats until EOF:

    1) an Integer which represents the packet's timestamp (in milliseconds from Replay start)
    2) an Integer which tells you how many bytes the packet consists of
    3) a byte array which represents the packet

    This is an example how a single packet is saved:
    Spoiler: Code



    Your biggest hurdle will be converting the byte array back to a Packet Object that you can work with. I suggest MCProtocolLib by Steveice10, an open source Java library.



    • User
    • 47 forum posts
    User12470

    in response to User1

    #11

    Sep 05 15, 10:06 PM | Last edited: Sep 05 15, 10:07 PM

    Spoiler: Quote


    Thanks a ton, unfortunately Blender addons have to be written in Python, so I can't use any Java libraries without translating them. But I guess I could make a java program to convert the mcpr file into another format readable by my blender script :D


    • Developer
    • 818 forum posts
    User1
    #12

    Sep 05 15, 10:09 PM

    This library may be of use for you.


    • User
    • 47 forum posts


    This library may be of use for you.

    Thanks, I saw that one earlier in my googling shenanigans.


    • Moderator
    • Beta Tester
    • 357 forum posts
    User13

    in response to User1

    #14

    Sep 05 15, 10:53 PM

    "an Integer which tells you how many bytes the packet consists of "
    So, that's why i got Overflow errors...


    • Developer
    • 818 forum posts
    User1

    in response to User13

    #15

    Sep 05 15, 11:19 PM


    "an Integer which tells you how many bytes the packet consists of "
    So, that's why i got Overflow errors...

    What did you do?



    • Moderator
    • Beta Tester
    • 357 forum posts
    User13

    in response to User1

    #16

    Sep 06 15, 09:54 AM

    Spoiler: Quote


    I tried to change the skin with a hex editor. But I guess it will not work .


    • User
    • 47 forum posts
    User12470
    #17

    Sep 11 15, 07:24 PM

    A quick update on my progress:
    I am successfully reading the mcpr format, my main obstacle right now is decoding the mc packets. My script can decode the packet type and decode simple chat packets, but that's it right now. I think I will tackle chunk packets first, as they are the most important.

    Also, I haven't been able to work on it for about a week because of school and a recent influx of plugin development jobs. If anyone is interested in helping me, I would greatly appreciate it!


    • Moderator
    • Beta Tester
    • 125 forum posts


    A quick update on my progress:
    I am successfully reading the mcpr format, my main obstacle right now is decoding the mc packets. My script can decode the packet type and decode simple chat packets, but that's it right now. I think I will tackle chunk packets first, as they are the most important.

    Also, I haven't been able to work on it for about a week because of school and a recent influx of plugin development jobs. If anyone is interested in helping me, I would greatly appreciate it!
    Would appreciate an update on this, if you have anything :)


    • User
    • 47 forum posts



    A quick update on my progress:
    I am successfully reading the mcpr format, my main obstacle right now is decoding the mc packets. My script can decode the packet type and decode simple chat packets, but that's it right now. I think I will tackle chunk packets first, as they are the most important.

    Also, I haven't been able to work on it for about a week because of school and a recent influx of plugin development jobs. If anyone is interested in helping me, I would greatly appreciate it!
    Would appreciate an update on this, if you have anything :)

    Haven't worked on it at all because of high school starting again and a recent surge of plugin jobs. I might have time soon to work on it a bit more, any help is appreciated :)


    • Beta Tester
    • 126 forum posts
    User8
    #20

    Nov 13 15, 08:39 PM

    *leaving reply here to get notifications of updates on your mission*



    • User
    • 1 forum post
    User24527

    in response to User1

    #21

    Dec 11 15, 05:18 AM | Last edited: Dec 11 15, 05:19 AM


    I highly doubt you'll be able to convert the packets from the .tmcpr into an .obj file (or a similar file type that Blender can read) representing the Replay's World.

    I suggest you try to use a tool like WorldDownloader while in the Replay (not sure if that's possible) and convert the extracted World into an .obj File - there are plenty of tools out there to fulfill such a task.
    WorldDownloader + Replaymod?
    I've tested that actually, and I will admit, it work but at the cost of crashing Minecraft right after it finish saving, which is not really a problem since it's easy to reopen Minecraft.
    Once that done, it's possible to use jmc2obj to turn the area downloaded into an obj file, but that would only be helpful for using a map into a obj file for 3D editing programs, not for a video, and it might need tweaking, especially since the map can lose it's colors (I've never seen it make a colored obj file).

    I like to do these steps when I try to make a 3D map file for fun, since I prefer stampling with blocks over using blender to make maps (I can't even figure how to use blender, so I like to use other softwares like sketchup, but I have a better sense of feel and creativity when using minecraft to do the map).


    • User
    • 3 forum posts
    User30976
    #22

    Jan 30 16, 05:48 AM

    I am one of the developers working on jmc2obj, and I definitely looking into loading mcpr files and converting the data. Should be fun! It would help if the mod was open source, I wish it had met its kickstarter goal (i'm sure CP does to!), but I can still figure it out somehow.


    • User
    • 3 forum posts
    User30976
    #23

    Feb 01 16, 11:04 AM | Last edited: Feb 01 16, 11:05 AM

    If anyone is interested, here is a quick and dirty mcpr reader. I accidentally included some buildpath import sources, but that's fine since you'll need them if you are importing the project into an ide.

    https://github.com/Moonlight63/ReplayMod-.mcpr-File-Reader-api-

    Normally I would release something with code as messy and un-commented as this, but it was an experiment more that anything else. it works! sortof.