From 6ea69796fb30b4044d053aa3f373d9d372d8fe8e Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Thu, 19 Nov 2015 23:06:52 +0100 Subject: [PATCH] add a check in block_place : only place a block if you are holding a block, fix #104 --- package.json | 2 +- src/lib/plugins/placeBlock.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8708eaf..eb330a6 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "dependencies": { "babel-runtime": "^5.4.4", "minecraft-data": "0.7.0", - "minecraft-protocol": "^0.16.0", + "minecraft-protocol": "0.16.0", "mkdirp": "0.5.1", "moment": "^2.10.6", "node-dir": "~0.1.9", diff --git a/src/lib/plugins/placeBlock.js b/src/lib/plugins/placeBlock.js index b4da784..603a41e 100644 --- a/src/lib/plugins/placeBlock.js +++ b/src/lib/plugins/placeBlock.js @@ -14,7 +14,7 @@ var materialToSound = { module.exports.player=function(player,serv) { player._client.on("block_place",({direction,heldItem,location} = {}) => { - if(direction==-1 || heldItem.blockId==-1) return; + if(direction==-1 || heldItem.blockId==-1 || !blocks[heldItem.blockId]) return; var referencePosition=new Vec3(location.x,location.y,location.z); var directionVector=directionToVector[direction]; var placedPosition=referencePosition.plus(directionVector);