deathcap / wsmc

WebSocket proxy to Minecraft
33 stars 10 forks source link

[wsmc/Java] Forge support. Closes GH-40 #41

Closed deathcap closed 8 years ago

deathcap commented 8 years ago

https://github.com/deathcap/wsmc/issues/40 Forge mods auto-detection (forgeAutoVersion) proxying

deathcap commented 8 years ago
[15:27:30] [Thread-8/INFO] [STDOUT]: [deathcap.wsmc.mc.ping.PingStatus:writePacket:83]: writePacket=0F 00 2F 09 6C 6F 63 61 6C 68 6F 73 74 09 FB 01 
[15:27:30] [Thread-8/INFO] [STDOUT]: [deathcap.wsmc.mc.ping.PingStatus:writePacket:83]: writePacket=01 00 
[15:27:31] [Thread-8/INFO] [STDOUT]: [deathcap.wsmc.web.WebThread:run:69]: ping response: deathcap.wsmc.mc.ping.PingResponse@6e6afe3d
[15:27:31] [Thread-8/INFO] [STDOUT]: [deathcap.wsmc.web.WebThread:run:70]: ping description=A Minecraft Server, type=FML
[15:27:31] [Server thread/INFO] [STDOUT]: [deathcap.wsmc.UserIdentityLinker:getOrGenerateUserKey:93]: new key generated for testuser: DG8HKyii
[15:27:31] [Server thread/INFO] [STDOUT]: [deathcap.wsmc.plugins.sponge.WsmcSpongePlugin:tellPlayer:148]: Web client enabled: http://localhost:24444/#testuser:DG8HKyii
> Feb 13, 2016 3:27:40 PM deathcap.wsmc.web.WebSocketHandler setupInitialConnection
INFO: Received WS connection: /0:0:0:0:0:0:0:1:61356 --> /0:0:0:0:0:0:0:1:24444
Feb 13, 2016 3:27:40 PM deathcap.wsmc.web.WebSocketHandler setupInitialConnection
INFO: readableBytes = 17
Feb 13, 2016 3:27:40 PM deathcap.wsmc.web.WebSocketHandler setupInitialConnection
INFO: clientCredential = testuser:DG8HKyii
[15:27:40] [nioEventLoopGroup-3-2/INFO] [STDOUT]: [deathcap.wsmc.UserIdentityLinker:verifyLogin:58]: successfully verified websocket connection for testuser
> Feb 13, 2016 3:27:40 PM deathcap.wsmc.web.WebSocketHandler setupInitialConnection
INFO: Forge support enabled
[15:27:40] [Thread-9/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftThread:run:36]: Connecting to localhost:2555 as testuser
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelActive:105]: Connected to localhost/127.0.0.1:2555
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler$1:operationComplete:121]: wrote handshake packet
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:52]: opcode = 3
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:53]: 03 80 
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:71]: Compression threshold set to 256
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:84]: m = UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 3, cap: 3)=03 80 02 
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:88]: mc -> ws: 03 03 80 02 
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:43]: read dataLength=0
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:84]: m = UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 48, cap: 48)=00 02 24 38 61 39 37 34 39 39 32 2D 33 38 32 39 2D 33 33 61 61 2D 39 37 66 31 2D 63 61 35 35 65 61 35 62 66 31 65 32 08 74 65 73 74 75 73 65 72 
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:88]: mc -> ws: 30 00 02 24 38 61 39 37 34 39 39 32 2D 33 38 32 39 2D 33 33 61 61 2D 39 37 66 31 2D 63 61 35 35 65 61 35 62 66 31 65 32 08 74 65 73 74 75 73 65 72 
[15:27:40] [Server thread/WARN] [mixin]: Method overwrite conflict for getSlotProvider in mixins.common.core.json:item.inventory.TraitInventoryAdapter, previously written by org.spongepowered.common.mixin.core.entity.player.MixinInventoryPlayer. Skipping method.
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:43]: read dataLength=0
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:84]: m = UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 45, cap: 45)=00 3F 08 52 45 47 49 53 54 45 52 46 4D 4C 7C 48 53 00 46 4D 4C 00 46 4D 4C 7C 4D 50 00 46 4D 4C 00 46 4F 52 47 45 00 53 70 6F 6E 67 65 
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:88]: mc -> ws: 2D 00 3F 08 52 45 47 49 53 54 45 52 46 4D 4C 7C 48 53 00 46 4D 4C 00 46 4D 4C 7C 4D 50 00 46 4D 4C 00 46 4F 52 47 45 00 53 70 6F 6E 67 65 
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:43]: read dataLength=0
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:84]: m = UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 15, cap: 15)=00 3F 06 46 4D 4C 7C 48 53 00 02 00 00 00 00 
[15:27:40] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:88]: mc -> ws: 0F 00 3F 06 46 4D 4C 7C 48 53 00 02 00 00 00 00 
[15:27:42] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:43]: read dataLength=0
[15:27:42] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:84]: m = UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 7, cap: 7)=00 00 99 AE EA F0 02 
[15:27:42] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:88]: mc -> ws: 07 00 00 99 AE EA F0 02 
> Feb 13, 2016 3:27:42 PM deathcap.wsmc.web.WebSocketHandler messageReceived
INFO: ws received 7 bytes: 00 00 99 AE EA F0 02 
Feb 13, 2016 3:27:42 PM deathcap.wsmc.web.WebSocketHandler messageReceived
INFO: id 0 stripped 7 reply=00 00 99 AE EA F0 02 
[15:27:42] [Netty Server IO #2/INFO] [FML]: Unexpected packet during modded negotiation - assuming vanilla or keepalives : net.minecraft.network.play.client.C00PacketKeepAlive
> Feb 13, 2016 3:27:42 PM deathcap.wsmc.web.WebSocketHandler$1 operationComplete
INFO: forwarded WS -> MC, 0 bytes
[15:27:44] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:43]: read dataLength=0
[15:27:44] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:84]: m = UnpooledUnsafeDirectByteBuf(ridx: 0, widx: 7, cap: 7)=00 00 9C BE EA F0 02 
[15:27:44] [nioEventLoopGroup-4-1/INFO] [STDOUT]: [deathcap.wsmc.mc.MinecraftClientHandler:channelRead:88]: mc -> ws: 07 00 00 9C BE EA F0 02 
> Feb 13, 2016 3:27:44 PM deathcap.wsmc.web.WebSocketHandler messageReceived
INFO: ws received 7 bytes: 00 00 9C BE EA F0 02 
Feb 13, 2016 3:27:44 PM deathcap.wsmc.web.WebSocketHandler messageReceived
INFO: id 0 stripped 7 reply=00 00 9C BE EA F0 02 
Feb 13, 2016 3:27:44 PM deathcap.wsmc.web.WebSocketHandler$1 operationComplete
INFO: forwarded WS -> MC, 0 bytes
[15:27:44] [Netty Server IO #2/INFO] [FML]: Unexpected packet during modded negotiation - assuming vanilla or keepalives : net.minecraft.network.play.client.C00PacketKeepAlive

^ with the tagged host, but without FML|HS

deathcap commented 8 years ago

Plan: send the ping response data to WS, then let it handle it, including modifying behavior with forgeHandshake from node-minecraft-protocol-forge (to implement FML|HS). Since ping responses are normally sent/received out-of-band, but here everything goes over the WebSocket, will require WSMC protocol changes.

deathcap commented 8 years ago

Added the ping response to the login_success packet, at the end of the username field delimited by \0 (comparable to Forge adding \0FML\0 to the hostname field of set_protocol). Updated the example client to recognize this and enable forgeHandshake - works well, able to connect to Sponge/Forge server via wsmc/Java