@orusteam/solariscore 2.6.2 → 2.6.4

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":"DoorBlockComponent.d.ts","sourceRoot":"","sources":["../../../src/block/components/DoorBlockComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,iCAAiC,EAAE,oCAAoC,EAAE,iCAAiC,EAAE,oBAAoB,EAAoB,MAAM,mBAAmB,CAAC;AAsB9L,qBAAa,kBAAmB,YAAW,oBAAoB;;IAO3D,mBAAmB,CAAC,KAAK,EAAE,oCAAoC;IA8C/D,gBAAgB,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,iCAAiC;IAOzE,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,iCAAiC;CAGhE"}
1
+ {"version":3,"file":"DoorBlockComponent.d.ts","sourceRoot":"","sources":["../../../src/block/components/DoorBlockComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,iCAAiC,EAAE,oCAAoC,EAAE,iCAAiC,EAAE,oBAAoB,EAAoB,MAAM,mBAAmB,CAAC;AA0B9L,qBAAa,kBAAmB,YAAW,oBAAoB;;IAO3D,mBAAmB,CAAC,KAAK,EAAE,oCAAoC;IA8C/D,gBAAgB,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,iCAAiC;IAOzE,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,iCAAiC;CAGhE"}
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,10 @@ 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(() => entity.runCommand(`camerashake add @s ${intensity} ${seconds} ${isRotational ? "rotational" : ""}`));
671
672
  }
