@occultus/block-api 0.20.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,4 +27,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
27
27
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
28
28
 
29
29
  THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
- ```
30
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occultus/block-api",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://codeberg.org/TeamOccultus/StarTenonAPI"
@@ -24,18 +24,18 @@
24
24
  "license": "MIT",
25
25
  "author": "CTN Studios",
26
26
  "peerDependencies": {
27
- "@occultus/core": ">=0.18.4 || <0.19.0",
28
- "@minecraft/server": ">=2.0.0",
29
- "@minecraft/server-ui": ">=2.0.0"
27
+ "@occultus/core": "~0.18.4",
28
+ "@minecraft/server": "^2.4.0",
29
+ "@minecraft/server-ui": "^2.0.0"
30
30
  },
31
31
  "dependencies": {
32
32
  "@occultus/loot-api": "0.20.0",
33
- "@occultus/entity-api": "0.20.0",
34
- "@occultus/item-api": "0.20.0"
33
+ "@occultus/toolkit": "0.23.1",
34
+ "@occultus/item-api": "0.22.0-beta.1"
35
35
  },
36
36
  "type": "module",
37
37
  "devDependencies": {
38
- "typedoc": "^0.28.9"
38
+ "typedoc": "^0.28.16"
39
39
  },
40
40
  "scripts": {
41
41
  "test": "tsc"
@@ -9,6 +9,8 @@
9
9
  * "tag": "minecraft:is_pickaxe",
10
10
  * "loot_table": "blocks/lab_table"
11
11
  * }
12
+ *
13
+ * @deprecated 我们推荐使用原版数据驱动来实现有关的功能
12
14
  */
13
15
  export class BlockWithDestroyCondition {
14
16
  constructor(readonly name: string) {}
package/src/index.ts CHANGED
@@ -1,7 +1,10 @@
1
- export * from "./api/base/BlockRegistries"
2
- export * from "./api/InteractableBlock"
3
- export * from "./api/OreBlock"
4
- export * from "./api/BlockWithDestroyCondition"
5
- export * from "./types/OreBlockParams"
6
- export * from "./types/BlockWithDestroyConditionParams"
7
- export * from "./types/RegistryBlock"
1
+ /**
2
+ * @module @occultus/block-api
3
+ */
4
+ export * from "./api/base/BlockRegistries";
5
+ export * from "./api/InteractableBlock";
6
+ export * from "./api/OreBlock";
7
+ export * from "./api/BlockWithDestroyCondition";
8
+ export * from "./types/OreBlockParams";
9
+ export * from "./types/BlockWithDestroyConditionParams";
10
+ export * from "./types/RegistryBlock";
@@ -1,4 +1,3 @@
1
-
2
1
  /**
3
2
  * 描述自定义矿石方块组件参数的类型
4
3
  */
@@ -5,4 +5,4 @@ import { BlockRegistries } from "../api/base/BlockRegistries";
5
5
  /**
6
6
  * 需要通过 {@link BlockRegistries} 注册的方块类型
7
7
  */
8
- export type RegistryBlock = OreBlock | InteractableBlock;
8
+ export type RegistryBlock = OreBlock | InteractableBlock;
@@ -1,4 +1,4 @@
1
- import { GameMode, Player, system } from "@minecraft/server";
1
+ import { GameMode, Player } from "@minecraft/server";
2
2
  import { InteractableBlock } from "../api/InteractableBlock";
3
3
  import { OreBlock } from "../api/OreBlock";
4
4
  import { OreBlockParams } from "../types/OreBlockParams";
@@ -6,7 +6,7 @@ import { loot } from "@occultus/loot-api";
6
6
  import { ItemTier } from "@occultus/item-api";
7
7
  import { BlockWithDestroyCondition } from "../api/BlockWithDestroyCondition";
8
8
  import { BlockWithDestroyConditionParams } from "../types/BlockWithDestroyConditionParams";
9
- import { getEquipmentItem } from "@occultus/entity-api";
9
+ import { getEquipmentItem } from "@occultus/toolkit";
10
10
  import { StartupEvent } from "@minecraft/server";
11
11
 
12
12
  export class BlockInternalUtils {
@@ -15,22 +15,21 @@ export class BlockInternalUtils {
15
15
  arg: StartupEvent
16
16
  ): void {
17
17
  arg.blockComponentRegistry.registerCustomComponent(block.name, {
18
- onPlayerInteract(arg) {},
18
+ onPlayerInteract(_arg) {}
19
19
  });
20
20
  }
21
21
  static registryOreBlockComponent(block: OreBlock, arg: StartupEvent): void {
22
- const that = this;
23
22
  arg.blockComponentRegistry.registerCustomComponent(block.name, {
24
23
  onPlayerBreak(callback, param) {
25
24
  const p = param.params as OreBlockParams;
26
25
  if (!callback.player) return;
27
26
  if (block.onBreak) block.onBreak(callback);
28
27
  if (callback.player.getGameMode() === GameMode.Creative) return;
29
- if (that.checkCondition(callback.player, p)) {
28
+ if (BlockInternalUtils.checkCondition(callback.player, p)) {
30
29
  loot(callback.dimension, callback.block.location, p.loot_table);
31
30
  if (p.exp) callback.player.addExperience(p.exp);
32
31
  }
33
- },
32
+ }
34
33
  });
35
34
  }
36
35
  static registryDestroyCondition(
@@ -46,7 +45,7 @@ export class BlockInternalUtils {
46
45
  loot(callback.dimension, callback.block.location, p.loot_table);
47
46
  return;
48
47
  }
49
- },
48
+ }
50
49
  });
51
50
  }
52
51
  static checkCondition(