API reference / @jsprismarine/prismarine / entity/mobLoot
entity/mobLoot
Interfaces
LootEntity
Defined in: packages/prismarine/src/entity/mobLoot.ts:223
The little of an entity the loot predicates read, so an actor satisfies it as it is.
Methods
getPosition()
getPosition():
object
Defined in: packages/prismarine/src/entity/mobLoot.ts:225
Returns
object
getX()
getX():
number
Returns
number
getY()
getY():
number
Returns
number
getZ()
getZ():
number
Returns
number
getType()
getType():
string
Defined in: packages/prismarine/src/entity/mobLoot.ts:224
Returns
string
n()?
optionaln():object
Defined in: packages/prismarine/src/entity/mobLoot.ts:231
The inventory, which only something humanlike has. The optional member is what lets an actor without one - a skeleton, a cactus - satisfy this type.
Returns
object
getItemInHand()
getItemInHand():
object
Returns
object
asPredicateStack()
asPredicateStack():
ItemStack
Returns
LootKill
Defined in: packages/prismarine/src/entity/mobLoot.ts:241
The little of a import('./DamageSource').DamageSource the loot predicates read.
Written structurally rather than against the class so a test can state a kill without building two live entities to have it happen between.
Properties
attacker
readonlyattacker:LootEntity|null
Defined in: packages/prismarine/src/entity/mobLoot.ts:244
Whoever is answerable, which for a fired arrow is the archer.
cause
readonlycause:DamageCause
Defined in: packages/prismarine/src/entity/mobLoot.ts:242
projectile
readonlyprojectile:LootEntity|null
Defined in: packages/prismarine/src/entity/mobLoot.ts:246
What made contact, when that is not the attacker.
MobDropContext
Defined in: packages/prismarine/src/entity/mobLoot.ts:105
What a death knows about itself, beyond the mob that died.
Properties
damage?
readonlyoptionaldamage?:DamageSource
Defined in: packages/prismarine/src/entity/mobLoot.ts:111
How it died and who is answerable. Build one with lootDamageSource.
level?
readonlyoptionallevel?:LevelView
Defined in: packages/prismarine/src/entity/mobLoot.ts:113
The world the clock and location conditions read.
position?
readonlyoptionalposition?:Vec3
Defined in: packages/prismarine/src/entity/mobLoot.ts:107
Where it fell, which origin and the position predicates read.
random?
readonlyoptionalrandom?:RandomSource
Defined in: packages/prismarine/src/entity/mobLoot.ts:115
Replaces the table's own sequenced stream, for a test that wants a scripted draw.
self?
readonlyoptionalself?:MobLootState
Defined in: packages/prismarine/src/entity/mobLoot.ts:109
What this mob is, past its type; see MobLootState.
Type Aliases
MobLootState
MobLootState =
Omit<EntityView,"type"|"position">
Defined in: packages/prismarine/src/entity/mobLoot.ts:102
What the entity predicates read about a mob beyond its type and where it stood: the flags it carries, its data components and its per-type state.
These decide real branches. A sheep's wool is keyed by its minecraft:sheep/color component, a slime drops slime balls only at the smallest size, and a mob that died burning drops its meat cooked. A table rolled without them takes the other branch rather than failing, so the mobs whose drops depend on one have to supply it.
Functions
damageTagsOf()
damageTagsOf(
content,type): readonlystring[]
Defined in: packages/prismarine/src/entity/mobLoot.ts:273
The tags one damage type carries, read off the stack's own tags/damage_type/ files rather than listed here. A turtle struck by lightning and a ghast killed by its own fireball both turn on one.
Parameters
content
type
string
Returns
readonly string[]
lootDamageSource()
lootDamageSource(
content,source):DamageSource|undefined
Defined in: packages/prismarine/src/entity/mobLoot.ts:314
The kill as the damage-source predicates read it.
Parameters
content
The content build, for its damage_type tags.
source
LootKill | null | undefined
What killed the mob, or null when nothing is on record.
Returns
DamageSource | undefined
The source, or undefined for a death with no record, which rolls against UNRECORDED.
mobLootTableOf()
mobLootTableOf(
content,identifier):string|undefined
Defined in: packages/prismarine/src/entity/mobLoot.ts:83
The Java loot table a Bedrock mob dies through.
Parameters
content
identifier
string
Returns
string | undefined
The table id, or undefined for a mob the stack registered no table for, which is a Bedrock-only entity or a stack with no Java half.
rollMobDrops()
rollMobDrops(
content,identifier,context?): readonlyItemDrop[]
Defined in: packages/prismarine/src/entity/mobLoot.ts:137
Rolls what one mob leaves behind.
Parameters
content
identifier
string
The Bedrock entity identifier, as Entity.getType reports it.
context?
MobDropContext = {}
Returns
readonly ItemDrop[]
The stacks that fell, empty for a mob with no table - which is also the right answer for the wolves, cats and villagers Java gives an empty one.