This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var GreedyMesh = (function greedyLoader() { | |
// contains all forward faces (in terms of scan direction) | |
var mask = new Int32Array(4096); | |
// and all backwards faces. needed when there are two transparent blocks | |
// next to each other. | |
var invMask = new Int32Array(4096); | |
// setting 16th bit if transparent | |
var kTransparentMask = 0x8000; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create and connect the bot | |
var mineflayer = require('mineflayer'); | |
var bot = mineflayer.createBot({ username: 'testLookAt' }); | |
bot.on('login', function() { | |
setTimeout(function() { | |
// find a block to test with | |
verify(findBlockAtVector(-0.25, -0.5, 0.00)); | |
verify(findBlockAtVector( 0.25, -0.5, 0.00)); | |
verify(findBlockAtVector( 0.00, -0.5, -0.25)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// REPL example bot for mineflayer | |
// | |
// Connects to server but doesn't have any built in logic. The terminal where | |
// it was started is now a REPL (Read-Eval-Print-Loop). Anything typed will be | |
// interpreted as javascript printed using util.inspect. Don't forget to try | |
// tab completion. These variables are exposed as local: | |
// | |
// var mineflayer = require('mineflayer'); | |
// var bot = mineflayer.createBot({ username: 'REPL' }); | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""A simple addition to Python's optparse module supporting subcommands | |
like those found in the svn or hg CLIs. | |
To use it, instantiate the Subcommand class for every subcommand you | |
want to support. Each subcommand has a name, aliases, a help message, | |
and a separate OptionParser instance. Then pass a list of Subcommands | |
to the constructor of SubcommandsOptionParser to make a subcommand- | |
aware parser. Calling parse_args on that parser gives you the | |
subcommand invoked, the subcommand's arguments and options, and the | |
global options all in one fell swoop. See the smoke test at the bottom |