Commit graph

1209 commits

Author SHA1 Message Date
deathcap
9a68fd6c34 Support options.version==false in createClient() to auto-detect version 2016-01-30 22:53:38 -08:00
deathcap
163e2157fc Remove useless statement 2016-01-30 22:49:57 -08:00
deathcap
af62189e19 Rename src/createClientAuto.js -> src/client/autoVersion.js 2016-01-30 22:34:26 -08:00
deathcap
ea3b306988 Move options to client object
This allows client plugins to change the options on the client object,
and have it reflected in other plugins. Previously, had to rely on the
options being the same object, and hold a reference to it. Now it is
always accessible as `client.options`.
2016-01-30 22:31:10 -08:00
deathcap
89198c62ff Use minecraft-data for protocol version -> minecraft version 2016-01-30 22:27:36 -08:00
deathcap
66e6f4dd0b Update to use compatible sync API (createClient) 2016-01-30 22:16:36 -08:00
deathcap
00bf6acea9 Fix unintentional var client declaration 2016-01-30 22:09:25 -08:00
deathcap
4a677a25ba Use endian-toggle for UTF-16BE encoding (not in nodejs, see https://github.com/nodejs/node-v0.x-archive/issues/1684) 2016-01-30 21:40:03 -08:00
deathcap
6eb95766cb Add legacy ping type 1 support (includes versions) 2016-01-30 16:07:56 -08:00
deathcap
dda0cb2e77 Refactor ping replying into sendPingResponse() 2016-01-30 16:00:12 -08:00
deathcap
af542c29f2 Add server support for legacy ping type 0 (0xfe) 2016-01-30 15:56:48 -08:00
deathcap
9b824b5b88 Legacy ping is only allowed when in HANDSHAKING state (otherwise, varint packet length 254) 2016-01-30 15:28:40 -08:00
deathcap
4840ffe7b1 Splitter prepends length header to legacy ping for deserializer support 2016-01-30 15:20:53 -08:00
deathcap
c24718f64c Recognize legacy ping in splitter. GH-332 2016-01-30 14:45:41 -08:00
deathcap
9ec6d876ba Add wait_connect option, to require 'connect_allowed' event before src/client/setProtocol proceeds
Intended to allow clients to configure the client object before any data
is sent, specifically, before src/client/setProtocol sends the
set_protocol packet.
2016-01-28 09:49:37 -08:00
deathcap
a53a2977f2 Add dynamic cross-protocol support 2016-01-27 23:28:27 -08:00
deathcap
069a79ba3e Update client/forgeHandshake.js to be installable as module 2016-01-27 20:42:15 -08:00
deathcap
0ab5b6150d Rename src/fml.js -> src/client/forgeHandshake.js 2016-01-27 20:34:48 -08:00
deathcap
fd9caddb67 Merge branch 'master' into forge (client modularization)
Merging https://github.com/PrismarineJS/node-minecraft-protocol/pull/333
2016-01-27 20:27:53 -08:00
Romain Beaumont
a6a673a8c8 Merge pull request #333 from deathcap/m2client
Modularization attempt of createClient()
2016-01-27 22:46:26 +01:00
deathcap
c3d86d7674 Add client.connect(port, host) for backwards-compatibility
Would like to remove this method because it is hardcoded to dependent on
TCP/IP, but the serverTest uses it. Load tcp_dns as needed.
2016-01-26 01:15:59 -08:00
deathcap
bf5ce9e569 Pass haveCredentials/accessToken between client/caseCorrect and client/encrypt 2016-01-26 00:55:44 -08:00
deathcap
2f60088fdf Fix missing tcp_dns host option 2016-01-26 00:47:21 -08:00
deathcap
cf5f8c1c4c Pass options to all src/client/*, for consistency 2016-01-26 00:01:09 -08:00
deathcap
fe327c85e1 Move net.socket() and dns.resolveSrv() into client/net_tcp
This has been the trickest to refactor/remodularize, since it used to
modify the Client prototype to augument connect(host, port). This added
a dependence on TCP/IP host/port socketpairs, refactor to add a
'connect' option instead, called with the client instance. Update ping
accordingly, but it has to call connect itself since it does not include
client/caseCorrect, which normally calls connect. Still may be able to
improve further and untangle these interdependencies cleanlier.
2016-01-25 23:57:10 -08:00
deathcap
de36de8496 Break client/caseCorrect dependence on TCP/IP host/port; generalize options.connect(client) 2016-01-25 23:47:23 -08:00
deathcap
9c2112802a Fix ursa imports 2016-01-25 23:40:35 -08:00
deathcap
34534b2aa6 Move onLogin set state=PLAY to client/play 2016-01-25 23:36:36 -08:00
deathcap
b37dcc4d08 Move onConnect/set_protocol to client/setProtocol 2016-01-25 23:33:58 -08:00
deathcap
821227d73e Move making a request to get case-correct username before connecting to client/caseCorrect 2016-01-25 23:28:14 -08:00
deathcap
8c4406b4a2 Move keepAlive/checkTimeoutInterval to client/keepalive 2016-01-25 23:24:20 -08:00
deathcap
20e076ebcf Move onCompressionRequest to client/compress 2016-01-25 23:22:35 -08:00
deathcap
a727829a98 Move onKeepAlive to client/keepalive 2016-01-25 23:19:57 -08:00
deathcap
cbaaeb8eb2 Move onEncryptionKeyRequest to client/encryption 2016-01-25 23:18:32 -08:00
deathcap
bd72488bf3 Move FML|HS listener to forge_client example, reduce changes in createClient 2016-01-24 11:19:19 -08:00
deathcap
93c5c7315a Add tagHost option, clients can use to append to set_protocol serverHost
This is used by Forge clients to tell the server they support FML|HS,
otherwise the server will kick with "you must have FML/Forge installed".
2016-01-24 11:11:47 -08:00
deathcap
92b6c3778b Add documentation for forge/forgeMods options and forgeMods event 2016-01-23 21:00:00 -08:00
deathcap
c0271874d2 Emit forgeMods event when receiving server's ModList 2016-01-23 20:56:00 -08:00
deathcap
2802ac9d2b fml console.log -> debug 2016-01-23 20:54:43 -08:00
deathcap
f6ad1d8061 Move FML|HS to fml.js 2016-01-23 20:47:29 -08:00
deathcap
283b75d694 Forge client example pings server to get forgeMods list
Avoids the need to hardcode the mod list in the client, in order to
successfully connect to arbitrary Forge servers (with various mods).
2016-01-23 20:01:07 -08:00
deathcap
0b45b439bc Use symbolic values for writeAck() phase 2016-01-23 19:29:27 -08:00
deathcap
6c33ec2856 Refactor FML|HS to use state machine
Instead of responding based on the packet type received, maintain a
local state and ensure the correct packets are received. Should help
avoid unexpected states/behavior. See:
https://github.com/ORelio/Minecraft-Console-Client/pull/100/files#diff-65b97c02a9736311374109e22d30ca9cR297
2016-01-23 19:26:50 -08:00
deathcap
8fd30f6af9 Move to fmlHandshakeStep() 2016-01-23 19:03:54 -08:00
deathcap
0b2550e206 Add forgeMods option, set to array of Forge modifications installed on client 2016-01-23 18:17:18 -08:00
deathcap
1349fdfc73 Update examples to log when connection is lost
Normally, the client will send a kick packet if the client is
disconnected from the server, but if the connection is lost due to
network or lower-level protocol issues, the 'end' event will be emitted.
Log this event in the examples so it is clear why the scripts exit.
2016-01-23 18:08:18 -08:00
deathcap
46a134c5e9 Fix sending Handshake|Ack phase 2016-01-23 17:44:20 -08:00
deathcap
c680c0d12a Fix RegistryData hasMore field definition and usage 2016-01-23 17:05:33 -08:00
deathcap
265fcd9d4c ModList field uses 'modid' to match ServerPingList packet JSON 2016-01-23 17:04:02 -08:00
deathcap
6a6bdff5c8 fmlProtocolVersion client/server no longer collide 2016-01-23 17:03:13 -08:00