robotman3000 / DragonProxy

A proxy for Minecraft Pocket Edition connecting to Minecraft PC servers, such as Mineplex.
http://dragonet.org
GNU General Public License v3.0
8 stars 1 forks source link

Fix translators #19

Closed DaMatrix closed 7 years ago

DaMatrix commented 7 years ago

This is still WIP, do not merge I'm working on fixing the translators. Yeah. What do I say?

DaMatrix commented 7 years ago

I'm going to need to figure out what DataCache is, as it seems to have been removed from the code.

robotman3000 commented 7 years ago

Look at the code in 527b13245f10c20842fedd98c1a2ef41a1f1e4c1. Off the top of my head that is the last commit where the data cache system was still working. Look in UpstreamSeasion. I was planning to reimplement the system in ClientConnection if you want to do it yourself.

robotman3000 commented 7 years ago

Awesome work, thanks for your help. Have you done anything with chunk translation yet?

DaMatrix commented 7 years ago

I haven't started the chunk translator yet, I'm just going through the translators in the order they show up in my IDE.

DaMatrix commented 7 years ago

OK. All the translators compile now, but there's lots of errors in the log when trying to connect. Working on that now

DaMatrix commented 7 years ago

Hm. I'm kinda stuck here, if somebody who actually understands the MCPE protocol could give me a hand here, it would be greatly appreciated. Here's what I get when connecting to a server from MCPE: http://pastebin.com/EQhXCSYT I don't understand how there could be any ArrayIndexOutOfBoundsExceptions here...

DaMatrix commented 7 years ago

I've solved all the exceptions, everything should work now, but it doesn't. The client waits a moment with a blank screen and then says "Disconnected from server". I don't understand the MCPE protocol in the slightest, so I can't really do much here. :/

robotman3000 commented 7 years ago

We might want to get MrPowerGamerBR in on this.

robotman3000 commented 7 years ago

@MrPowerGamerBR Would you be able to help with fixing the translators? I remember you had wanted to do that before the new network system was implemented.

robotman3000 commented 7 years ago

@DaMatrix I do know that at least the chunk translator isn't translating properly because of the chunk format change. See issue #5 in my fork.

MrPowerGamerBR commented 7 years ago

@robotman3000 sorry, I'm busy with my upcoming MCPE server. :/

(I actually wanted DragonProxy to use a PC server for my upcoming MCPE server, but since I got stuck in the chunk translator issue, I started poking the Nukkit source to see if I could understand something... then I said fuck it and forked Nukkit)

robotman3000 commented 7 years ago

@MrPowerGamerBR Ok, Thanks anyway.

However you may be interested to know that the packets I was sending in mimimalClientHandshake may have had an affect on whether the chunks would render or not. PE -> PE packet passthrough worked except for chunk's until I stopped using minimalClientHandshake, at which point they just started appearing like normal.

MrPowerGamerBR commented 7 years ago

@robotman3000 strange... so PE -> PE passthrough does work then? Maybe I will take a look later then.

The problem for me is the chunk packet, because I can't figure out why that doesn't work.

robotman3000 commented 7 years ago

@MrPowerGamerBR Yes it works.

robotman3000 commented 7 years ago

@MrPowerGamerBR I also had to change the RakNet packet reliability to unreliable, in addition to not using minimalClientHandshake. That is about the extent of my knowledge about this problem that you don't already know

MrPowerGamerBR commented 7 years ago

@robotman3000 as far as I know MCPE uses RakNet reliable ordered, strange that it is causing issues with that.

robotman3000 commented 7 years ago

@MrPowerGamerBR I forget whether it was the client or server protocol adapter I changed to make it work, but I think it was MCPEServerProtocolAdapter

MrPowerGamerBR commented 7 years ago

@robotman3000 http://i.imgur.com/5014920.png

robotman3000 commented 7 years ago

@MrPowerGamerBR What server software are you using? It looks like you have a win10 client from the mouse cursor.

robotman3000 commented 7 years ago

@DragonetMC Are any of you guys available to help with updating the translators?

MrPowerGamerBR commented 7 years ago

@robotman3000 yes, MCW10 trying to connect to DragonProxy to a 1.11.2 server (to see what happens to fix the issues)

robotman3000 commented 7 years ago

@MrPowerGamerBR Does the proxy or the server generate the full server message?

MrPowerGamerBR commented 7 years ago

