API reference / @jsprismarine/prismarine / entity/Environment
entity/Environment
Interfaces
FallLanding
Defined in: packages/prismarine/src/entity/Environment.ts:48
How a landing counts a fall: the distance it measures and the share of its damage it deals.
Properties
distance
readonlydistance:number
Defined in: packages/prismarine/src/entity/Environment.ts:49
multiplier
readonlymultiplier:number
Defined in: packages/prismarine/src/entity/Environment.ts:50
Variables
BREATH_TICKS
constBREATH_TICKS:300=300
Defined in: packages/prismarine/src/entity/Environment.ts:197
How long something can hold its breath, in ticks.
Fifteen seconds, the same as a player's. Kept here rather than read from the metadata because a mob has no air bar to show anybody - only the moment it runs out matters.
BURN_TICKS
constBURN_TICKS:160=160
Defined in: packages/prismarine/src/entity/Environment.ts:137
How long something keeps burning after it stops standing in the fire, in ticks.
Vanilla's eight seconds. It is what makes walking through a fire worse than walking past one, and what makes water worth running to.
Java See
BaseFireBlock.fireIgnite
DROWNING_DAMAGE
constDROWNING_DAMAGE:2=2
Defined in: packages/prismarine/src/entity/Environment.ts:188
Half-hearts lost per second once the breath runs out, as in vanilla.
DROWNING_INTERVAL
constDROWNING_INTERVAL:20=20
Defined in: packages/prismarine/src/entity/Environment.ts:189
FALL_GRACE
constFALL_GRACE:3=3
Defined in: packages/prismarine/src/entity/Environment.ts:109
Blocks of falling anything gets for free.
Vanilla's three: a one block step costs nothing, and neither does a jump from a two block ledge. Above that it is one half-heart per further block.
FIRE_BLOCK_DAMAGE
constFIRE_BLOCK_DAMAGE:Readonly<Record<string,number>>
Defined in: packages/prismarine/src/entity/Environment.ts:151
The fire blocks, and the inFire damage each deals every tick something stands in it, which a blow's grace period spaces out: Java's FireBlock and SoulFireBlock pass 1 and 2 to BaseFireBlock.
Java See
BaseFireBlock.entityInside
HAZARD_DAMAGE
constHAZARD_DAMAGE:Readonly<Record<string,number>>
Defined in: packages/prismarine/src/entity/Environment.ts:124
Half-hearts each hazard is worth per HAZARD_INTERVAL.
HAZARD_INTERVAL
constHAZARD_INTERVAL:10=10
Defined in: packages/prismarine/src/entity/Environment.ts:121
How often standing in something harmful hurts, in ticks.
LANDING_BLOCK_OFFSET
constLANDING_BLOCK_OFFSET:0.2=0.2
Defined in: packages/prismarine/src/entity/Environment.ts:73
How far below the feet Java finds the block a body lands on, Entity.getOnPosLegacy.
LAVA_BURN_TICKS
constLAVA_BURN_TICKS:300=300
Defined in: packages/prismarine/src/entity/Environment.ts:143
How long something keeps burning after it leaves lava, in ticks: Java's fifteen seconds.
Java See
Entity.lavaIgnite
ON_FIRE_DAMAGE
constON_FIRE_DAMAGE:1=1
Defined in: packages/prismarine/src/entity/Environment.ts:185
The onFire damage a burning entity takes each ON_FIRE_INTERVAL, in half-hearts.
ON_FIRE_INTERVAL
constON_FIRE_INTERVAL:20=20
Defined in: packages/prismarine/src/entity/Environment.ts:182
How often a burning entity takes onFire damage, in ticks: Java's Entity.baseTick hurts it whenever its fire ticks are a multiple of 20.
Java See
Entity.baseTick
SUFFOCATION_DAMAGE
constSUFFOCATION_DAMAGE:1=1
Defined in: packages/prismarine/src/entity/Environment.ts:169
Half-hearts a tick of suffocation costs, and how often - vanilla charges it every tick.
SUFFOCATION_INTERVAL
constSUFFOCATION_INTERVAL:10=10
Defined in: packages/prismarine/src/entity/Environment.ts:170
VOID_DAMAGE
constVOID_DAMAGE:4=4
Defined in: packages/prismarine/src/entity/Environment.ts:174
VOID_DEPTH
constVOID_DEPTH:64=64
Defined in: packages/prismarine/src/entity/Environment.ts:173
The void: how far below the world's floor is fatal, and what it costs.
VOID_INTERVAL
constVOID_INTERVAL:10=10
Defined in: packages/prismarine/src/entity/Environment.ts:175
Functions
breaksAFall()
breaksAFall(
name,tags):boolean
Defined in: packages/prismarine/src/entity/Environment.ts:100
Whether landing in or on a block costs nothing.
Three groups rather than one list. Any liquid, which is what makes a bucket of water at the bottom of a drop the standard way down. Anything in the #minecraft:climbable block tag read from the server's content tags - ladders, vines, scaffolding, weeping and twisting vines, and cave vines. And FALL_BREAKERS, the blocks Java softens a landing with in code.
Parameters
name
string
The block's state name.
tags
ContentTags | undefined
The server's merged content tags, or undefined when no content is loaded.
Returns
boolean
Whether a fall into it is free.
igniteByContact()
igniteByContact(
fireTicks,inLava,inFire):number
Defined in: packages/prismarine/src/entity/Environment.ts:165
The longer of the burn an entity has left and the one its contact gives it, as Java's Entity.igniteForTicks keeps the longer.
Parameters
fireTicks
number
The burn it has left.
inLava
boolean
Whether it touches lava.
inFire
boolean
Whether it touches a fire block.
Returns
number
How long it burns from now.
Java See
Entity.igniteForTicks
isAllowed()
isAllowed(
world,cause):boolean
Defined in: packages/prismarine/src/entity/Environment.ts:218
Whether the world is set to allow this kind of damage at all.
Parameters
world
Where it is happening.
cause
What kind of damage.
Returns
boolean
true if it should be applied.
isUnderwater()
isUnderwater(
name):boolean
Defined in: packages/prismarine/src/entity/Environment.ts:118
Whether a block is water, still or flowing.
What counts as being underwater. Lava burns rather than drowns, so it answers false for it.
Parameters
name
string
The block's state name.
Returns
boolean
Whether something standing in it would be holding its breath.
landingOn()
landingOn(
content,block,fallen):FallLanding
Defined in: packages/prismarine/src/entity/Environment.ts:62
How landing on a block counts a fall, Java's Block.fallOn for it: a bed takes its fall distance reduction off the fall, half of it, and hay and honey deal a fifth of the damage.
Parameters
content
The server's content, whose block table holds each state's reduction.
block
ContentBlock | undefined
The block the body lands on, the one 0.2 under its feet.
fallen
number
How far the body fell.
Returns
Java Source
Block.fallOn