Skip to content

Commit

Permalink
add physics. start with gravity
Browse files Browse the repository at this point in the history
Also:

 * add jumper example, jumps whenever you chat
 * fix `game` event to fire correctly
 * add `respawn` event which fires when you die or change dimensions
 * Block instances have a `boundingBox` property, which is currently either
   `solid` or `empty`.
  • Loading branch information
andrewrk committed Jan 10, 2013
1 parent 95338ae commit 0e57f53
Show file tree
Hide file tree
Showing 9 changed files with 662 additions and 206 deletions.
9 changes: 9 additions & 0 deletions doc/history.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 0.0.6

* add a physics engine which understands gravity
* add jumper example, jumps whenever you chat
* fix `game` event to fire correctly
* add `respawn` event which fires when you die or change dimensions
* Block instances have a `boundingBox` property, which is currently either
`solid` or `empty`.

## 0.0.5

* unload chunks when changing dimensions
Expand Down
7 changes: 2 additions & 5 deletions examples/chatterbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ bot.on('kicked', function(reason) {
console.log("I got kicked for", reason, "lol");
});
bot.on('spawn', function() {
bot.chat("I have spawned");
console.log("I have spawned");
console.log("game", bot.game);
});
bot.on('death', function() {
Expand Down Expand Up @@ -73,11 +73,8 @@ bot.on('nonSpokenChat', function(message) {
bot.on('spawnReset', function(message) {
console.log("oh noez!! my bed is broken.");
});
var map = {};
bot.on('entitySwingArm', function(entity) {
map[entity.id] = map[entity.id] || 0;
map[entity.id] += 1;
bot.chat(entity.username + ", you've swung your arm " + map[entity.id] + "times.");
//console.log(entity.username + ", you've swung your arm " + map[entity.id] + "times.");
});
bot.on('entityHurt', function(entity) {
if (entity.type === 'mob') {
Expand Down
8 changes: 8 additions & 0 deletions examples/jumper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var mineflayer = require('../');
var bot = mineflayer.createBot({
username: "jumper",
});
bot.on('chat', function(username, message) {
bot.setControlState('jump', true);
bot.setControlState('jump', false);
});
2 changes: 2 additions & 0 deletions lib/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ function Block(type, biomeId) {
this.name = blockEnum.name;
this.hardness = blockEnum.hardness;
this.displayName = blockEnum.displayName;
this.boundingBox = blockEnum.boundingBox;
} else {
this.name = "";
this.displayName = "";
this.hardness = 0;
this.boundingBox = "empty"
}
}

Loading

0 comments on commit 0e57f53

Please sign in to comment.