@robotman3000 the client doesn't even connect to the server http://i.imgur.com/eqVOZtm.png

I forgot what causes the client to show "The server is full!".

Nothing in the 1.11.2 server.

(Maybe it is the protocol version? I'm testing with 1.0.3)

robotman3000 commented 7 years ago

@MrPowerGamerBR This may be worth checking. If the max number of clients is set to -1 in the proxy config file it will refuse all connections. It's a bug that i haven't yet bothered to fix. Basically -1 (MaxOnline) < 0 (CurrentOnline) so the server is full.

robotman3000 commented 7 years ago

@MrPowerGamerBR Also if that is your problem, I gather that you have a new config file, so set the authentication mode to offline (from cls which is the default). That's the only one that works right now.

robotman3000 commented 7 years ago

@MrPowerGamerBR If the protocol version were a problem your disconnect message would be different

robotman3000 commented 7 years ago

@MrPowerGamerBR It would be something about an outdated client or server

MrPowerGamerBR commented 7 years ago

@robotman3000 okay, the max player was the issue, but now...

http://i.imgur.com/xmqmSig.png

MrPowerGamerBR commented 7 years ago

Also I'm compiling with the latest version here, not @DaMatrix's fork.

robotman3000 commented 7 years ago

@MrPowerGamerBR Which latest version, my fork or the refactor branch?

MrPowerGamerBR commented 7 years ago

@robotman3000 your fork

robotman3000 commented 7 years ago

@MrPowerGamerBR Is that exception keeping you from connecting now?

MrPowerGamerBR commented 7 years ago

@robotman3000 yep

robotman3000 commented 7 years ago

@MrPowerGamerBR Also what issues are you referring to in particular?

MrPowerGamerBR commented 7 years ago

@robotman3000 NullPointerException when trying to join the proxy.

I will probably take a look on what is causing this issue later. Also, I'm using "offline" mode in DragonProxy's config.

DaMatrix commented 7 years ago

Yeah, as I said I don't get any RuntimeExceptions on my end, it looks like it's running fine but the client doesn't even get to the "Building terrain" screen.

robotman3000 commented 7 years ago

@MrPowerGamerBR Something to try is using 7e9ed9e7401262a9d1f9b76dece890a49c564704 it's a few commits before the latest one. It is right before the negative-array-size fix which I haven't yet been able to test. The commit I've referenced is the last time I knew both passthrough modes to be working. All packet translation is broken though (The translators won't compile and have to be removed)

robotman3000 commented 7 years ago

@DaMatrix Are you using a passthrough mode or a translator mode?

DaMatrix commented 7 years ago

I'm talking about the translators (because that's what this PR is about)

robotman3000 commented 7 years ago

@DaMatrix Is minimalClientHandshake enabled. The purpose of that code was to get the client to allow access to the chat by spawning it into the world, which would get you past the loading screens.

MrPowerGamerBR commented 7 years ago

And I'm trying to get the proxy working to fix the translators. (Probably I will compile @DaMatrix's fork to see what happens)

@DaMatrix: If you don't send the: PlayStatusPacket, ResourcePackInfoPacket, StartGamePacket and PlayStatusPacket (in this order) you wouldn't get past the "building terrain" screen

robotman3000 commented 7 years ago

@DaMatrix Yes, MrPowerGamerBR said it better than I did. Look at my comments in the code about those packets for a little more about this

robotman3000 commented 7 years ago

@DaMatrix I just checked and in MCPEClientProtocolAdapter minimalClientHandshake is never called

DaMatrix commented 7 years ago

Does it need to be? I've got this: https://github.com/2pocket2edition/2p2eProxy/blob/fix/translators/DragonProxy/src/main/java/org/dragonet/proxy/network/translator/pc/PCJoinGamePacketTranslator.java#L84

robotman3000 commented 7 years ago

That fixes the connection exceptions, but it still doesn't seem to work

DaMatrix commented 7 years ago

That's why I'm confused :/

DaMatrix commented 7 years ago

Also vaguely on topic: how are you pushing commits to my branch???

robotman3000 commented 7 years ago

The arrayIndex error was caused by onClientLoginRequest sending the login packet and not the status packet. Look at line 290 in MCPEClientProtocolAdapter

robotman3000 commented 7 years ago

@DaMatrix Uhh, I have absolutely no idea.

robotman3000 commented 7 years ago

@DaMatrix Perhaps I have push permissions since your branch is currently in a pull request to mine?