API reference / @jsprismarine/prismarine / item/contentAdapter
item/contentAdapter
Interfaces
ContentItemGroupOptions
Defined in: packages/prismarine/src/item/contentAdapter.ts:152
What createContentItemGroup is built over.
Properties
actors
readonlyactors:ItemActorPort
Defined in: packages/prismarine/src/item/contentAdapter.ts:161
The entity-facing half of the union, plus the two queries about the user.
blocks
readonlyblocks:ContentBlockGroup
Defined in: packages/prismarine/src/item/contentAdapter.ts:154
The block group this subsystem also owns, which the four block variants go through.
content
readonlycontent:ContentLookup
Defined in: packages/prismarine/src/item/contentAdapter.ts:163
The built content, read at call time; see ContentLookup.
effects
readonlyeffects:ContentEffectSink
Defined in: packages/prismarine/src/item/contentAdapter.ts:156
entities
readonlyentities:ContentEntityAccess
Defined in: packages/prismarine/src/item/contentAdapter.ts:155
level
readonlylevel:ContentLevelFacts
Defined in: packages/prismarine/src/item/contentAdapter.ts:157
levelName?
readonlyoptionallevelName?:string
Defined in: packages/prismarine/src/item/contentAdapter.ts:159
The name of the level this group covers, which the block hooks carry; left out for the default level.
placeEndCrystal?
readonlyoptionalplaceEndCrystal?: (base) =>boolean
Defined in: packages/prismarine/src/item/contentAdapter.ts:165
Places an end crystal after the host validates its support and spawn volume.
Parameters
base
Returns
boolean
potions?
readonlyoptionalpotions?:PotionEffects
Defined in: packages/prismarine/src/item/contentAdapter.ts:169
tieLeashes?
readonlyoptionaltieLeashes?: (source,fence) =>boolean
Defined in: packages/prismarine/src/item/contentAdapter.ts:167
Ties a player's leashed mobs to a fence, through the entity runtime.
Parameters
source
fence
Returns
boolean
transformers?
readonlyoptionaltransformers?:BlockTransformers
Defined in: packages/prismarine/src/item/contentAdapter.ts:168
ItemActorPort
Defined in: packages/prismarine/src/item/contentAdapter.ts:93
What only the subsystems holding the entity index and the player sessions can answer or do.
Three required members rather than one per action: the half of the union this port owns stays a union, so adding an effect is a new case in its switch. Optional capability queries let a behavior check whether an entity accepts a name tag or dye, or whether the port performs an action kind at all, before it consumes the item.
Extended by
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
canDyeEntity()?
optionalcanDyeEntity(target,color):boolean
Defined in: packages/prismarine/src/item/contentAdapter.ts:111
Whether a target entity accepts this dye, when the host can answer.
Parameters
target
color
string
Returns
boolean
canNameEntity()?
optionalcanNameEntity(target):boolean
Defined in: packages/prismarine/src/item/contentAdapter.ts:109
Whether a target entity accepts a name tag, when the host can answer.
Parameters
target
Returns
boolean
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
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
locate()?
optionallocate(destination,origin):BlockPosition|undefined
Defined in: packages/prismarine/src/item/contentAdapter.ts:113
The nearest structure in a structure tag, when the host has a structure search.
Parameters
destination
string
origin
Returns
BlockPosition | undefined
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
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
supports()?
optionalsupports(action):boolean
Defined in: packages/prismarine/src/item/contentAdapter.ts:121
Whether the port performs an action of this kind, when it can say.
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
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
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
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
Type Aliases
ActorItemAction
ActorItemAction =
Exclude<ItemWorldAction,WorldItemAction>
Defined in: packages/prismarine/src/item/contentAdapter.ts:81
An action whose subject is an entity, an inventory or a screen.
Derived rather than listed, so a new variant of ItemWorldAction joins this half by default and the exhaustive switch in createContentItemGroup is what forces a decision about it.
BlockTransformers
BlockTransformers = (
transformer,block,face) =>BlockPlacement|undefined
Defined in: packages/prismarine/src/item/contentAdapter.ts:136
What a minecraft:block_transformer turns a block into.
Injected rather than computed here, because the table is Java's own block_transformer registry and src/item/blockTransformers.ts resolves it over the built content; the server wires that resolver in. The default answers nothing for every block, which is the interface's own "this transformer has no rule here", so an axe declines to strip rather than stripping a log into something guessed.
Parameters
transformer
string
block
ContentBlock & object
face
Returns
BlockPlacement | undefined
PotionEffects
PotionEffects = (
potion) => readonlyEffectApplication[]
Defined in: packages/prismarine/src/item/contentAdapter.ts:149
The effects one potion identifier applies.
Injected for the same reason: Java keeps its 47 potions in code, in Potions, so no pack publishes them and the server has to answer. The default is the empty list, which is also what a water bottle gives.
Parameters
potion
string
Returns
readonly EffectApplication[]
WorldItemAction
WorldItemAction =
ItemWorldActionOf<typeofWORLD_ITEM_ACTION_KINDS[number]>
Defined in: packages/prismarine/src/item/contentAdapter.ts:72
An action this subsystem performs itself, over the block, entity and effect groups.
Variables
WORLD_ITEM_ACTION_KINDS
constWORLD_ITEM_ACTION_KINDS: readonly ["place-block","break-block","ignite","play-sound","play-block-sound","spawn-entity"]
Defined in: packages/prismarine/src/item/contentAdapter.ts:59
The kinds whose subject is a place in the world rather than an entity.
Functions
createContentItemGroup()
createContentItemGroup(
options):ContentItemAccess
Defined in: packages/prismarine/src/item/contentAdapter.ts:185
Builds the items group over the block, entity and effect groups of one dimension.
Parameters
options
Returns
Throws
Nothing here throws on its own; a member the actor port has not supplied throws from the port.