Skip to content

Instantly share code, notes, and snippets.

@mappum
Created February 13, 2012 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mappum/1814257 to your computer and use it in GitHub Desktop.
Save mappum/1814257 to your computer and use it in GitHub Desktop.
Minecraft.BetaClient = function(args) {
if(Minecraft.ENVIRONMENT == 'node') {
if(typeof Minecraft.node.net == 'undefined') Minecraft.node.net = require('net');
this.host = args.host;
this.port = args.port || 25565;
this.username = args.username || 'Player';
this.status = 0;
if(typeof args.onLogin == 'function') this.onLogin = args.onLogin;
this.socket = new Minecraft.node.net.Socket();
this.socket.on('data', function(data) {
console.log(data);
}).connect(this.port, this.host, function() {
this.socket.write('\2' + args.username);
this.status = 1;
});
} else {
throw new Error('Only compatible in node');
}
};
TypeError: undefined is not a function
at repl:1:9
at REPLServer.eval (repl.js:80:21)
at repl.js:190:20
at REPLServer.eval (repl.js:87:5)
at Interface.<anonymous> (repl.js:182:12)
at Interface.emit (events.js:67:17)
at Interface._onLine (readline.js:162:10)
at Interface._line (readline.js:426:8)
at Interface._ttyWrite (readline.js:603:14)
at ReadStream.<anonymous> (readline.js:82:12)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment