Move effects out of cubi
This commit is contained in:
@@ -15,6 +15,7 @@ import type { ServerWorld } from "../world.ts";
|
||||
import type { DamageSource, Entity, EntityLevel, SavedEntity } from "./entity.ts";
|
||||
import { load_entity } from "./entity_types.ts";
|
||||
import { ItemEntity } from "./item_entity.ts";
|
||||
import type { LivingEntity } from "./living_entity.ts";
|
||||
|
||||
// everything the entities need from the game server
|
||||
export interface EntityHost {
|
||||
@@ -22,7 +23,8 @@ export interface EntityHost {
|
||||
readonly current_tick: number;
|
||||
players(): ServerPlayer[];
|
||||
send(player: ServerPlayer, message: ServerMessage): void;
|
||||
hurt_player(player: ServerPlayer, amount: number, source: DamageSource): boolean;
|
||||
before_hurt(entity: LivingEntity, amount: number, source: DamageSource): number;
|
||||
after_hurt(entity: LivingEntity, amount: number, source: DamageSource): void;
|
||||
on_entity_death?(entity: Entity, source: DamageSource): void;
|
||||
// what it drops when it dies, from its loot table
|
||||
entity_loot?(entity: Entity, source: DamageSource): ItemStack[];
|
||||
@@ -136,8 +138,12 @@ export class EntityManager implements EntityLevel {
|
||||
return nearest;
|
||||
}
|
||||
|
||||
hurt_player(player: ServerPlayer, amount: number, source: DamageSource) {
|
||||
return this.#host.hurt_player(player, amount, source);
|
||||
before_hurt(entity: LivingEntity, amount: number, source: DamageSource) {
|
||||
return this.#host.before_hurt(entity, amount, source);
|
||||
}
|
||||
|
||||
after_hurt(entity: LivingEntity, amount: number, source: DamageSource) {
|
||||
this.#host.after_hurt(entity, amount, source);
|
||||
}
|
||||
|
||||
spawn_item(x: number, y: number, z: number, stack: ItemStack, pickup_delay = 0): ItemEntity {
|
||||
|
||||
Reference in New Issue
Block a user