@occultus/api 0.28.0 → 0.29.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occultus/api",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://codeberg.org/TeamOccultus/StarTenonAPI"
@@ -23,27 +23,27 @@
23
23
  "license": "MIT",
24
24
  "author": "CTN Studios",
25
25
  "dependencies": {
26
- "@occultus/artifact-api": "0.23.0",
27
26
  "@occultus/common": "0.20.0",
27
+ "@occultus/artifact-api": "0.23.0",
28
28
  "@occultus/article-api": "0.24.0",
29
- "@occultus/time-api": "0.22.0",
30
- "@occultus/block-api": "0.23.0",
31
29
  "@occultus/entity-api": "0.22.1",
30
+ "@occultus/block-api": "0.23.0",
32
31
  "@occultus/text-api": "0.24.0",
33
- "@occultus/skill-api": "0.21.0",
32
+ "@occultus/time-api": "0.22.0",
34
33
  "@occultus/format-api": "0.21.0",
34
+ "@occultus/skill-api": "0.21.0",
35
35
  "@occultus/task-api": "0.23.2",
36
- "@occultus/item-api": "0.23.0",
37
36
  "@occultus/music-api": "0.22.0",
37
+ "@occultus/item-api": "0.23.0",
38
38
  "@occultus/math-api": "0.23.0",
39
+ "@occultus/logger-api": "0.21.0",
40
+ "@occultus/notification-api": "0.22.0",
41
+ "@occultus/tutorial-api": "0.24.0",
39
42
  "@occultus/random-api": "0.22.1",
40
- "@occultus/notification-api": "0.21.0",
41
43
  "@occultus/loot-api": "0.21.0",
42
- "@occultus/logger-api": "0.21.0",
43
44
  "@occultus/job-api": "0.23.0",
44
- "@occultus/tutorial-api": "0.24.0",
45
- "@occultus/toolkit": "0.25.0",
46
45
  "@occultus/condition-api": "0.23.1",
46
+ "@occultus/toolkit": "0.25.0",
47
47
  "@occultus/effect-api": "0.22.0",
48
48
  "@occultus/credits-api": "0.23.2",
49
49
  "@occultus/logue-api": "0.26.0-beta.1"
package/script/api.js CHANGED
@@ -25,12 +25,13 @@ var StarTenon = class {
25
25
  * - 10:加入了 Server Binding API
26
26
  * - 10.1:新的工具集函数,BlockEntity 的 API 行为变化
27
27
  * - 11:教程 API 的改进,单独的依赖库文件的提供
28
+ * - 12:加入了 Toast API
28
29
  */
29
- static apiLevel = 11;
30
+ static apiLevel = 12;
30
31
  /**
31
32
  * Star Tenon API 对应的版本号
32
33
  */
33
- static version = `0.28.0 (API: ${this.apiLevel})`;
34
+ static version = `0.29.0 (API: ${this.apiLevel})`;
34
35
  };
35
36
 
36
37
  // ../node_modules/.pnpm/@occultus+core@1.1.0_@minec_cddd9d27654ecc6961f34ac46dfd0b14/node_modules/@occultus/core/src/api/error/SDKError.ts
@@ -4053,6 +4054,42 @@ var WelcomeNotification = class {
4053
4054
  }
4054
4055
  };
4055
4056
 
4057
+ // ../packages/notification/src/api/Toast.ts
4058
+ import { world as world12 } from "@minecraft/server";
4059
+ var Toast = class {
4060
+ /**
4061
+ * @param content 通知消息,推荐不超过两行
4062
+ * @param iconPath 通知图标路径
4063
+ */
4064
+ constructor(content, iconPath) {
4065
+ this.content = content;
4066
+ this.iconPath = iconPath;
4067
+ }
4068
+ /**
4069
+ * 向玩家发送吐司通知
4070
+ * @param player
4071
+ */
4072
+ send(player) {
4073
+ player.onScreenDisplay.setTitle(
4074
+ {
4075
+ rawtext: [{ text: "toast:" }, parseToRaw(this.content, player)]
4076
+ },
4077
+ {
4078
+ subtitle: `toast:${this.iconPath}`,
4079
+ fadeInDuration: 0,
4080
+ fadeOutDuration: 0,
4081
+ stayDuration: 1
4082
+ }
4083
+ );
4084
+ }
4085
+ /**
4086
+ * 向所有玩家发送吐司通知
4087
+ */
4088
+ sendToWorld() {
4089
+ world12.getAllPlayers().forEach((player) => this.send(player));
4090
+ }
4091
+ };
4092
+
4056
4093
  // ../packages/loot/src/api/base/CustomLoot.ts