672
673
  static getEquippedItem(entity, equipmentSlot) {
673
674
  return entity.isValid ? entity.getComponent("minecraft:equippable")?.getEquipment(equipmentSlot) : void 0;
@@ -675,7 +676,7 @@ var EntityUtil = class {
675
676
  };
676
677
 
677
678
  // src/utils/ItemUtil.ts
678
- import { EquipmentSlot, GameMode, ItemLockMode, ItemStack, Player } from "@minecraft/server";
679
+ import { EquipmentSlot as EquipmentSlot2, GameMode, ItemLockMode, ItemStack as ItemStack2, Player } from "@minecraft/server";
679
680
 
680
681
  // src/utils/MathUtil.ts
681
682
  var MathUtil = class {
@@ -723,7 +724,7 @@ var ItemUtil = class {
723
724
  if (entity instanceof Player && entity.getGameMode() === GameMode.Creative) return;
724
725
  const equippableComponent = entity.getComponent("minecraft:equippable");
725
726
  if (equippableComponent) {
726
- const mainhand = equippableComponent.getEquipmentSlot(EquipmentSlot.Mainhand);
727
+ const mainhand = equippableComponent.getEquipmentSlot(EquipmentSlot2.Mainhand);
727
728
  if (mainhand.hasItem()) {
728
729
  if (mainhand.amount > 1) mainhand.amount--;
729
730
  else mainhand.setItem(void 0);
@@ -763,7 +764,7 @@ var ItemUtil = class {
763
764
  const { container } = inventoryComponent;
764
765
  if (container) {
765
766
  for (let index = 0; index < itemIds.length; index++) {
766
- const itemStack = new ItemStack(itemIds[index]);
767
+ const itemStack = new ItemStack2(itemIds[index]);
767
768
  const slotIndex = 8 - index;
768
769
  if (container.getItem(slotIndex)?.typeId !== itemStack.typeId) {
769
770
  itemStack.keepOnDeath = true;
@@ -779,7 +780,7 @@ var ItemUtil = class {
779
780
  return false;
780
781
  }
781
782
  const equippableComponent = source.getComponent("minecraft:equippable");
782
- const itemStack = equippableComponent?.getEquipment(EquipmentSlot.Mainhand);
783
+ const itemStack = equippableComponent?.getEquipment(EquipmentSlot2.Mainhand);
783
784
  if (equippableComponent && itemStack) {
784
785
  const durability = itemStack.getComponent("minecraft:durability");
785
786
  if (durability) {
@@ -791,10 +792,10 @@ var ItemUtil = class {
791
792
  }
792
793
  }
793
794
  if (durability.damage >= durability.maxDurability) {
794
- equippableComponent.setEquipment(EquipmentSlot.Mainhand);
795
+ equippableComponent.setEquipment(EquipmentSlot2.Mainhand);
795
796
  source.dimension.playSound("random.break", source.location);
796
797
  } else {
797
- equippableComponent.setEquipment(EquipmentSlot.Mainhand, itemStack);
798
+ equippableComponent.setEquipment(EquipmentSlot2.Mainhand, itemStack);
798
799
  }
799
800
  return true;
800
801
  }
@@ -804,7 +805,7 @@ var ItemUtil = class {
804
805
  };
805
806
 
806
807
  // src/utils/MessageUtil.ts
807
- import { Player as Player2, system as system2 } from "@minecraft/server";
808
+ import { Player as Player2, system as system3 } from "@minecraft/server";
808
809
  var MessageUtil = class {
809
810
  static async sendSequence(source, messages, options) {
810
811
  const { delayBetweenMessages, popSound } = options;
@@ -814,7 +815,7 @@ var MessageUtil = class {
814
815
  source.playSound(popSound);
815
816
  }
816
817
  if (delayBetweenMessages) {
817
- await system2.waitTicks(delayBetweenMessages);
818
+ await system3.waitTicks(delayBetweenMessages);
818
819
  }
819
820
  }
820
821
  }
@@ -4142,7 +4143,7 @@ var CropBlockComponent = class {
4142
4143
  }
4143
4144
  onPlayerInteract({ block, dimension, player }, { params }) {
4144
4145
  if (!player) return;
4145
- const mainhand = EntityUtil.getEquippedItem(player, EquipmentSlot2.Mainhand);
4146
+ const mainhand = EntityUtil.getEquippedItem(player, EquipmentSlot3.Mainhand);
4146
4147
  if (!mainhand) return;
4147
4148
  const { permutation } = block;
4148
4149
  const { accumulable, bone_meal_multiplication, max_stage } = params;
@@ -4159,7 +4160,7 @@ var CropBlockComponent = class {
4159
4160
  const isCreative = player.getGameMode() === GameMode2.Creative;
4160
4161
  const fullyGrown = growthStage >= max_stage;
4161
4162
  if (bone_meal_multiplication && fullyGrown) {
4162
- dimension.spawnItem(new ItemStack2(block.typeId), location);
4163
+ dimension.spawnItem(new ItemStack3(block.typeId), location);
4163
4164
  ItemUtil.decrementStack(player);
4164
4165
  applyGrowthEffects(block);
4165
4166
  return;
@@ -4194,10 +4195,14 @@ function doorIsOpen(block) {
4194
4195
  }
4195
4196
  function tryToggleDoor(block) {
4196
4197
  const allStates = block.permutation.getAllStates();
4197
- const isOpen = allStates["solariscore:open_bit"];
4198
+ const otherBlock = allStates["minecraft:multi_block_part"] ? block.below() : block.above();
4199
+ const isOpen = doorIsOpen(block);
4198
4200
  const interactSoundId = isOpen ? "close.wooden_door" : "open.wooden_door";
4199
- block.setPermutation(block.permutation.withState("solariscore:open_bit", !isOpen));
4200
- block.dimension.playSound(interactSoundId, block.location);
4201
+ if (otherBlock) {
4202
+ otherBlock.setPermutation(otherBlock.permutation.withState("solariscore:open_bit", !isOpen));
4203
+ block.setPermutation(block.permutation.withState("solariscore:open_bit", !isOpen));
4204
+ block.dimension.playSound(interactSoundId, block.location);
4205
+ }
4201
4206
  }
4202
4207
  var DoorBlockComponent = class {
4203
4208
  constructor() {
@@ -4257,7 +4262,7 @@ var DoorBlockComponent = class {
4257
4262
  };
4258
4263
 
4259
4264
  // src/block/components/EggBlockComponent.ts
4260
- import { EquipmentSlot as EquipmentSlot3, GameMode as GameMode3, system as system3, world as world2 } from "@minecraft/server";
4265
+ import { EquipmentSlot as EquipmentSlot4, GameMode as GameMode3, system as system4, world as world2 } from "@minecraft/server";
4261
4266
  var FALL_BREAK_CHANCE = 1 / 3;
4262
4267
  var STEP_BREAK_CHANCE = 1 / 100;
4263
4268
  function canCrack(block, eggBlockParams) {
@@ -4302,7 +4307,7 @@ var EggBlockComponent = class {
4302
4307
  const bellowBlock = block.below();
4303
4308
  if (bellowBlock?.typeId === nest_block) {
4304
4309
  const location = block.center();
4305
- system3.run(() => block.dimension.spawnParticle("minecraft:crop_growth_emitter", location));
4310
+ system4.run(() => block.dimension.spawnParticle("minecraft:crop_growth_emitter", location));
4306
4311
  }
4307
4312
  }
4308
4313
  }
@@ -4318,7 +4323,7 @@ var EggBlockComponent = class {
4318
4323
  if (player && player.getGameMode() === GameMode3.Survival) {
4319
4324
  const location = block.center();
4320
4325
  const eggCount = Number(brokenBlockPermutation.getState("solariscore:egg_count"));
4321
- const mainHand = EntityUtil.getEquippedItem(player, EquipmentSlot3.Mainhand);
4326
+ const mainHand = EntityUtil.getEquippedItem(player, EquipmentSlot4.Mainhand);
4322
4327
  const items = [];
4323
4328
  for (let i = 0; i < eggCount; i++) {
4324
4329
  const itemStack = world2.getLootTableManager().generateLootFromBlockPermutation(brokenBlockPermutation, mainHand);
@@ -4333,7 +4338,7 @@ var EggBlockComponent = class {
4333
4338
  }
4334
4339
  onPlayerInteract({ block, dimension, player }, { params }) {
4335
4340
  if (player) {
4336
- const mainHand = EntityUtil.getEquippedItem(player, EquipmentSlot3.Mainhand);
4341
+ const mainHand = EntityUtil.getEquippedItem(player, EquipmentSlot4.Mainhand);
4337
4342
  if (mainHand?.typeId === block.typeId) {
4338
4343
  const { add_egg_sound, max_eggs_per_block } = params;
4339
4344
  const { permutation } = block;
@@ -4461,7 +4466,7 @@ var ParticleEmitterBlockComponent = class {
4461
4466
  };
4462
4467
 
4463
4468
  // src/block/components/SaplingBlockComponent.ts
4464
- import { EquipmentSlot as EquipmentSlot4, GameMode as GameMode4 } from "@minecraft/server";
4469
+ import { EquipmentSlot as EquipmentSlot5, GameMode as GameMode4 } from "@minecraft/server";
4465
4470
  function tryPlaceFeature(blockSapling, params) {
4466
4471
  const { feature } = params;
4467
4472
  const featurePlaced = blockSapling.dimension.placeFeature(feature, blockSapling.location);
@@ -4476,7 +4481,7 @@ var SaplingBlockComponent = class {
4476
4481
  }
4477
4482
  onPlayerInteract({ block, player }, { params }) {
4478
4483
  if (player) {
4479
- const mainhand = EntityUtil.getEquippedItem(player, EquipmentSlot4.Mainhand);
4484
+ const mainhand = EntityUtil.getEquippedItem(player, EquipmentSlot5.Mainhand);
4480
4485
  if (!mainhand || mainhand.typeId !== "minecraft:bone_meal") return;
4481
4486
  const { permutation } = block;
4482
4487
  const ageBit = Number(permutation.getState("solariscore:age_bit"));
@@ -4523,7 +4528,7 @@ var DurabilitySensorItemComponent = class {
4523
4528
  };
4524
4529
 
4525
4530
  // src/misc/DynamicDatabase.ts
4526
- import { Entity as Entity3, system as system4, World as World2 } from "@minecraft/server";
4531
+ import { Entity as Entity4, system as system5, World as World2 } from "@minecraft/server";
4527
4532
  var DynamicDatabase = class _DynamicDatabase {
4528
4533
  constructor(provider, dataId) {
4529
4534
  this.provider = provider;
@@ -4536,7 +4541,7 @@ var DynamicDatabase = class _DynamicDatabase {
4536
4541
  isSaving = false;
4537
4542
  lastSerializedData;
4538
4543
  static getInstance(provider, dataId) {
4539
- if (provider instanceof Entity3 && !provider.isValid) {
4544
+ if (provider instanceof Entity4 && !provider.isValid) {
4540
4545
  return void 0;
4541
4546
  }
4542
4547
  if (!this.instances.has(provider)) {
@@ -4603,7 +4608,7 @@ var DynamicDatabase = class _DynamicDatabase {
4603
4608
  saveOnNextTick() {
4604
4609
  if (!this.isSaving) {
4605
4610
  this.isSaving = true;
4606
- system4.runTimeout(() => {
4611
+ system5.runTimeout(() => {
4607
4612
  this.save();
4608
4613
  this.isSaving = false;
4609
4614
  }, 2);
@@ -4633,7 +4638,7 @@ var solarisCoreItemComponentClassMap = {
4633
4638
  };
4634
4639
  var SolarisCore = class {
4635
4640
  setEnabledBlockComponents(componentIds) {
4636
- system5.beforeEvents.startup.subscribe(({ blockComponentRegistry }) => {
4641
+ system6.beforeEvents.startup.subscribe(({ blockComponentRegistry }) => {
4637
4642
  for (const id of componentIds) {
4638
4643
  const ComponentClass = solarisCoreBlockComponentClassMap[id];
4639
4644
  if (!ComponentClass) continue;
@@ -4642,7 +4647,7 @@ var SolarisCore = class {
4642
4647
  });
4643
4648
  }
4644
4649
  setEnabledItemComponents(componentIds) {
4645
- system5.beforeEvents.startup.subscribe(({ itemComponentRegistry }) => {
4650
+ system6.beforeEvents.startup.subscribe(({ itemComponentRegistry }) => {
4646
4651
  for (const id of componentIds) {
4647
4652
  const ComponentClass = solarisCoreItemComponentClassMap[id];
4648
4653
  if (!ComponentClass) continue;
@@ -1 +1,2 @@
1
+ export {};
1
2
  //# sourceMappingURL=groupCommands.d.ts.map
@@ -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,EAA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":3,"file":"EntityUtil.d.ts","sourceRoot":"","sources":["../../src/utils/EntityUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAIrE,qBAAa,UAAU;IACnB,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,GAAE,OAAe;IAIzG,MAAM,CAAC,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;IAIzG,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.2",
3
+ "version": "2.6.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",