Scrap !!
This commit is contained in:
@@ -92,6 +92,7 @@ import { Mob } from "./entity/mob.ts";
|
||||
import { BUILTIN_GOALS, mob_goals } from "./mob_behaviors.ts";
|
||||
import { create_entity } from "./entity/entity_types.ts";
|
||||
import { BLOCK_DROP_PICKUP_DELAY, ItemEntity } from "./entity/item_entity.ts";
|
||||
import { ObjectEntity } from "./entity/mod_entity.ts";
|
||||
import { attribute_type, type AttributeType, MODIFIER_OPERATIONS } from "./entity/attributes.ts";
|
||||
import { effect_type, EffectInstance, type EffectType } from "./entity/effects.ts";
|
||||
import { biome_season } from "@/common/worldgen/biomes.ts";
|
||||
@@ -192,6 +193,7 @@ export class ModRuntime {
|
||||
block_break: new Signal(),
|
||||
block_place: new Signal(),
|
||||
block_interact: new Signal(),
|
||||
entity_interact: new Signal(),
|
||||
chat_send: new Signal(),
|
||||
entity_damage: new Signal(),
|
||||
};
|
||||
@@ -1853,8 +1855,15 @@ export function entity_ref(entity: Entity): EntityRef {
|
||||
kill(cause = "script") {
|
||||
entity.kill(String(cause));
|
||||
},
|
||||
get_item: () => entity instanceof ItemEntity ? item_copy(entity.item) : undefined,
|
||||
get_item() {
|
||||
const item = entity instanceof ItemEntity || entity instanceof ObjectEntity ? entity.item : undefined;
|
||||
return item ? item_copy(item) : undefined;
|
||||
},
|
||||
set_item(item) {
|
||||
if (entity instanceof ObjectEntity) {
|
||||
if (!entity.removed) entity.item = item && item.count > 0 ? new_stack(item) : undefined;
|
||||
return;
|
||||
}
|
||||
if (!(entity instanceof ItemEntity)) throw new Error(`${entity.type} isn't an item lying around`);
|
||||
if (entity.removed) return;
|
||||
if (!item || item.count <= 0) entity.remove();
|
||||
|
||||
Reference in New Issue
Block a user