Skip to content

Commit 15cfeb4

Browse files
authored
Fix for a possible error in lib/plugins/entities.js file (#3254)
* Update entities.js Adding if statement around entity.type = entityData.type || 'object' to fix "TypeError: Cannot read properties of undefined (reading 'type')" * Update entities.js * Update entities.js * Update entities.js
1 parent 931a418 commit 15cfeb4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/plugins/entities.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ function inject (bot) {
176176
entityData = entitiesArray.find(entity => entity.internalId === type)
177177
}
178178
if (entityData) {
179+
entity.type = entityData.type || 'object'
179180
entity.displayName = entityData.displayName
180181
entity.entityType = entityData.id
181182
entity.name = entityData.name
@@ -196,8 +197,6 @@ function inject (bot) {
196197
bot._client.on('spawn_entity', (packet) => {
197198
const entity = fetchEntity(packet.entityId)
198199
const entityData = bot.registry.entities[packet.type]
199-
200-
entity.type = entityData.type || 'object'
201200
setEntityData(entity, packet.type, entityData)
202201

203202
if (bot.supportFeature('fixedPointPosition')) {

0 commit comments

Comments
 (0)