From 4428fd6cb4953202036b7edac5abd69f6ee65268 Mon Sep 17 00:00:00 2001 From: jayly-bot <65847850+JaylyDev@users.noreply.github.com> Date: Wed, 23 Aug 2023 15:55:30 +0800 Subject: [PATCH] compatible with latest preview --- .github/workflows/cl.yml | 4 +--- scripts/events-log/index.js | 2 +- scripts/events-log/index.ts | 2 +- scripts/spawn-simulated-player/tests.js | 7 ++++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cl.yml b/.github/workflows/cl.yml index d5f85c8c..5d8c605d 100644 --- a/.github/workflows/cl.yml +++ b/.github/workflows/cl.yml @@ -24,9 +24,7 @@ jobs: find ./docs/* -maxdepth 5 -name package.json -execdir sh -c 'pwd && npm install' \; - name: Type Check - run: | - tsc --build --verbose - cp -r dist/* . + run: tsc --build - name: Format Check run: node ./dist/tools/index.js diff --git a/scripts/events-log/index.js b/scripts/events-log/index.js index 4e68c5f7..e2a7958a 100644 --- a/scripts/events-log/index.js +++ b/scripts/events-log/index.js @@ -29,7 +29,7 @@ world.afterEvents.entityHealthChanged.subscribe(callback); world.afterEvents.entityHitBlock.subscribe(callback); world.afterEvents.entityHitEntity.subscribe(callback); world.afterEvents.entityHurt.subscribe(callback); -world.afterEvents.entityRemoved.subscribe(callback); +world.afterEvents.entityRemove.subscribe(callback); world.afterEvents.entitySpawn.subscribe(callback); world.afterEvents.explosion.subscribe(callback); world.afterEvents.itemCompleteUse.subscribe(callback); diff --git a/scripts/events-log/index.ts b/scripts/events-log/index.ts index c8d41d63..17d0e550 100644 --- a/scripts/events-log/index.ts +++ b/scripts/events-log/index.ts @@ -33,7 +33,7 @@ world.afterEvents.entityHealthChanged.subscribe(callback); world.afterEvents.entityHitBlock.subscribe(callback); world.afterEvents.entityHitEntity.subscribe(callback); world.afterEvents.entityHurt.subscribe(callback); -world.afterEvents.entityRemoved.subscribe(callback) +world.afterEvents.entityRemove.subscribe(callback) world.afterEvents.entitySpawn.subscribe(callback); world.afterEvents.explosion.subscribe(callback); world.afterEvents.itemCompleteUse.subscribe(callback); diff --git a/scripts/spawn-simulated-player/tests.js b/scripts/spawn-simulated-player/tests.js index 814443ca..8b60d1f9 100644 --- a/scripts/spawn-simulated-player/tests.js +++ b/scripts/spawn-simulated-player/tests.js @@ -1,13 +1,14 @@ -import { world, MinecraftItemTypes, ItemStack, } from "@minecraft/server"; +import { world, ItemStack, } from "@minecraft/server"; import { MinecraftEffectTypes } from "@minecraft/vanilla-data"; import { SpawnSimulatedPlayer } from "./index.js"; let host = [...world.getPlayers()][0]; +const money = world.scoreboard.getObjective("money") ?? world.scoreboard.addObjective("money", "money"); SpawnSimulatedPlayer(host, function (simulatedPlayer) { simulatedPlayer.addEffect(MinecraftEffectTypes.Absorption, 1); simulatedPlayer.attack(); simulatedPlayer.dimension.createExplosion(simulatedPlayer.location, 5); - simulatedPlayer.giveItem(new ItemStack(MinecraftItemTypes.acaciaBoat)); - simulatedPlayer.runCommandAsync("scoreboard players add @s money 1"); + simulatedPlayer.giveItem(new ItemStack("minecraft:acacia_boat")); + money.addScore(simulatedPlayer, 1); simulatedPlayer.teleport({ x: 0, y: 0, z: 0 }, { dimension: simulatedPlayer.dimension, rotation: { x: 0, y: 0 } }); simulatedPlayer.despawn(); });