4057
4094
  var CustomLoot = class {
4058
4095
  /**
@@ -4124,7 +4161,7 @@ var CustomEntityLoot = class extends CustomLoot {
4124
4161
  };
4125
4162
 
4126
4163
  // ../packages/loot/src/api/CustomLootServer.ts
4127
- import { world as world12, system as system10 } from "@minecraft/server";
4164
+ import { world as world13, system as system10 } from "@minecraft/server";
4128
4165
  var CustomLootServer = class {
4129
4166
  /**
4130
4167
  * 存储实体类型ID与对应战利品表路径的映射
@@ -4135,14 +4172,14 @@ var CustomLootServer = class {
4135
4172
  */
4136
4173
  blockLootMap = /* @__PURE__ */ new Map();
4137
4174
  constructor() {
4138
- world12.afterEvents.entityDie.subscribe((event) => {
4175
+ world13.afterEvents.entityDie.subscribe((event) => {
4139
4176
  const entity = event.deadEntity;
4140
4177
  const lootTable = this.entityLootMap.get(entity.typeId);
4141
4178
  if (lootTable) {
4142
4179
  loot(entity.dimension, entity.location, lootTable);
4143
4180
  }
4144
4181
  });
4145
- world12.beforeEvents.playerBreakBlock.subscribe((event) => {
4182
+ world13.beforeEvents.playerBreakBlock.subscribe((event) => {
4146
4183
  const block = event.block;
4147
4184
  const lootTable = this.blockLootMap.get(block.typeId);
4148
4185
  if (lootTable) {
@@ -4171,7 +4208,7 @@ var CustomLootServer = class {
4171
4208
  };
4172
4209
 
4173
4210
  // ../packages/logger/src/api/Logger.ts
4174
- import { world as world14 } from "@minecraft/server";
4211
+ import { world as world15 } from "@minecraft/server";
4175
4212
 
4176
4213
  // ../packages/logger/src/enum/LogLevel.ts
4177
4214
  var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
@@ -4184,7 +4221,7 @@ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
4184
4221
  })(LogLevel || {});
4185
4222
 
4186
4223
  // ../packages/logger/src/api/LoggerInternalUtils.ts
4187
- import { world as world13 } from "@minecraft/server";
4224
+ import { world as world14 } from "@minecraft/server";
4188
4225
 
4189
4226
  // ../packages/logger/src/data/LogLevelMap.ts
4190
4227
  var LogLevelMap = {
@@ -4201,13 +4238,13 @@ var LoggerInternalUtils = class {
4201
4238
  if (player) {
4202
4239
  return player.getDynamicProperty("occultus:log_level") ?? 3 /* Fatal */;
4203
4240
  }
4204
- return world13.getDynamicProperty("occultus:log_level") ?? 3 /* Fatal */;
4241
+ return world14.getDynamicProperty("occultus:log_level") ?? 3 /* Fatal */;
4205
4242
  }
4206
4243
  static setLogLevel(level, player) {
4207
4244
  if (player) {
4208
4245
  player.setDynamicProperty("occultus:log_level", level);
4209
4246
  } else {
4210
- world13.setDynamicProperty("occultus:log_level", level);
4247
+ world14.setDynamicProperty("occultus:log_level", level);
4211
4248
  }
4212
4249
  }
4213
4250
  static stringfyMessage(message, level, namespace) {
@@ -4235,7 +4272,7 @@ var LoggerInternalUtils = class {
4235
4272
  if (this.getLogLevel() > level) {
4236
4273
  return;
4237
4274
  }
4238
- world13.sendMessage(message);
4275
+ world14.sendMessage(message);
4239
4276
  }
4240
4277
  static sendLogToPlayer(message, player, level) {
4241
4278
  if (this.getLogLevel(player) > level) {
@@ -4352,7 +4389,7 @@ var Logger = class _Logger {
4352
4389
  );
4353
4390
  this.addToHistory(msg);
4354
4391
  console.error(msg);
4355
- world14.sendMessage(msg);
4392
+ world15.sendMessage(msg);
4356
4393
  throw new Error(msg);
4357
4394
  }
4358
4395
  /**
@@ -4677,9 +4714,9 @@ import { ActionFormData as ActionFormData3 } from "@minecraft/server-ui";
4677
4714
  import {
4678
4715
  CustomCommandSource as CustomCommandSource2,
4679
4716
  CustomCommandStatus as CustomCommandStatus2,
4680
- Player as Player16,
4717
+ Player as Player17,
4681
4718
  system as system13,
4682
- world as world15
4719
+ world as world16
4683
4720
  } from "@minecraft/server";
4684
4721
  var ArtifactEvents = class _ArtifactEvents {
4685
4722
  static registryConponent(componentName) {
@@ -4690,16 +4727,16 @@ var ArtifactEvents = class _ArtifactEvents {
4690
4727
  }
4691
4728
  });
4692
4729
  });
4693
- world15.afterEvents.playerBreakBlock.subscribe((arg) => {
4730
+ world16.afterEvents.playerBreakBlock.subscribe((arg) => {
4694
4731
  _ArtifactEvents.onMineBlock(arg);
4695
4732
  });
4696
- world15.afterEvents.entityHitEntity.subscribe((arg) => {
4733
+ world16.afterEvents.entityHitEntity.subscribe((arg) => {
4697
4734
  _ArtifactEvents.onHitEntity(arg);
4698
4735
  });
4699
- world15.afterEvents.entityHurt.subscribe((arg) => {
4736
+ world16.afterEvents.entityHurt.subscribe((arg) => {
4700
4737
  _ArtifactEvents.onHurt(arg);
4701
4738
  });
4702
- world15.afterEvents.playerSpawn.subscribe((arg) => {
4739
+ world16.afterEvents.playerSpawn.subscribe((arg) => {
4703
4740
  if (arg.player.hasTag("artifact_cooldown") && arg.player.isValid) {
4704
4741
  arg.player.removeTag("artifact_cooldown");
4705
4742
  }
@@ -4735,7 +4772,7 @@ var ArtifactEvents = class _ArtifactEvents {
4735
4772
  }
4736
4773
  static onHitEntity(arg) {
4737
4774
  const { damagingEntity } = arg;
4738
- if (!(damagingEntity instanceof Player16)) return;
4775
+ if (!(damagingEntity instanceof Player17)) return;
4739
4776
  ArtifactUtils.getArtifactSlotRegistry().getAll().forEach((slot) => {
4740
4777
  slot.getArtifact(damagingEntity)?.hitEntityEvent(arg);
4741
4778
  });
@@ -4748,7 +4785,7 @@ var ArtifactEvents = class _ArtifactEvents {
4748
4785
  }
4749
4786
  static onHurt(arg) {
4750
4787
  const { hurtEntity } = arg;
4751
- if (!(hurtEntity instanceof Player16)) return;
4788
+ if (!(hurtEntity instanceof Player17)) return;
4752
4789
  ArtifactUtils.getArtifactSlotRegistry().getAll().forEach((slot) => {
4753
4790
  slot.getArtifact(hurtEntity)?.hurtEvent(arg);
4754
4791
  });
@@ -4769,7 +4806,7 @@ var ArtifactEvents = class _ArtifactEvents {
4769
4806
  return {
4770
4807
  status: CustomCommandStatus2.Failure
4771
4808
  };
4772
- if (!(origin.sourceEntity instanceof Player16))
4809
+ if (!(origin.sourceEntity instanceof Player17))
4773
4810
  return {
4774
4811
  status: CustomCommandStatus2.Failure
4775
4812
  };
@@ -5581,7 +5618,7 @@ import {
5581
5618
  system as system17,
5582
5619
  CustomCommandSource as CustomCommandSource3,
5583
5620
  CustomCommandStatus as CustomCommandStatus3,
5584
- Player as Player19
5621
+ Player as Player20
5585
5622
  } from "@minecraft/server";
5586
5623
  var TutorialUtils = class {
5587
5624
  constructor() {
@@ -5603,7 +5640,7 @@ var TutorialUtils = class {
5603
5640
  return {
5604
5641
  status: CustomCommandStatus3.Failure
5605
5642
  };
5606
- if (!(origin.sourceEntity instanceof Player19))
5643
+ if (!(origin.sourceEntity instanceof Player20))
5607
5644
  return {
5608
5645
  status: CustomCommandStatus3.Failure
5609
5646
  };
@@ -5684,7 +5721,7 @@ var TutorialCenter = class extends FormLike {
5684
5721
  };
5685
5722
 
5686
5723
  // ../packages/tutorial/src/api/base/TutorialServer.ts
5687
- import { Player as Player21, world as world16 } from "@minecraft/server";
5724
+ import { Player as Player22, world as world17 } from "@minecraft/server";
5688
5725
  var TutorialServer = class {
5689
5726
  tutorials = {
5690
5727
  itemMap: /* @__PURE__ */ new Map(),
@@ -5703,7 +5740,7 @@ var TutorialServer = class {
5703
5740
  * @private
5704
5741
  */
5705
5742
  startUp() {
5706
- world16.afterEvents.playerInventoryItemChange.subscribe((arg) => {
5743
+ world17.afterEvents.playerInventoryItemChange.subscribe((arg) => {
5707
5744
  const { itemStack, player } = arg;
5708
5745
  if (!itemStack) return;
5709
5746
  itemStack.getTags().forEach((tag) => {
@@ -5715,33 +5752,33 @@ var TutorialServer = class {
5715
5752
  this.tutorials.itemMap.get(itemStack.typeId)?.unlock(player);
5716
5753
  }
5717
5754
  });
5718
- world16.afterEvents.playerBreakBlock.subscribe((arg) => {
5755
+ world17.afterEvents.playerBreakBlock.subscribe((arg) => {
5719
5756
  const { brokenBlockPermutation } = arg;
5720
5757
  const id = brokenBlockPermutation.type.id;
5721
5758
  if (this.tutorials.blockMap.has(id)) {
5722
5759
  this.tutorials.blockMap.get(id)?.unlock(arg.player);
5723
5760
  }
5724
5761
  });
5725
- world16.afterEvents.playerPlaceBlock.subscribe((arg) => {
5762
+ world17.afterEvents.playerPlaceBlock.subscribe((arg) => {
5726
5763
  const { block, player } = arg;
5727
5764
  if (this.tutorials.blockMap.has(block.typeId)) {
5728
5765
  this.tutorials.blockMap.get(block.typeId)?.unlock(player);
5729
5766
  }
5730
5767
  });
5731
- world16.afterEvents.entityHitEntity.subscribe((arg) => {
5768
+ world17.afterEvents.entityHitEntity.subscribe((arg) => {
5732
5769
  const { damagingEntity, hitEntity } = arg;
5733
- if (damagingEntity instanceof Player21) {
5770
+ if (damagingEntity instanceof Player22) {
5734
5771
  const tutorial = this.tutorials.entityMap.get(hitEntity.typeId);
5735
5772
  if (tutorial) tutorial.unlock(damagingEntity);
5736
5773
  return;
5737
5774
  }
5738
- if (hitEntity instanceof Player21) {
5775
+ if (hitEntity instanceof Player22) {
5739
5776
  const tutorial = this.tutorials.entityMap.get(damagingEntity.typeId);
5740
5777
  if (tutorial) tutorial.unlock(hitEntity);
5741
5778
  return;
5742
5779
  }
5743
5780
  });
5744
- world16.afterEvents.playerDimensionChange.subscribe((arg) => {
5781
+ world17.afterEvents.playerDimensionChange.subscribe((arg) => {
5745
5782
  const { toDimension, player } = arg;
5746
5783
  if (this.tutorials.dimensionMap.has(toDimension.id)) {
5747
5784
  this.tutorials.dimensionMap.get(toDimension.id)?.unlock(player);
@@ -5931,7 +5968,7 @@ import {
5931
5968
  CustomCommandStatus as CustomCommandStatus4,
5932
5969
  ItemLockMode,
5933
5970
  ItemStack as ItemStack11,
5934
- Player as Player22,
5971
+ Player as Player23,
5935
5972
  system as system20
5936
5973
  } from "@minecraft/server";
5937
5974
  var JobInternalUtils = class _JobInternalUtils {
@@ -6038,7 +6075,7 @@ var JobInternalUtils = class _JobInternalUtils {
6038
6075
  return {
6039
6076
  status: CustomCommandStatus4.Failure
6040
6077
  };
6041
- if (!(origin.sourceEntity instanceof Player22))
6078
+ if (!(origin.sourceEntity instanceof Player23))
6042
6079
  return {
6043
6080
  status: CustomCommandStatus4.Failure
6044
6081
  };
@@ -6361,7 +6398,7 @@ var JobDetailScreen = class {
6361
6398
  };
6362
6399
 
6363
6400
  // ../packages/job/src/api/JobSkill.ts
6364
- import { system as system22, world as world17 } from "@minecraft/server";
6401
+ import { system as system22, world as world18 } from "@minecraft/server";
6365
6402
  var JobSkillComponent = class {
6366
6403
  constructor(componentName) {
6367
6404
  this.componentName = componentName;
@@ -6380,7 +6417,7 @@ var JobSkill = class {
6380
6417
  this.name = name;
6381
6418
  this.description = description;
6382
6419
  this.lastingTicks = lastingTicks;
6383
- world17.afterEvents.itemUse.subscribe((arg) => {
6420
+ world18.afterEvents.itemUse.subscribe((arg) => {
6384
6421
  const { source, itemStack } = arg;
6385
6422
  if (itemStack.typeId !== this.typeId) return;
6386
6423
  if (isInCooldown(itemStack, source)) {
@@ -6411,18 +6448,18 @@ var JobSkill = class {
6411
6448
  };
6412
6449
 
6413
6450
  // ../packages/job/src/api/JobServer.ts
6414
- import { world as world18 } from "@minecraft/server";
6451
+ import { world as world19 } from "@minecraft/server";
6415
6452
 
6416
6453
  // ../packages/job/src/events/JobEvents.ts
6417
6454
  import {
6418
- Player as Player25
6455
+ Player as Player26
6419
6456
  } from "@minecraft/server";
6420
6457
  var JobEvents = class {
6421
6458
  constructor() {
6422
6459
  }
6423
6460
  static onHitEntity(arg, server) {
6424
6461
  const { damagingEntity } = arg;
6425
- if (!(damagingEntity instanceof Player25)) return;
6462
+ if (!(damagingEntity instanceof Player26)) return;
6426
6463
  const job = server.getJob(damagingEntity);
6427
6464
  if (!job) return;
6428
6465
  job.hitEntityEvent(arg, damagingEntity);
@@ -6435,9 +6472,9 @@ var JobEvents = class {
6435
6472
  }
6436
6473
  static onHurt(arg, server) {
6437
6474
  const { hurtEntity } = arg;
6438
- if (!(hurtEntity instanceof Player25)) {
6475
+ if (!(hurtEntity instanceof Player26)) {
6439
6476
  const damagingEntity = arg.damageSource.damagingEntity;
6440
- if (!(damagingEntity instanceof Player25)) return;
6477
+ if (!(damagingEntity instanceof Player26)) return;
6441
6478
  const job2 = server.getJob(damagingEntity);
6442
6479
  if (!job2) return;
6443
6480
  job2.causeDamageEvent(arg, damagingEntity);
@@ -6449,7 +6486,7 @@ var JobEvents = class {
6449
6486
  }
6450
6487
  static onProjectileHit(arg, server) {
6451
6488
  const { source } = arg;
6452
- if (!(source instanceof Player25)) return;
6489
+ if (!(source instanceof Player26)) return;
6453
6490
  const job = server.getJob(source);
6454
6491
  if (!job) return;
6455
6492
  job.projectileHitEvent(arg, source);
@@ -6460,16 +6497,16 @@ var JobEvents = class {
6460
6497
  var JobServer = class {
6461
6498
  jobs = /* @__PURE__ */ new Map();
6462
6499
  startUp() {
6463
- world18.afterEvents.playerBreakBlock.subscribe((arg) => {
6500
+ world19.afterEvents.playerBreakBlock.subscribe((arg) => {
6464
6501
  JobEvents.onMineBlock(arg, this);
6465
6502
  });
6466
- world18.afterEvents.entityHitEntity.subscribe((arg) => {
6503
+ world19.afterEvents.entityHitEntity.subscribe((arg) => {
6467
6504
  JobEvents.onHitEntity(arg, this);
6468
6505
  });
6469
- world18.afterEvents.entityHurt.subscribe((arg) => {
6506
+ world19.afterEvents.entityHurt.subscribe((arg) => {
6470
6507
  JobEvents.onHurt(arg, this);
6471
6508
  });
6472
- world18.afterEvents.projectileHitEntity.subscribe((arg) => {
6509
+ world19.afterEvents.projectileHitEntity.subscribe((arg) => {
6473
6510
  JobEvents.onProjectileHit(arg, this);
6474
6511
  });
6475
6512
  }
@@ -6586,7 +6623,7 @@ var CreditsScreen = class {
6586
6623
  import {
6587
6624
  CustomCommandSource as CustomCommandSource5,
6588
6625
  CustomCommandStatus as CustomCommandStatus5,
6589
- Player as Player27,
6626
+ Player as Player28,
6590
6627
  system as system23
6591
6628
  } from "@minecraft/server";
6592
6629
  var CreditsManager = class {
@@ -6613,7 +6650,7 @@ var CreditsManager = class {
6613
6650
  return {
6614
6651
  status: CustomCommandStatus5.Failure
6615
6652
  };
6616
- if (!(origin.sourceEntity instanceof Player27))
6653
+ if (!(origin.sourceEntity instanceof Player28))
6617
6654
  return {
6618
6655
  status: CustomCommandStatus5.Failure
6619
6656
  };
@@ -6784,6 +6821,7 @@ export {
6784
6821
  Tick,
6785
6822
  Time,
6786
6823
  TimeSpec,
6824
+ Toast,
6787
6825
  ToolMaterial,
6788
6826
  TranslateProvider,
6789
6827
  Tutorial,
package/src/apiVer.ts CHANGED
@@ -26,10 +26,11 @@ export class StarTenon {
26
26
  * - 10:加入了 Server Binding API
27
27
  * - 10.1:新的工具集函数,BlockEntity 的 API 行为变化
28
28
  * - 11:教程 API 的改进,单独的依赖库文件的提供
29
+ * - 12:加入了 Toast API
29
30
  */
30
- static apiLevel: number = 11;
31
+ static apiLevel: number = 12;
31
32
  /**
32
33
  * Star Tenon API 对应的版本号
33
34
  */
34
- static version: string = `0.28.0 (API: ${this.apiLevel})`;
35
+ static version: string = `0.29.0 (API: ${this.apiLevel})`;
35
36
  }