diff --git a/src/lib/plugins/placeBlock.js b/src/lib/plugins/placeBlock.js index 691bc85..cac40fc 100644 --- a/src/lib/plugins/placeBlock.js +++ b/src/lib/plugins/placeBlock.js @@ -15,6 +15,7 @@ module.exports.player = function (player, serv, { version }) { player._client.on('block_place', ({ direction, location } = {}) => { const heldItem = player.inventory.slots[36 + player.heldItemSlot] + if (heldItem === undefined) return if (direction === -1 || heldItem.type === -1 || !blocks[heldItem.type]) return const referencePosition = new Vec3(location.x, location.y, location.z) const directionVector = directionToVector[direction] diff --git a/src/lib/plugins/useItem.js b/src/lib/plugins/useItem.js index d327674..bfcdfef 100644 --- a/src/lib/plugins/useItem.js +++ b/src/lib/plugins/useItem.js @@ -5,6 +5,7 @@ module.exports.player = function (player, serv, { version }) { player._client.on('block_place', ({ direction, location } = {}) => { const heldItem = player.inventory.slots[36 + player.heldItemSlot] + if (heldItem === undefined) return if (direction === -1 || heldItem.type === -1 || !items[heldItem.type]) return const item = heldItem const referencePosition = new Vec3(location.x, location.y, location.z)