# EntityStore: mine() method

> The mine() method of the EntityStore interface returns an iterator over the entities of a kind the local player owns, whose writable fields it can set.

The **`mine()`** method of the [`EntityStore`](/docs/client/entity-store) interface returns an iterator over the entities of a kind the local player owns. Their writable fields can be set.

## Syntax

```ts
mine(kind)
```

### Parameters

`kind`
: A kind, the object [`entity()`](/docs/room/entity) returned.

### Return value

An iterator over the kind's entities the local player owns, each an [`OwnedEntity`](/docs/client/owned-entity). It's empty before the client is first ready, and for a kind the player owns none of.

### Exceptions

None.

## Description

The room decides who owns an entity, with [`Entities.setOwner()`](/docs/room/entities/setowner), and a player always sees the entities it owns, whatever the room's interest says. In a room with room code, a client can't take or give up ownership: it asks the room with a message or a call.

Setting a writable field of an owned entity changes the client's copy at once, and the client sends the write to the room. Setting any other field throws a `TypeError`. See [`OwnedEntity`](/docs/client/owned-entity) for when writes are sent and how the room corrects them.

## Examples

### Moving the player's cursors with the pointer

The room gives each player a cursor whose position is writable. The client moves every cursor it owns as the pointer moves.

```ts
// cursors.ts
import { connect, defineSchema, entity } from "@irtio/client";

const Cursor = entity("cursor", { x: "f32", y: "f32", color: "u8" }, { writable: ["x", "y"] });
const schema = defineSchema({ entities: [Cursor] });

const room = await connect("whiteboard", { schema });

addEventListener("pointermove", (e) => {
  for (const cursor of room.entities.mine(Cursor)) {
    cursor.x = e.clientX;
    cursor.y = e.clientY;
  }
});
```

`color` isn't writable, so `cursor.color = 2` is a type error, and throws a `TypeError` if the types are bypassed.

## See also

- [`OwnedEntity`](/docs/client/owned-entity)
- [`EntityStore.ownerOf()`](/docs/client/entity-store/ownerof)
- [`Entities.ownedBy()`](/docs/room/entities/ownedby), the room's side
- [Ownership](/docs/room/guides/ownership#on-the-client)
