Skip to content

API reference / @jsprismarine/prismarine / item/actorPort

item/actorPort ​

Interfaces ​

ItemActorPortOptions ​

Defined in: packages/prismarine/src/item/actorPort.ts:83

What createItemActorPort is built over.

Properties ​

attachLead? ​

readonly optional attachLead?: (holder, target) => boolean

Defined in: packages/prismarine/src/item/actorPort.ts:95

Attaches a live holder to a leashable data-driven entity.

Parameters ​
holder ​

ItemSource

target ​

ItemSource

Returns ​

boolean

canDyeEntity? ​

readonly optional canDyeEntity?: (target, color) => boolean

Defined in: packages/prismarine/src/item/actorPort.ts:108

Whether a data-driven entity accepts the requested dye.

Parameters ​
target ​

StoreActor

color ​

string

Returns ​

boolean

canNameEntity? ​

readonly optional canNameEntity?: (target) => boolean

Defined in: packages/prismarine/src/item/actorPort.ts:97

Whether the target is a data-driven entity that accepts a name tag.

Parameters ​
target ​

StoreActor

Returns ​

boolean

dyeEntity? ​

readonly optional dyeEntity?: (target, color) => boolean

Defined in: packages/prismarine/src/item/actorPort.ts:110

Applies a dye to a data-driven entity.

Parameters ​
target ​

StoreActor

color ​

string

Returns ​

boolean

entities ​

readonly entities: ContentEntityAccess

Defined in: packages/prismarine/src/item/actorPort.ts:87

The entities group, which is how a stack that does not fit reaches the ground.

interactWithEntity? ​

readonly optional interactWithEntity?: (target, player, itemIdentifier, heldItem) => EntityItemInteraction

Defined in: packages/prismarine/src/item/actorPort.ts:99

Applies a player's held item to a data-driven entity, when its components accept it.

Parameters ​
target ​

StoreActor

player ​

StoreActor

itemIdentifier ​

string

heldItem ​

ItemDrop

Returns ​

EntityItemInteraction

launchProjectile? ​

readonly optional launchProjectile?: (action, shooter) => boolean

Defined in: packages/prismarine/src/item/actorPort.ts:93

Starts a projectile in the live entity runtime, or is absent when that runtime is unavailable.

Parameters ​
action ​

LaunchProjectileAction

shooter ​

StoreActor

Returns ​

boolean

level ​

readonly level: ContentLevelFacts

Defined in: packages/prismarine/src/item/actorPort.ts:89

The clock, which is what an item cooldown is measured against.

levelName? ​

readonly optional levelName?: string

Defined in: packages/prismarine/src/item/actorPort.ts:91

The name of the level the world belongs to, or undefined for the default level.

nameEntity? ​

readonly optional nameEntity?: (target, name) => boolean

Defined in: packages/prismarine/src/item/actorPort.ts:106

Names a data-driven entity after its active minecraft:nameable component accepts it.

Parameters ​
target ​

StoreActor

name ​

string

Returns ​

boolean

world ​

readonly world: LiveWorld

Defined in: packages/prismarine/src/item/actorPort.ts:85

The live world, read at call time, because the content is built before any world loads.


ItemPlayer ​

Defined in: packages/prismarine/src/item/actorPort.ts:63

What the port reads and changes of a player an action names: the inventory a stack goes into or comes out of, the hunger a meal feeds, and the state a behavior's conditions read.

Extends ​

  • AdvancementPlayer

Properties ​

attributes ​

readonly attributes: object

Defined in: packages/prismarine/src/advancement/subject.ts:33

getValue() ​

getValue(id): number

Parameters ​
id ​

string

Returns ​

number

Inherited from ​

AdvancementPlayer.attributes

gamemode ​

readonly gamemode: number

Defined in: packages/prismarine/src/advancement/subject.ts:34

Inherited from ​

AdvancementPlayer.gamemode

Methods ​

addFood() ​

addFood(food, saturation?): void

Defined in: packages/prismarine/src/item/actorPort.ts:65

Parameters ​
food ​

number

saturation? ​

number

Returns ​

void

getEquipment() ​

getEquipment(): ViewableEquipment

Defined in: packages/prismarine/src/advancement/subject.ts:31

Returns ​

ViewableEquipment

Inherited from ​

AdvancementPlayer.getEquipment

getExperience() ​

getExperience(): ExperienceHolder

Defined in: packages/prismarine/src/advancement/subject.ts:41

Where an experience reward goes.

Returns ​

ExperienceHolder

Inherited from ​

AdvancementPlayer.getExperience

getFallDistance() ​

getFallDistance(): number

Defined in: packages/prismarine/src/item/actorPort.ts:69

Returns ​

number

getFood() ​

getFood(): number

Defined in: packages/prismarine/src/advancement/subject.ts:36

Returns ​

number

Inherited from ​

AdvancementPlayer.getFood

getInventory() ​

getInventory(): HumanInventory

Defined in: packages/prismarine/src/item/actorPort.ts:64

Returns ​

HumanInventory

Overrides ​

AdvancementPlayer.getInventory

getName() ​

getName(): string

