Death
This commit is contained in:
@@ -155,6 +155,7 @@ interface EntityRef {
|
||||
teleport(x: number, y: number, z: number): void;
|
||||
push(x: number, y: number, z: number): void; // adds to its velocity
|
||||
remove(): void;
|
||||
kill(cause?: string): void; // players and mobs die, anything else is removed
|
||||
get_item(): ItemStack | undefined; // for an item lying around, a copy
|
||||
set_item(item: ItemStack | undefined): void; // for an item lying around, undefined takes it away
|
||||
}
|
||||
@@ -163,6 +164,10 @@ interface EntityRef {
|
||||
Once an entity is removed, by a script or anything else, it stays removed, and teleporting it does nothing. Check
|
||||
`removed` before relying on one you kept from earlier.
|
||||
|
||||
`kill` is like NeoForge's `Entity.kill`: a player or a mob dies even when it's invulnerable, the way falling out of the
|
||||
world hurts it, and `cause` goes to `entity_damage` and the death message like [`damage`](players.md)'s does. Mods'
|
||||
`before.entity_damage` can still cancel it. Anything that can't die, like an item lying around, is removed instead.
|
||||
|
||||
`push` adds to how fast it's moving, like Minecraft's `Entity.push`: a fan blowing it along does it every tick. Players
|
||||
have a `push` too, see [Players](players.md#pushing).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user