Skip to content

API reference / @jsprismarine/prismarine / entity/data/facts

entity/data/facts ​

Classes ​

Interfaces ​

EntityBox ​

Defined in: packages/prismarine/src/entity/data/facts.ts:31

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

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

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

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

Read off a type by EntityFactsLookup, which answers for the base components, and off a live entity by 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

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

box ​

readonly box: EntityBox

Defined in: packages/prismarine/src/entity/data/facts.ts:90

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

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

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

health ​

readonly health: number

Defined in: packages/prismarine/src/entity/data/facts.ts:92

Maximum health, from minecraft:health.

identifier ​

readonly identifier: string

Defined in: packages/prismarine/src/entity/data/facts.ts:88

The namespaced identifier, such as minecraft:zombie.

knockbackResistance ​

readonly knockbackResistance: number

Defined in: packages/prismarine/src/entity/data/facts.ts:96

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

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

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

Whether the type may be spawned by a spawn rule.

summonable ​

readonly summonable: boolean

Defined in: packages/prismarine/src/entity/data/facts.ts:115

Whether /summon may create the type.

underwaterMovement ​

readonly underwaterMovement: number

Defined in: packages/prismarine/src/entity/data/facts.ts:107

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

Variables ​

DEFAULT_BOX ​

const DEFAULT_BOX: EntityBox

Defined in: packages/prismarine/src/entity/data/facts.ts:47

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

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

Defined in: packages/prismarine/src/entity/data/facts.ts:58

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

Functions ​

boxOf() ​

boxOf(registry, identifier): EntityBox

Defined in: packages/prismarine/src/entity/data/facts.ts:74

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<EntityType>

The entity types of the running content build.

identifier ​

string

The namespaced type, as Entity.getType reports it.

Returns ​

EntityBox

The declared box, or 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

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

Defined in: packages/prismarine/src/entity/data/facts.ts:311

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

Parameters ​

type ​

EntityFacts

The type's facts, from EntityFactsLookup, which every member falls back to.

instance ​

EntityInstance

The entity's component state.

Returns ​

EntityFacts