Defined in: packages/prismarine/src/advancement/raise.ts:45

Returns ​

string

Inherited from ​

AdvancementPlayer.getName

getPosition() ​

getPosition(): object

Defined in: packages/prismarine/src/entity/predicateView.ts:33

Returns ​

object

getX() ​

getX(): number

Returns ​

number

getY() ​

getY(): number

Returns ​

number

getZ() ​

getZ(): number

Returns ​

number

Inherited from ​

AdvancementPlayer.getPosition

getSaturation() ​

getSaturation(): number

Defined in: packages/prismarine/src/advancement/subject.ts:37

Returns ​

number

Inherited from ​

AdvancementPlayer.getSaturation

getServer() ​

getServer(): Server

Defined in: packages/prismarine/src/advancement/triggers.ts:67

Returns ​

Server

Inherited from ​

AdvancementPlayer.getServer

getStatusEffects()? ​

optional getStatusEffects(): readonly object[]

Defined in: packages/prismarine/src/entity/predicateView.ts:36

Returns ​

readonly object[]

Inherited from ​

AdvancementPlayer.getStatusEffects

getType() ​

getType(): string

Defined in: packages/prismarine/src/entity/predicateView.ts:32

Returns ​

string

Inherited from ​

AdvancementPlayer.getType

getWorld() ​

getWorld(): AnnouncingWorld

Defined in: packages/prismarine/src/advancement/raise.ts:46

Returns ​

AnnouncingWorld

Inherited from ​

AdvancementPlayer.getWorld

isFlying() ​

isFlying(): boolean

Defined in: packages/prismarine/src/advancement/subject.ts:39

Returns ​

boolean

Inherited from ​

AdvancementPlayer.isFlying

isGliding() ​

isGliding(): boolean

Defined in: packages/prismarine/src/item/actorPort.ts:68

Whether the player glides on an elytra, which is what a firework rocket boosts.

Returns ​

boolean

isOnFire()? ​

optional isOnFire(): boolean

Defined in: packages/prismarine/src/entity/predicateView.ts:34

Returns ​

boolean

Inherited from ​

AdvancementPlayer.isOnFire

isOnGround() ​

isOnGround(): boolean

Defined in: packages/prismarine/src/item/actorPort.ts:66

Returns ​

boolean

Overrides ​

AdvancementPlayer.isOnGround

isSneaking() ​

isSneaking(): boolean

Defined in: packages/prismarine/src/advancement/subject.ts:38

Returns ​

boolean

Inherited from ​

AdvancementPlayer.isSneaking

isSprinting() ​

isSprinting(): boolean

Defined in: packages/prismarine/src/advancement/subject.ts:35

Returns ​

boolean

Inherited from ​

AdvancementPlayer.isSprinting

keyed() ​

keyed(): KeyedPlayer

Defined in: packages/prismarine/src/keyedPlayer.ts:24

Returns ​

KeyedPlayer

Inherited from ​

AdvancementPlayer.keyed

setPlayerPosition() ​

setPlayerPosition(options): Promise<void>

Defined in: packages/prismarine/src/item/actorPort.ts:70

Parameters ​
options ​
position ​

Vector3

type? ​

MoveMode

Returns ​

Promise<void>


ServerItemActorPort ​

Defined in: packages/prismarine/src/item/actorPort.ts:120

The port, plus the interaction context and data-driven entity capabilities.

targetOf answers a question about an interaction that is happening now, so the interaction has to say what it landed on. Scoped to the call rather than stored, so a target cannot outlive the interaction that found it and be read by the next one.

Extends ​

Methods ​

boostMount()? ​

optional boostMount(source, item): boolean

Defined in: packages/prismarine/src/item/contentAdapter.ts:107

Boosts the mount the user steers with the item, and says whether it did, when the host has mounts.

Parameters ​
source ​

ItemSource

item ​

string

Returns ​

boolean

Inherited from ​

ItemActorPort.boostMount

canDyeEntity()? ​

optional canDyeEntity(target, color): boolean

Defined in: packages/prismarine/src/item/actorPort.ts:128

Whether a live data-driven entity accepts the requested dye.

Parameters ​
target ​

ItemSource

color ​

string

Returns ​

boolean

Overrides ​

ItemActorPort.canDyeEntity

canNameEntity()? ​

optional canNameEntity(target): boolean

Defined in: packages/prismarine/src/item/actorPort.ts:126

Whether a live data-driven entity accepts a name tag.

Parameters ​
target ​

ItemSource

Returns ​

boolean

Overrides ​

ItemActorPort.canNameEntity

duringInteraction() ​

duringInteraction<T>(source, target, body): T

Defined in: packages/prismarine/src/item/actorPort.ts:122

Runs a body with one interaction's target recorded, so ItemActorPort.targetOf answers.

Type Parameters ​
T ​

T

Parameters ​
source ​

ItemSource

target ​

ItemSource | undefined

body ​

() => T

Returns ​

T

entityFits()? ​

optional entityFits(identifier, position): boolean

Defined in: packages/prismarine/src/item/contentAdapter.ts:119

Whether a new entity of a type would stand clear at a position; see WorldActions.entityFits.

