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?
readonlyoptionalattachLead?: (holder,target) =>boolean
Defined in: packages/prismarine/src/item/actorPort.ts:95
Attaches a live holder to a leashable data-driven entity.
Parameters
holder
target
Returns
boolean
canDyeEntity?
readonlyoptionalcanDyeEntity?: (target,color) =>boolean
Defined in: packages/prismarine/src/item/actorPort.ts:108
Whether a data-driven entity accepts the requested dye.
Parameters
target
color
string
Returns
boolean
canNameEntity?
readonlyoptionalcanNameEntity?: (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
Returns
boolean
dyeEntity?
readonlyoptionaldyeEntity?: (target,color) =>boolean
Defined in: packages/prismarine/src/item/actorPort.ts:110
Applies a dye to a data-driven entity.
Parameters
target
color
string
Returns
boolean
entities
readonlyentities: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?
readonlyoptionalinteractWithEntity?: (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
player
itemIdentifier
string
heldItem
Returns
launchProjectile?
readonlyoptionallaunchProjectile?: (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
shooter
Returns
boolean
level
readonlylevel:ContentLevelFacts
Defined in: packages/prismarine/src/item/actorPort.ts:89
The clock, which is what an item cooldown is measured against.
levelName?
readonlyoptionallevelName?: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?
readonlyoptionalnameEntity?: (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
name
string
Returns
boolean
world
readonlyworld: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
readonlyattributes:object
Defined in: packages/prismarine/src/advancement/subject.ts:33
getValue()
getValue(
id):number
Parameters
id
string
Returns
number
Inherited from
AdvancementPlayer.attributes
gamemode
readonlygamemode: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
Inherited from
AdvancementPlayer.getEquipment
getExperience()
getExperience():
ExperienceHolder
Defined in: packages/prismarine/src/advancement/subject.ts:41
Where an experience reward goes.
Returns
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
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
Inherited from
AdvancementPlayer.getServer
getStatusEffects()?
optionalgetStatusEffects(): readonlyobject[]
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
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()?
optionalisOnFire():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
Inherited from
AdvancementPlayer.keyed
setPlayerPosition()
setPlayerPosition(
options):Promise<void>
Defined in: packages/prismarine/src/item/actorPort.ts:70
Parameters
options
position
type?
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()?
optionalboostMount(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
item
string
Returns
boolean
Inherited from
canDyeEntity()?
optionalcanDyeEntity(target,color):boolean
Defined in: packages/prismarine/src/item/actorPort.ts:128
Whether a live data-driven entity accepts the requested dye.
Parameters
target
color
string
Returns
boolean
Overrides
canNameEntity()?
optionalcanNameEntity(target):boolean
Defined in: packages/prismarine/src/item/actorPort.ts:126
Whether a live data-driven entity accepts a name tag.
Parameters
target
Returns
boolean
Overrides
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
target
ItemSource | undefined
body
() => T
Returns
T
entityFits()?
optionalentityFits(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
Returns
boolean
Inherited from
eyesInEntity()?
optionaleyesInEntity(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
Returns
boolean
Inherited from
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
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
Returns
BlockPosition | undefined
Overrides
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
Returns
void
Inherited from
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
Returns
Inherited from
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
takeAmmo()?
optionaltakeAmmo(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
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
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
Returns
ItemSource | undefined
Inherited from
viewHit()?
optionalviewHit(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
fluid
Returns
ViewHit | undefined
Inherited from
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
Returns
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