Merge pull request #237 from FlyingPony/master

Inventory related stuff for #236
This commit is contained in:
Romain Beaumont 2016-04-17 00:26:35 +02:00
commit fffccdc127
2 changed files with 12 additions and 1 deletions

View file

@ -67,7 +67,15 @@ module.exports.player = function(player,serv)
if(clickInfo.mouseButton == 0){
// Drop one item at slot
// Inventory handles removing one
return;
const heldItem = player.inventory.slots[36+player.heldItemSlot];
serv.spawnObject(2, player.world, player.position, {
velocity: new Vec3(0, 0, 0),
itemId: heldItem.type,
itemDamage: heldItem.metadata,
pickupTime: 500,
deathTime: 60 * 5 * 100
});
}else{
// Drop full stack at slot
// Inventory handles removing the whole stack

View file

@ -33,6 +33,9 @@ module.exports.player=function(player,serv)
pitch: 0.8
});
}
player.inventory.slots[36+player.heldItemSlot]--;
if(heldItem.blockId!=323){
player.changeBlock(position, id, damage);
}else if(direction==1){