Parameters ​
identifier ​

string

position ​

BlockPosition

Returns ​

boolean

Inherited from ​

ItemActorPort.entityFits

eyesInEntity()? ​

optional eyesInEntity(source): boolean

Defined in: packages/prismarine/src/item/contentAdapter.ts:117

Whether the source's eyes are inside an entity it could pick; see WorldActions.eyesInEntity.

Parameters ​
source ​

ItemSource

Returns ​

boolean

Inherited from ​

ItemActorPort.eyesInEntity

interactWithEntity() ​

interactWithEntity(source): boolean

Defined in: packages/prismarine/src/item/actorPort.ts:124

Runs the target entity's data-defined item interaction and consumes or replaces its item.

Parameters ​
source ​

ItemSource

Returns ​

boolean

locate() ​

locate(destination, origin): BlockPosition | undefined

Defined in: packages/prismarine/src/item/actorPort.ts:130

The nearest structure in a structure tag, through the live world's generator.

Parameters ​
destination ​

string

origin ​

BlockPosition

Returns ​

BlockPosition | undefined

Overrides ​

ItemActorPort.locate

perform() ​

perform(action): void

Defined in: packages/prismarine/src/item/contentAdapter.ts:123

Does one thing to an entity, an inventory or a screen.

Parameters ​
action ​

ActorItemAction

Returns ​

void

Inherited from ​

ItemActorPort.perform

stateOf() ​

stateOf(source): SourceState

Defined in: packages/prismarine/src/item/contentAdapter.ts:95

Everything a behavior reads about the entity using the item.

Parameters ​
source ​

ItemSource

Returns ​

SourceState

Inherited from ​

ItemActorPort.stateOf

supports() ​

supports(action): boolean

Defined in: packages/prismarine/src/item/actorPort.ts:132

Whether this server performs an action of the kind, read off the same table perform reports from.

Parameters ​
action ​

"map" | "ignite" | "brush" | "blocking" | "fishing" | "signal" | "place-block" | "break-block" | "spawn-entity" | "launch-firework" | "launch-projectile" | "play-sound" | "play-block-sound" | "apply-effects" | "remove-effects" | "damage-entity" | "feed" | "teleport-randomly" | "grant-experience" | "start-cooldown" | "consume-durability" | "give-item" | "equip" | "name-entity" | "attach-lead" | "dye-entity" | "shear-entity" | "disable-shield" | "open-screen"

Returns ​

boolean

Overrides ​

ItemActorPort.supports

takeAmmo()? ​

optional takeAmmo(source, accepted, keeps, heldOnly?): AmmoStack | undefined

Defined in: packages/prismarine/src/item/contentAdapter.ts:97

Finds and takes the ammo a shot fires; see ItemWorld.takeAmmo.

Parameters ​
source ​

ItemSource

accepted ​

readonly string[]

keeps ​

(identifier) => boolean

heldOnly? ​

readonly string[]

Ammo taken only from a hand, as a crossbow takes a firework rocket.

Returns ​

AmmoStack | undefined

Inherited from ​

ItemActorPort.takeAmmo

targetOf() ​

targetOf(source): ItemSource | undefined

Defined in: packages/prismarine/src/item/contentAdapter.ts:105

The entity an interaction landed on, or undefined when it landed on a block or nothing.

Parameters ​
source ​

ItemSource

Returns ​

ItemSource | undefined

Inherited from ​

ItemActorPort.targetOf

viewHit()? ​

optional viewHit(source, fluid): ViewHit | undefined

Defined in: packages/prismarine/src/item/contentAdapter.ts:115

Where the source's view first meets a block, stopping at the fluids named; see WorldActions.viewHit.

Parameters ​
source ​

ItemSource

fluid ​

FluidClip

Returns ​

ViewHit | undefined

Inherited from ​

ItemActorPort.viewHit

Type Aliases ​

LiveWorld ​

LiveWorld = () => World | undefined

Defined in: packages/prismarine/src/item/actorPort.ts:80

The live world whose entities and players this port acts on.

Returns ​

World | undefined

Functions ​

createItemActorPort() ​

createItemActorPort(options): ServerItemActorPort

Defined in: packages/prismarine/src/item/actorPort.ts:218

Builds the port over one live world.

Parameters ​

options ​

ItemActorPortOptions

Returns ​

ServerItemActorPort


isUnwrittenItemAction() ​

isUnwrittenItemAction(kind): boolean

Defined in: packages/prismarine/src/item/actorPort.ts:166

Whether the server has not written the system an item action needs, such as fishing, so a behavior that asks for it does nothing.

Parameters ​

kind ​

"map" | "ignite" | "brush" | "blocking" | "fishing" | "signal" | "place-block" | "break-block" | "spawn-entity" | "launch-firework" | "launch-projectile" | "play-sound" | "play-block-sound" | "apply-effects" | "remove-effects" | "damage-entity" | "feed" | "teleport-randomly" | "grant-experience" | "start-cooldown" | "consume-durability" | "give-item" | "equip" | "name-entity" | "attach-lead" | "dye-entity" | "shear-entity" | "disable-shield" | "open-screen"

Returns ​

boolean