broese / mcbuild

A custom Minecraft client with advanced auto-building capabilities
26 stars 11 forks source link

Feature Request: Vps Remote Server #22

Open ZafotheNinja opened 6 years ago

ZafotheNinja commented 6 years ago

Reading through the other issue chat got me thinking, is it possible to do a remote server with mcb?

Example:

1: Mcb started and running on vps.

2: Player uses his computer/laptop to connect to the remote mcb server.

3: Mcb uses the vps internet to make a really low ping/fast connection to the target server.

Result: Ability to connect to servers with a slow connection and stay logged in even if the player loses connection with the mcb server.

Is this possible? Also, is it possible to change the ip/port of the mcb server?

broese commented 6 years ago

Unfortunately it's no longer possible. It was possible some time ago (during 1.8), but then Mojang improved account security and now checks whether the authenticating request originates from the same IP as the account has logged in from. This means, the MCB and the launcher must run in the same location. The most you can do is to run them on separate machines in your local network that are behind the same NAT, so they appear under same IP on the outside.

broese commented 6 years ago

Other idea: somehow tunnel the traffic from your client to the remote server where MCB is running. Technically, only HTTP/HTTPS is necessary. What you could try with "relative" ease:

  1. get a remote machine with SSH access
  2. log in to it via SSH, using dynamic port forwarding. PuTTY has it under Connection/SSH/Tunnel options. Dynamic forwarding only requires port number - on this port on your localhost it will create a SOCKS proxy that tunnels the traffic to remote location, but this kind of proxy must be supported by the application you use
  3. start MCB on the remote server
  4. Start your launcher with an additional Java parameter to specify it should use the proxy. This article describes how to do that, but I haven't try that : https://gaming.stackexchange.com/questions/257600/using-socks-with-minecraft If you're using MultiMC - they appear to support SOCKS as well under proxy settings
  5. Log out and log in again in your MC account - if that works as it should, this login should go through the tunnel and exit on remote server, so Mojang will think you are logging in from there
  6. Now, launch the client, and probably you will also have to specify proxy as additional JVM parameter
  7. Oh, and you will also need to copy the MC profile to the remote machine, so MCB can find it there. You don't need the entire directory, just ~/.minecraft/launcher_profiles.json (if using vanilla launcher), or MultiMC's accounts.json file. Also the tokens will change after a new login, so you will have to copy it over again.
broese commented 6 years ago

So this is pretty much what you can try. MCB itself does not need any changes. I would say it's more trouble to set it all up than benefit from it. MCB tunnels all traffic to your client anyway, so there will be only a very little reduction in bandwidth. Packets for placing blocks do not take that much.

And yes, there is an option for specifying MCB's own bind address: -b [addr:]port By default it's 0.0.0.0:25565, i.e. port 25565 on all local network interfaces

ZafotheNinja commented 6 years ago

I was thinking more along the lines of, provide multimc with login info, and use mcb's server strictly for controlling the player.

All authentication would be done on the remote computer so you could even set mcb's server for offline mode if you wanted to.

I'll see what I can do with the proxy/tunneling idea, that sounded good.

ZafotheNinja commented 6 years ago

Tried with the proxy, looks like mcb logs out whenever I loses connection not exactly what I was hoping for lol.