@orusteam/solariscore 2.6.3 → 2.6.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"GrassBlockComponent.d.ts","sourceRoot":"","sources":["../../../src/block/components/GrassBlockComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,6BAA6B,EAAE,oBAAoB,EAAE,yBAAyB,EAAW,MAAM,mBAAmB,CAAC;AAkCnI,qBAAa,mBAAoB,YAAW,oBAAoB;;IAK5D,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,6BAA6B,EAAE,EAAE,MAAM,EAAE,EAAE,yBAAyB;CAS/F"}
1
+ {"version":3,"file":"GrassBlockComponent.d.ts","sourceRoot":"","sources":["../../../src/block/components/GrassBlockComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,6BAA6B,EAAE,oBAAoB,EAAE,yBAAyB,EAAW,MAAM,mBAAmB,CAAC;AAkCnI,qBAAa,mBAAoB,YAAW,oBAAoB;;IAK5D,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,6BAA6B,EAAE,EAAE,MAAM,EAAE,EAAE,yBAAyB;CAW/F"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- import { system as system5 } from "@minecraft/server";
2
+ import { system as system6 } from "@minecraft/server";
3
3
 
4
4
  // node_modules/@minecraft/math/lib/src/general/clamp.js
5
5
  function clampNumber(val, min, max) {
@@ -456,7 +456,7 @@ var Colors = {
456
456
  import { BlockVolume } from "@minecraft/server";
457
457
 
458
458
  // src/block/components/CropBlockComponent.ts
459
- import { EquipmentSlot as EquipmentSlot2, GameMode as GameMode2, ItemStack as ItemStack2 } from "@minecraft/server";
459
+ import { EquipmentSlot as EquipmentSlot3, GameMode as GameMode2, ItemStack as ItemStack3 } from "@minecraft/server";
460
460
 
461
461
  // src/utils/BlockBuilder.ts
462
462
  var BlockBuilder = class {
@@ -503,7 +503,7 @@ import { system } from "@minecraft/server";
503
503
  var ChunkManager = class {
504
504
  constructor(dimension, location) {
505
505
  this.dimension = dimension;
506
- this.id = ChunkUtil.getChunkId(location);
506
+ this.id = ChunkUtil.getChunkId(dimension, location);
507
507
  this.chunkXZ = ChunkUtil.getChunkXZ(location);
508
508
  this.chunkOrigin = {
509
509
  x: this.chunkXZ.x * 16,
@@ -521,7 +521,7 @@ var ChunkManager = class {
521
521
  var ChunkUtil = class _ChunkUtil {
522
522
  static chunksCache = /* @__PURE__ */ new Map();
523
523
  static getChunk(dimension, location) {
524
- const chunkId = this.getChunkId(location);
524
+ const chunkId = this.getChunkId(dimension, location);
525
525
  const chunk = this.chunksCache.get(chunkId);
526
526
  if (chunk) {
527
527
  return chunk;
@@ -530,9 +530,9 @@ var ChunkUtil = class _ChunkUtil {
530
530
  this.chunksCache.set(chunkId, newChunk);
531
531
  return newChunk;
532
532
  }
533
- static getChunkId(location) {
533
+ static getChunkId(dimension, location) {
534
534
  const chunkXZ = this.getChunkXZ(location);
535
- return `${chunkXZ.x}.${chunkXZ.z}`;
535
+ return `${dimension.id}.${chunkXZ.x}.${chunkXZ.z}`;
536
536
  }
537
537
  static getChunkXZ(location) {
538
538
  return {
@@ -665,9 +665,14 @@ var DateUtil = class {
665
665
  };
666
666
 
667
667
  // src/utils/EntityUtil.ts
668
+ import { system as system2 } from "@minecraft/server";
668
669
  var EntityUtil = class {
669
670
  static applyCameraShake(entity, intensity, seconds, isRotational = false) {
670
- entity.runCommand(`camerashake add @s ${intensity} ${seconds} ${isRotational ? "rotational" : ""}`);
671
+ system2.run(() => {
672
+ if (entity.isValid) {
673
+ entity.runCommand(`camerashake add @s ${intensity} ${seconds} ${isRotational ? "rotational" : ""}`);
674
+ }
675
+ });
671
676
  }
672
677
  static getEquippedItem(entity, equipmentSlot) {
673
678
  return entity.isValid ? entity.getComponent("minecraft:equippable")?.getEquipment(equipmentSlot) : void 0;
@@ -675,7 +680,7 @@ var EntityUtil = class {
675
680
  };
676
681
 
677
682
  // src/utils/ItemUtil.ts
678
- import { EquipmentSlot, GameMode, ItemLockMode, ItemStack, Player } from "@minecraft/server";
683
+ import { EquipmentSlot as EquipmentSlot2, GameMode, ItemLockMode, ItemStack as ItemStack2, Player } from "@minecraft/server";
679
684
 
680
685
  // src/utils/MathUtil.ts
681
686
  var MathUtil = class {
@@ -723,7 +728,7 @@ var ItemUtil = class {
723
728
  if (entity instanceof Player && entity.getGameMode() === GameMode.Creative) return;
724
729
  const equippableComponent = entity.getComponent("minecraft:equippable");
725
730
  if (equippableComponent) {
726
- const mainhand = equippableComponent.getEquipmentSlot(EquipmentSlot.Mainhand);
731
+ const mainhand = equippableComponent.getEquipmentSlot(EquipmentSlot2.Mainhand);
727
732
  if (mainhand.hasItem()) {
728
733
  if (mainhand.amount > 1) mainhand.amount--;
729
734
  else mainhand.setItem(void 0);
@@ -763,7 +768,7 @@ var ItemUtil = class {
763
768
  const { container } = inventoryComponent;
764
769
  if (container) {
765
770
  for (let index = 0; index < itemIds.length; index++) {
766
- const itemStack = new ItemStack(itemIds[index]);
771
+ const itemStack = new ItemStack2(itemIds[index]);
767
772
  const slotIndex = 8 - index;
768
773
  if (container.getItem(slotIndex)?.typeId !== itemStack.typeId) {
769
774
  itemStack.keepOnDeath = true;
@@ -779,7 +784,7 @@ var ItemUtil = class {
779
784
  return false;
780
785
  }
781
786
  const equippableComponent = source.getComponent("minecraft:equippable");
782
- const itemStack = equippableComponent?.getEquipment(EquipmentSlot.Mainhand);
787
+ const itemStack = equippableComponent?.getEquipment(EquipmentSlot2.Mainhand);
783
788
  if (equippableComponent && itemStack) {
784
789
  const durability = itemStack.getComponent("minecraft:durability");
785
790
  if (durability) {
@@ -791,10 +796,10 @@ var ItemUtil = class {
791
796
  }
792
797
  }
793
798
  if (durability.damage >= durability.maxDurability) {
794
- equippableComponent.setEquipment(EquipmentSlot.Mainhand);
799
+ equippableComponent.setEquipment(EquipmentSlot2.Mainhand);
795
800
  source.dimension.playSound("random.break", source.location);
796
801
  } else {
797
- equippableComponent.setEquipment(EquipmentSlot.Mainhand, itemStack);
802
+ equippableComponent.setEquipment(EquipmentSlot2.Mainhand, itemStack);
798
803
  }
799
804
  return true;
800
805
  }
@@ -804,7 +809,7 @@ var ItemUtil = class {
804
809
  };
805
810
 
806
811
  // src/utils/MessageUtil.ts
807
- import { Player as Player2, system as system2 } from "@minecraft/server";
812
+ import { Player as Player2, system as system3 } from "@minecraft/server";
808
813
  var MessageUtil = class {
809
814
  static async sendSequence(source, messages, options) {
810
815
  const { delayBetweenMessages, popSound } = options;
@@ -814,7 +819,7 @@ var MessageUtil = class {
814
819
  source.playSound(popSound);
815
820
  }
816
821
  if (delayBetweenMessages) {
817
- await system2.waitTicks(delayBetweenMessages);
822
+ await system3.waitTicks(delayBetweenMessages);
818
823
  }
819
824
  }
820
825
  }
@@ -4142,7 +4147,7 @@ var CropBlockComponent = class {
4142
4147
  }
4143
4148
  onPlayerInteract({ block, dimension, player }, { params }) {
4144
4149
  if (!player) return;
4145
- const mainhand = EntityUtil.getEquippedItem(player, EquipmentSlot2.Mainhand);
4150
+ const mainhand = EntityUtil.getEquippedItem(player, EquipmentSlot3.Mainhand);
4146
4151
  if (!mainhand) return;
4147
4152
  const { permutation } = block;
4148
4153
  const { accumulable, bone_meal_multiplication, max_stage } = params;
@@ -4159,7 +4164,7 @@ var CropBlockComponent = class {
4159
4164
  const isCreative = player.getGameMode() === GameMode2.Creative;
4160
4165
  const fullyGrown = growthStage >= max_stage;
4161
4166
  if (bone_meal_multiplication && fullyGrown) {
4162
- dimension.spawnItem(new ItemStack2(block.typeId), location);
4167
+ dimension.spawnItem(new ItemStack3(block.typeId), location);
4163
4168
  ItemUtil.decrementStack(player);
4164
4169
  applyGrowthEffects(block);
4165
4170
  return;
@@ -4261,7 +4266,7 @@ var DoorBlockComponent = class {
4261
4266
  };
4262
4267
 
4263
4268
  // src/block/components/EggBlockComponent.ts
4264
- import { EquipmentSlot as EquipmentSlot3, GameMode as GameMode3, system as system3, world as world2 } from "@minecraft/server";
4269
+ import { EquipmentSlot as EquipmentSlot4, GameMode as GameMode3, system as system4, world as world2 } from "@minecraft/server";
4265
4270
  var FALL_BREAK_CHANCE = 1 / 3;
4266
4271
  var STEP_BREAK_CHANCE = 1 / 100;
4267
4272
  function canCrack(block, eggBlockParams) {
@@ -4306,7 +4311,7 @@ var EggBlockComponent = class {
4306
4311
  const bellowBlock = block.below();
4307
4312
  if (bellowBlock?.typeId === nest_block) {
4308
4313
  const location = block.center();
4309
- system3.run(() => block.dimension.spawnParticle("minecraft:crop_growth_emitter", location));
4314
+ system4.run(() => block.dimension.spawnParticle("minecraft:crop_growth_emitter", location));
4310
4315
  }
4311
4316
  }
4312
4317
  }
@@ -4322,7 +4327,7 @@ var EggBlockComponent = class {
4322
4327
  if (player && player.getGameMode() === GameMode3.Survival) {
4323
4328
  const location = block.center();
4324
4329
  const eggCount = Number(brokenBlockPermutation.getState("solariscore:egg_count"));
4325
- const mainHand = EntityUtil.getEquippedItem(player, EquipmentSlot3.Mainhand);
4330
+ const mainHand = EntityUtil.getEquippedItem(player, EquipmentSlot4.Mainhand);
4326
4331
  const items = [];
4327
4332
  for (let i = 0; i < eggCount; i++) {
4328
4333
  const itemStack = world2.getLootTableManager().generateLootFromBlockPermutation(brokenBlockPermutation, mainHand);
@@ -4337,7 +4342,7 @@ var EggBlockComponent = class {
4337
4342
  }
4338
4343
  onPlayerInteract({ block, dimension, player }, { params }) {
4339
4344
  if (player) {
4340
- const mainHand = EntityUtil.getEquippedItem(player, EquipmentSlot3.Mainhand);
4345
+ const mainHand = EntityUtil.getEquippedItem(player, EquipmentSlot4.Mainhand);
4341
4346
  if (mainHand?.typeId === block.typeId) {
4342
4347
  const { add_egg_sound, max_eggs_per_block } = params;
4343
4348
  const { permutation } = block;
@@ -4404,12 +4409,14 @@ var GrassBlockComponent = class {
4404
4409
  this.onRandomTick = this.onRandomTick.bind(this);
4405
4410
  }
4406
4411
  onRandomTick({ block }, { params }) {
4407
- const aboveBlock = block.above();
4408
- if (aboveBlock && aboveBlock.getLightLevel() === 0) {
4409
- const { dead_block } = params;
4410
- block.setType(dead_block);
4411
- } else {
4412
- trySpreadGrass(block, params);
4412
+ if (block.dimension.isChunkLoaded(block.location)) {
4413
+ const aboveBlock = block.above();
4414
+ if (aboveBlock?.getLightLevel() === 0) {
4415
+ const { dead_block } = params;
4416
+ block.setType(dead_block);
4417
+ } else {
4418
+ trySpreadGrass(block, params);
4419
+ }
4413
4420
  }
4414
4421
  }
4415
4422
  };
@@ -4465,7 +4472,7 @@ var ParticleEmitterBlockComponent = class {
4465
4472
  };
4466
4473
 
4467
4474
  // src/block/components/SaplingBlockComponent.ts
4468
- import { EquipmentSlot as EquipmentSlot4, GameMode as GameMode4 } from "@minecraft/server";
4475
+ import { EquipmentSlot as EquipmentSlot5, GameMode as GameMode4 } from "@minecraft/server";
4469
4476
  function tryPlaceFeature(blockSapling, params) {
4470
4477
  const { feature } = params;
4471
4478
  const featurePlaced = blockSapling.dimension.placeFeature(feature, blockSapling.location);
@@ -4480,7 +4487,7 @@ var SaplingBlockComponent = class {
4480
4487
  }
4481
4488
  onPlayerInteract({ block, player }, { params }) {
4482
4489
  if (player) {
4483
- const mainhand = EntityUtil.getEquippedItem(player, EquipmentSlot4.Mainhand);
4490
+ const mainhand = EntityUtil.getEquippedItem(player, EquipmentSlot5.Mainhand);
4484
4491
  if (!mainhand || mainhand.typeId !== "minecraft:bone_meal") return;
4485
4492
  const { permutation } = block;
4486
4493
  const ageBit = Number(permutation.getState("solariscore:age_bit"));
@@ -4527,7 +4534,7 @@ var DurabilitySensorItemComponent = class {
4527
4534
  };
4528
4535
 
4529
4536
  // src/misc/DynamicDatabase.ts
4530
- import { Entity as Entity3, system as system4, World as World2 } from "@minecraft/server";
4537
+ import { Entity as Entity4, system as system5, World as World2 } from "@minecraft/server";
4531
4538
  var DynamicDatabase = class _DynamicDatabase {
4532
4539
  constructor(provider, dataId) {
4533
4540
  this.provider = provider;
@@ -4540,7 +4547,7 @@ var DynamicDatabase = class _DynamicDatabase {
4540
4547
  isSaving = false;
4541
4548
  lastSerializedData;
4542
4549
  static getInstance(provider, dataId) {
4543
- if (provider instanceof Entity3 && !provider.isValid) {
4550
+ if (provider instanceof Entity4 && !provider.isValid) {
4544
4551
  return void 0;
4545
4552
  }
4546
4553
  if (!this.instances.has(provider)) {
@@ -4607,7 +4614,7 @@ var DynamicDatabase = class _DynamicDatabase {
4607
4614
  saveOnNextTick() {
4608
4615
  if (!this.isSaving) {
4609
4616
  this.isSaving = true;
4610
- system4.runTimeout(() => {
4617
+ system5.runTimeout(() => {
4611
4618
  this.save();
4612
4619
  this.isSaving = false;
4613
4620
  }, 2);
@@ -4637,7 +4644,7 @@ var solarisCoreItemComponentClassMap = {
4637
4644
  };
4638
4645
  var SolarisCore = class {
4639
4646
  setEnabledBlockComponents(componentIds) {
4640
- system5.beforeEvents.startup.subscribe(({ blockComponentRegistry }) => {
4647
+ system6.beforeEvents.startup.subscribe(({ blockComponentRegistry }) => {
4641
4648
  for (const id of componentIds) {
4642
4649
  const ComponentClass = solarisCoreBlockComponentClassMap[id];
4643
4650
  if (!ComponentClass) continue;
@@ -4646,7 +4653,7 @@ var SolarisCore = class {
4646
4653
  });
4647
4654
  }
4648
4655
  setEnabledItemComponents(componentIds) {
4649
- system5.beforeEvents.startup.subscribe(({ itemComponentRegistry }) => {
4656
+ system6.beforeEvents.startup.subscribe(({ itemComponentRegistry }) => {
4650
4657
  for (const id of componentIds) {
4651
4658
  const ComponentClass = solarisCoreItemComponentClassMap[id];
4652
4659
  if (!ComponentClass) continue;
@@ -11,7 +11,7 @@ declare class ChunkManager {
11
11
  declare class ChunkUtil {
12
12
  private static chunksCache;
13
13
  static getChunk(dimension: Dimension, location: VectorXZ): ChunkManager;
14
- static getChunkId(location: VectorXZ): string;
14
+ static getChunkId(dimension: Dimension, location: VectorXZ): string;
15
15
  static getChunkXZ(location: VectorXZ): VectorXZ;
16
16
  static getNearbyChunks(dimension: Dimension, location: Vector3, renderDistance?: number): ChunkManager[];
17
17
  static waitForChunkLoad(dimension: Dimension, location: Vector3): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"ChunkUtil.d.ts","sourceRoot":"","sources":["../../src/utils/ChunkUtil.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAU,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIzE,cAAM,YAAY;IAMF,QAAQ,CAAC,SAAS,EAAE,SAAS;IALzC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAS;gBAER,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ;IAS7D,IAAI,QAAQ,IAAI,OAAO,CAEtB;CACJ;AAID,cAAM,SAAS;IACX,OAAO,CAAC,MAAM,CAAC,WAAW,CAAmC;IAE7D,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,YAAY;IAavE,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM;IAK7C,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IAO/C,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,GAAE,MAAU;WA6B7E,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAWxF;AAID,OAAO,EACH,YAAY,EACZ,SAAS,EACZ,CAAC"}
1
+ {"version":3,"file":"ChunkUtil.d.ts","sourceRoot":"","sources":["../../src/utils/ChunkUtil.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAU,OAAO,EAA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AC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS;CAG9F"}
1
+ {"version":3,"file":"EntityUtil.d.ts","sourceRoot":"","sources":["../../src/utils/EntityUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAU,MAAM,mBAAmB,CAAC;AAI7E,qBAAa,UAAU;IACnB,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,GAAE,OAAe;IAQzG,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS;CAG9F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orusteam/solariscore",
3
- "version": "2.6.3",
3
+ "version": "2.6.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1 +0,0 @@
1
- //# sourceMappingURL=PlayerGroup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlayerGroup.d.ts","sourceRoot":"","sources":["../../../src/tests/playerGroup/PlayerGroup.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=groupCommands.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"groupCommands.d.ts","sourceRoot":"","sources":["../../../src/tests/playerGroup/groupCommands.ts"],"names":[],"mappings":""}