Skip to content

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

entity/data/hangingEntities ​

Classes ​

Interfaces ​

HangingHost ​

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:139

What a hanging entity needs of the runtime.

Methods ​

drop() ​

drop(at, identifier): void

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:150

Parameters ​
at ​

EntityPosition

identifier ​

string

Returns ​

void

isFence() ​

isFence(at): boolean

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:147

Whether a block is one of Java's minecraft:fences.

Parameters ​
at ​

EntityPosition

Returns ​

boolean

isOpen() ​

isOpen(at): boolean

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:149

Whether nothing solid fills a block, so a painting's face can hang in it.

Parameters ​
at ​

EntityPosition

Returns ​

boolean

isSolid() ​

isSolid(at): boolean

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:145

Whether a block is solid, Java's BlockState.isSolid.

Parameters ​
at ​

EntityPosition

Returns ​

boolean

Java See ​

BlockBehaviour$BlockStateBase.isSolid

playSound() ​

playSound(at, sound): void

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:151

Parameters ​
at ​

EntityPosition

sound ​

string

Returns ​

void

randomInt() ​

randomInt(bound): number

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:154

Java's random.nextInt(bound).

Parameters ​
bound ​

number

Returns ​

number

remove() ​

remove(id, reason): void

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:152

Parameters ​
id ​

number

reason ​

string

Returns ​

void


HangingTuning ​

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:99

The numbers of jsprismarine:hanging.

Properties ​

breakSound ​

readonly breakSound: string | undefined

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

The sound it makes when it breaks, if any.

checkInterval ​

readonly checkInterval: number

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:103

How many ticks pass between survival checks; Java's checkInterval checks on the tick after 100.

drop ​

readonly drop: string | undefined

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:105

The item it drops when it breaks, if any.

support ​

readonly support: "fence" | "wall"

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:101

What holds it up: a solid wall behind it, or a fence in its own block.


PaintingSight ​

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:60

What a client is shown of a painting, AddPaintingPacket's fields.

Properties ​

direction ​

readonly direction: number

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:64

The way it faces, Java's 2D data value: south 0, west 1, north 2, east 3.

motif ​

readonly motif: string

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:66

The name the client draws the picture by.

position ​

readonly position: EntityPosition

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:62

The center of the painting's face, where Java's painting stands.

Type Aliases ​

HangingFacing ​

HangingFacing = typeof FACINGS[number]

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:32

One of FACINGS.

Variables ​

FACINGS ​

const FACINGS: readonly ["south", "west", "north", "east"]

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:29

The four ways a hanging entity can face, Java's horizontal Directions in 2D-data order.


HANGING_COMPONENT ​

const HANGING_COMPONENT: "jsprismarine:hanging" = 'jsprismarine:hanging'

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:26

The host component that makes a data entity hang, and holds its numbers.


HANGING_STATE_FIELD ​

const HANGING_STATE_FIELD: string

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:49

The logged field a hanging entity's state is written as, which holds its facing.


hangingState ​

const hangingState: ComponentStateKey<ComponentStateShape<{ age: (value) => value is number; facing: (value) => value is number; }>>

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:43

One hanging entity's state: the ticks it has hung, and the index of its facing in FACINGS, or -1.

Functions ​

hangingFacingOf() ​

hangingFacingOf(hanging): "south" | "west" | "north" | "east" | undefined

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:56

The way a hanging entity faces, for a reader of the change log.

Parameters ​

hanging ​

unknown

The logged hanging state.

Returns ​

"south" | "west" | "north" | "east" | undefined

The facing, or undefined for an entity that has none, such as a leash knot.


hangingTuningOf() ​

hangingTuningOf(entity): HangingTuning

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:114

The numbers a hanging entity's definition declares.

Parameters ​

entity ​

DataEntity

Returns ​

HangingTuning

Throws ​

When the component leaves its support or interval out, which fails the update that asked.


isHangingEntity() ​

isHangingEntity(entity): boolean

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:136

Whether a data entity hangs, by this system's rules.

Parameters ​

entity ​

DataEntity

Returns ​

boolean


paintingSightOf() ​

paintingSightOf(at, picture, hanging): PaintingSight | undefined

Defined in: packages/prismarine/src/entity/data/hangingEntities.ts:81

A painting as a client is shown it, for a reader of the change log.

Java's Painting.calculateBoundingBox centers a face of even width half a block along the facing's counter-clockwise neighbor, and one of even height half a block up, from the block the painting hangs in.

Parameters ​

at ​

EntityPosition

Where the painting stands, which HangingEntities.place put on its block.

picture ​

unknown

The logged painting state.

hanging ​

unknown

The logged hanging state.

Returns ​

PaintingSight | undefined

The sight, or undefined for a painting whose picture or facing is not logged.

Java Source ​

Painting.calculateBoundingBox