#EntityRemove event get location

1 messages · Page 1 of 1 (latest)

mighty blade
#

I want to get the coordinates of the entity that is about to be removed when world.beforeEvents.entityRemove.subscribe is triggered. I couldn't use entity.location.

world.beforeEvents.entityRemove.subscribe((ev) => {
    const { entity } = ev;
    console.log(entity.location.x, entity.location.z);
});

TypeError: cannot read property 'location' of undefined

mighty blade
#

like world.beforeEvents.removeEntity.subscribe((ev) => { ?

#

Specifically, i want to make it so that armor stands and paintings cannot be destroyed.