import { world, DimensionTypes } from '@minecraft/server'

export function getAllEntities(type) {
    const dimensions = DimensionTypes.getAll()
    let entities = []

    for (let dimension of dimensions) {
        world.getDimension(dimension.typeId).getEntities(
            {
                type: type
            }
        ).forEach(e => {
            entities.push(e)
        })
    }

    return entities
}