jhead / phantom

Use your own Minecraft server with your Xbox or PS4 and play with friends!
MIT License
613 stars 76 forks source link

Possible Realms Support? #125

Open TheNoswad opened 4 years ago

TheNoswad commented 4 years ago

Hi.

Recently I have been looking at how PS4 players could play Minecraft Realms. Minecraft realms are similar to a self hosted server as each realm has its own IP and port. I have been able to join my realm by connecting to it's IP and port with it also having the capability to connect to it from another device under "LAN Games"

Here is the tedious process I used to get this to work

  1. Start Minecraft
  2. Select "Play"
  3. Wait for your realm to "fetch"
  4. Start capturing packets
  5. Join your realm and wait to join the game
  6. Leave your realm
  7. Stop capturing packets
  8. Open your packet capture in a program like Wireshark
  9. Look for packets with the format "MCPE"
  10. Use the IP address and port from on of those packets that are coming from the server to join your realm.

I used "packet_capture" and 'Wireshark" on ChromeOS but this would work fine on another device. I could not get any of the packet capture apps on android to work 'realms couldn't connect for some reason' and you must preform the packet capture on the device you are connecting to the realm from.

Hopefully this could be implemented into this project somehow. The bedrock realms have been researched and documented https://wiki.vg/Bedrock_Realms. With this information, The IP and port could be retrieved by phantom along with the required Xbox Live Authentication.

I hope someone can look into this further. Thanks in advance!

TheNoswad commented 4 years ago

Update!

I have tested this with phantom and realms work flawlessly with PS4 and PSVR. Other players are able to join the realm as well. It would be great if other people could test and maybe implement this so you don't have to do a packet capture each time you want to join a realm. The realm will shut down if nobody is playing and when the realm starts back up, the IP and port changes.

rickemery commented 4 years ago

Hi @Noswad-Zip

I stumbled across this issue and I've tried to recreate your steps. Phantom is sending pongs to my PS4 client, but the PS4 is not seeing the server in the list.

You were using the source port in the MCPE packets as the server port, correct? Is this still working for you?

TheNoswad commented 4 years ago

Hi @rickemery

It should be the source port but you could try some of the other addresses. Be sure to check the port as well. Strangely, I couldn't get phantom to work on Ubuntu 20.04. I was using MacOS Mojave (10.14). And then again, sometimes I couldn't get it to work myself. It would send pongs but the PS4 wouldn't see it.

Make sure a player is in the realm from the time when you disconnect for the packet capture to when you join from PS4. I'm not sure how long the realm stays on after all players disconnect.

Funnily enough, if you enter your realm's IP into your server list you will get to see all of the other realms that the IP is reused on. Of course, you can't join because of blacklist.

I don't really have time to test it lately, but I'm still happy to help.