Move effects out of cubi

This commit is contained in:
2026-11-05 22:37:41 -03:00
parent 0e2d8fdcac
commit 9bc8fd992a
17 changed files with 452 additions and 70 deletions
+6 -2
View File
@@ -15,6 +15,7 @@ import type { Season } from "@/common/worldgen/biomes.ts";
import { type Collisions, type FluidInCell, physics } from "@/common/physics.ts";
import type { EntityData, EntityEvent, EntityInfo } from "@/common/protocol.ts";
import type { ServerPlayer } from "../player.ts";
import type { LivingEntity } from "./living_entity.ts";
// below this, entities have fallen out of the world
export const VOID_Y = -64;
@@ -85,8 +86,11 @@ export interface EntityLevel {
// entities whose feet are within the box around x, y, z
entities_near(x: number, y: number, z: number, radius: number): Entity[];
nearest_player(x: number, y: number, z: number, max_distance: number): ServerPlayer | undefined;
// what ServerPlayer.hurt does: mods get a say, then they're hurt. returns whether they were
hurt_player(player: ServerPlayer, amount: number, source: DamageSource): boolean;
// mods' before.entity_damage, see LivingEntity.hurt: what's left of amount once they had their say, 0 when one
// canceled it
before_hurt(entity: LivingEntity, amount: number, source: DamageSource): number;
// mods' after.entity_damage, it was hurt by amount
after_hurt(entity: LivingEntity, amount: number, source: DamageSource): void;
spawn_item(x: number, y: number, z: number, stack: ItemStack, pickup_delay?: number): Entity;
// an item on the ground was picked up whole by who, clients see it fly to them. it's gone after
take_item(item: Entity, by: string): void;