Merge pull request #358 from bitknox/master

Fixed #353 - Crash Helditem
This commit is contained in:
Romain Beaumont 2019-01-27 17:19:00 +01:00 committed by GitHub
commit 1b519708bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View file

@ -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]

View file

@ -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)