Skip to content

Commit

Permalink
Update entities.js
Browse files Browse the repository at this point in the history
  • Loading branch information
aesthetic0001 authored Dec 22, 2023
1 parent 759372c commit 066e104
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/plugins/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,18 @@ function inject (bot) {
entity.heldItem = entity.equipment[0] // Update held item like prismarine-entity does upon equipment updates
}

if (eventName === 'entityDead' && entity.passengers) {
entity.passengers.forEach((passengerId) => {
const passengerEntity = fetchEntity(passengerId)
if (!passengerEntity) return
passengerEntity.vehicle = null
})
if (eventName === 'entityDead') {
if (entity.passengers) {
entity.passengers.forEach((passengerId) => {
const passengerEntity = fetchEntity(passengerId)
if (!passengerEntity) return
passengerEntity.vehicle = null
})
}
}

if (eventName) bot.emit(eventName, entity)
if (eventName === 'entityDead') delete bot.entities[packet.entityId]
})

bot._client.on('attach_entity', (packet) => {
Expand Down

0 comments on commit 066e104

Please sign in to comment.