[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/prismarine](https://jsprismarine.dev/api/@jsprismarine/prismarine/index.md) / entity/data/facts

# entity/data/facts

## Classes

- [EntityFactsLookup](https://jsprismarine.dev/api/@jsprismarine/prismarine/entity/data/facts/classes/EntityFactsLookup.md)

## Interfaces

### EntityBox

Defined in: [packages/prismarine/src/entity/data/facts.ts:31](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L31)

A box centered on the entity's position, extending upwards from its feet.

#### Properties

##### height

> `readonly` **height**: `number`

Defined in: [packages/prismarine/src/entity/data/facts.ts:35](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L35)

Blocks tall, measured up from the feet, which is where an entity's position is.

##### width

> `readonly` **width**: `number`

Defined in: [packages/prismarine/src/entity/data/facts.ts:33](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L33)

Blocks across, on both horizontal axes. The entity reaches half of this either side.

***

### EntityFacts

Defined in: [packages/prismarine/src/entity/data/facts.ts:86](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L86)

Everything the server reads about an entity that is a number or a name.

Read off a type by [EntityFactsLookup](https://jsprismarine.dev/api/@jsprismarine/prismarine/entity/data/facts/classes/EntityFactsLookup.md), which answers for the base
components, and off a live entity by [liveFactsOf](#livefactsof), which answers for
the components active now. Prefer the live reading anywhere an entity is to
hand: the type's figures are a fallback, and for a mob that keeps its stats
in a component group they are zero.

#### Properties

##### attackDamage

> `readonly` **attackDamage**: `number`

Defined in: [packages/prismarine/src/entity/data/facts.ts:94](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L94)

Half-hearts a plain melee hit is worth, from `minecraft:attack`.

##### box

> `readonly` **box**: [`EntityBox`](#entitybox)

Defined in: [packages/prismarine/src/entity/data/facts.ts:90](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L90)

The hitbox, from `minecraft:collision_box`, times the active `minecraft:scale` on a live entity.

##### families

> `readonly` **families**: readonly `string`[]

Defined in: [packages/prismarine/src/entity/data/facts.ts:109](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L109)

The families `minecraft:type_family` declares, which is what `is_family` matches.

##### followRange

> `readonly` **followRange**: `number`

Defined in: [packages/prismarine/src/entity/data/facts.ts:98](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L98)

How far the entity notices things, from `minecraft:follow_range`.

##### health

> `readonly` **health**: `number`

Defined in: [packages/prismarine/src/entity/data/facts.ts:92](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L92)

Maximum health, from `minecraft:health`.

##### identifier

> `readonly` **identifier**: `string`

Defined in: [packages/prismarine/src/entity/data/facts.ts:88](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L88)

The namespaced identifier, such as `minecraft:zombie`.

##### knockbackResistance

> `readonly` **knockbackResistance**: `number`

Defined in: [packages/prismarine/src/entity/data/facts.ts:96](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L96)

From -2 to 1, from `minecraft:knockback_resistance`. Below 0 strengthens a push.

##### lootTable

> `readonly` **lootTable**: `string` \| `undefined`

Defined in: [packages/prismarine/src/entity/data/facts.ts:111](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L111)

The pack-relative loot table path from `minecraft:loot`, or undefined when it declares none.

##### movement

> `readonly` **movement**: `number`

Defined in: [packages/prismarine/src/entity/data/facts.ts:105](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L105)

The `minecraft:movement` value, in Bedrock's own movement units.

The live movement controller uses this as its per-tick path speed. Keep
the raw component value so groups can change it while the entity is alive.

##### spawnable

> `readonly` **spawnable**: `boolean`

Defined in: [packages/prismarine/src/entity/data/facts.ts:113](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L113)

Whether the type may be spawned by a spawn rule.

##### summonable

> `readonly` **summonable**: `boolean`

Defined in: [packages/prismarine/src/entity/data/facts.ts:115](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L115)

Whether `/summon` may create the type.

##### underwaterMovement

> `readonly` **underwaterMovement**: `number`

Defined in: [packages/prismarine/src/entity/data/facts.ts:107](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L107)

The active `minecraft:underwater_movement` value, or its component default when absent.

## Variables

### DEFAULT\_BOX

> `const` **DEFAULT\_BOX**: [`EntityBox`](#entitybox)

Defined in: [packages/prismarine/src/entity/data/facts.ts:47](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L47)

Mojang's documented default for `minecraft:collision_box`.

Used only for a type whose definition declares no collision box, which is
the same case the component's own default covers. A type the server has no
definition for gets no facts at all rather than this.

#### See

https://learn.microsoft.com/en-us/minecraft/creator/reference/content/entityreference/examples/entitycomponents/minecraftcomponent_collision_box

***

### DEFAULT\_FOLLOW\_RANGE

> `const` **DEFAULT\_FOLLOW\_RANGE**: `16` = `16`

Defined in: [packages/prismarine/src/entity/data/facts.ts:55](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L55)

How far an entity notices things when no component declares a follow range: Java's
`Mob.createMobAttributes` base of 16 blocks, which is also the `minecraft:follow_range`
component's own default. A creeper's file declares none, and a range of nought blinded it to
every target, so its `target_nearby_sensor` never primed the fuse.

***

### PLAYER\_BOX

> `const` **PLAYER\_BOX**: [`EntityBox`](#entitybox)

Defined in: [packages/prismarine/src/entity/data/facts.ts:58](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L58)

Java player's collision box, shared by queries that include host-owned players.

## Functions

### boxOf()

> **boxOf**(`registry`, `identifier`): [`EntityBox`](#entitybox)

Defined in: [packages/prismarine/src/entity/data/facts.ts:74](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L74)

The hitbox of one entity type, from its `minecraft:collision_box`.

The server collides bodies against the world with these numbers and the
client is told the same ones, so the hitbox it draws sits where the server
thinks the body is. They used to disagree: every entity announced itself as
the player's `0.6 x 1.8` while the server treated it as a point, so a sheep
walked half way into a wall before anything stopped it.

#### Parameters

##### registry

[`Registry`](https://jsprismarine.dev/api/@jsprismarine/content/classes/Registry.md)\<[`EntityType`](https://jsprismarine.dev/api/@jsprismarine/entities/index.md#entitytype)\>

The entity types of the running content build.

##### identifier

`string`

The namespaced type, as `Entity.getType` reports it.

#### Returns

[`EntityBox`](#entitybox)

The declared box, or [DEFAULT\_BOX](#default-box) for a type nothing describes. A dropped
  stack and an eye of ender declare theirs in the entities package overlay.

***

### javaLootIdOf()

> **javaLootIdOf**(`table`): `string` \| `undefined`

Defined in: [packages/prismarine/src/entity/data/facts.ts:323](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L323)

The Java loot table id for a Bedrock loot table path.

`minecraft:loot` names a pack-relative file, `loot_tables/entities/cow.json`;
`ServerContent.loot` is Java's registry, keyed `minecraft:entities/cow`.
The two layouts line up exactly for the vanilla entity tables, which is why
this is a rewrite rather than a mapping table.

#### Parameters

##### table

`string`

#### Returns

`string` \| `undefined`

The id to roll, or undefined when the path is not a loot table path.

***

### liveFactsOf()

> **liveFactsOf**(`type`, `instance`): [`EntityFacts`](#entityfacts)

Defined in: [packages/prismarine/src/entity/data/facts.ts:311](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/entity/data/facts.ts#L311)

The facts of one live entity, reading through to its components.

#### Parameters

##### type

[`EntityFacts`](#entityfacts)

The type's facts, from [EntityFactsLookup](https://jsprismarine.dev/api/@jsprismarine/prismarine/entity/data/facts/classes/EntityFactsLookup.md), which every
  member falls back to.

##### instance

[`EntityInstance`](https://jsprismarine.dev/api/@jsprismarine/entities/classes/EntityInstance.md)

The entity's component state.

#### Returns

[`EntityFacts`](#entityfacts)
