Skip to content

Commit

Permalink
fix: ignore non-existent entity
Browse files Browse the repository at this point in the history
  • Loading branch information
tutinoko2048 committed Jun 8, 2023
1 parent ef04f4f commit 1e27eb7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/modules/entity_check.js
@@ -1,14 +1,14 @@
import { world, Entity } from '@minecraft/server';
import { world, EntityLifetimeState } from '@minecraft/server';
import { Util } from '../util/util';
import config from '../config.js';
import { isIllegalItem, isSpawnEgg, queueNotify } from './util';
const overworld = world.getDimension('overworld');

const despawnable = ['minecraft:npc', 'minecraft:command_block_minecart'];

/** @param {Entity} entity */
/** @param {import('@minecraft/server').Entity} entity */
export function entityCheck(entity) {
if (!(entity instanceof Entity)) return; // 矢を打って即当たった時にundefinedになるから弾く
if (entity?.lifetimeState !== EntityLifetimeState.loaded) return; // スポーンしてすぐしぬと間に合わないから対策
const { typeId, location } = entity;

if (config.entityCheckC.state) {
Expand Down

0 comments on commit 1e27eb7

Please sign in to comment.