@orusteam/solariscore 2.6.3 → 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.
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { system as
|
|
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
|
|
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(
|
|
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
|
|
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(
|
|
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(
|
|
795
|
+
equippableComponent.setEquipment(EquipmentSlot2.Mainhand);
|
|
795
796
|
source.dimension.playSound("random.break", source.location);
|
|
796
797
|
} else {
|
|
797
|
-
equippableComponent.setEquipment(
|
|
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
|
|
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
|
|
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,
|
|
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
|
|
4163
|
+
dimension.spawnItem(new ItemStack3(block.typeId), location);
|
|
4163
4164
|
ItemUtil.decrementStack(player);
|
|
4164
4165
|
applyGrowthEffects(block);
|
|
4165
4166
|
return;
|
|
@@ -4261,7 +4262,7 @@ var DoorBlockComponent = class {
|
|
|
4261
4262
|
};
|
|
4262
4263
|
|
|
4263
4264
|
// src/block/components/EggBlockComponent.ts
|
|
4264
|
-
import { EquipmentSlot as
|
|
4265
|
+
import { EquipmentSlot as EquipmentSlot4, GameMode as GameMode3, system as system4, world as world2 } from "@minecraft/server";
|
|
4265
4266
|
var FALL_BREAK_CHANCE = 1 / 3;
|
|
4266
4267
|
var STEP_BREAK_CHANCE = 1 / 100;
|
|
4267
4268
|
function canCrack(block, eggBlockParams) {
|
|
@@ -4306,7 +4307,7 @@ var EggBlockComponent = class {
|
|
|
4306
4307
|
const bellowBlock = block.below();
|
|
4307
4308
|
if (bellowBlock?.typeId === nest_block) {
|
|
4308
4309
|
const location = block.center();
|
|
4309
|
-
|
|
4310
|
+
system4.run(() => block.dimension.spawnParticle("minecraft:crop_growth_emitter", location));
|
|
4310
4311
|
}
|
|
4311
4312
|
}
|
|
4312
4313
|
}
|
|
@@ -4322,7 +4323,7 @@ var EggBlockComponent = class {
|
|
|
4322
4323
|
if (player && player.getGameMode() === GameMode3.Survival) {
|
|
4323
4324
|
const location = block.center();
|
|
4324
4325
|
const eggCount = Number(brokenBlockPermutation.getState("solariscore:egg_count"));
|
|
4325
|
-
const mainHand = EntityUtil.getEquippedItem(player,
|
|
4326
|
+
const mainHand = EntityUtil.getEquippedItem(player, EquipmentSlot4.Mainhand);
|
|
4326
4327
|
const items = [];
|
|
4327
4328
|
for (let i = 0; i < eggCount; i++) {
|
|
4328
4329
|
const itemStack = world2.getLootTableManager().generateLootFromBlockPermutation(brokenBlockPermutation, mainHand);
|
|
@@ -4337,7 +4338,7 @@ var EggBlockComponent = class {
|
|
|
4337
4338
|
}
|
|
4338
4339
|
onPlayerInteract({ block, dimension, player }, { params }) {
|
|
4339
4340
|
if (player) {
|
|
4340
|
-
const mainHand = EntityUtil.getEquippedItem(player,
|
|
4341
|
+
const mainHand = EntityUtil.getEquippedItem(player, EquipmentSlot4.Mainhand);
|
|
4341
4342
|
if (mainHand?.typeId === block.typeId) {
|
|
4342
4343
|
const { add_egg_sound, max_eggs_per_block } = params;
|
|
4343
4344
|
const { permutation } = block;
|
|
@@ -4465,7 +4466,7 @@ var ParticleEmitterBlockComponent = class {
|
|
|
4465
4466
|
};
|
|
4466
4467
|
|
|
4467
4468
|
// src/block/components/SaplingBlockComponent.ts
|
|
4468
|
-
import { EquipmentSlot as
|
|
4469
|
+
import { EquipmentSlot as EquipmentSlot5, GameMode as GameMode4 } from "@minecraft/server";
|
|
4469
4470
|
function tryPlaceFeature(blockSapling, params) {
|
|
4470
4471
|
const { feature } = params;
|
|
4471
4472
|
const featurePlaced = blockSapling.dimension.placeFeature(feature, blockSapling.location);
|
|
@@ -4480,7 +4481,7 @@ var SaplingBlockComponent = class {
|
|
|
4480
4481
|
}
|
|
4481
4482
|
onPlayerInteract({ block, player }, { params }) {
|
|
4482
4483
|
if (player) {
|
|
4483
|
-
const mainhand = EntityUtil.getEquippedItem(player,
|
|
4484
|
+
const mainhand = EntityUtil.getEquippedItem(player, EquipmentSlot5.Mainhand);
|
|
4484
4485
|
if (!mainhand || mainhand.typeId !== "minecraft:bone_meal") return;
|
|
4485
4486
|
const { permutation } = block;
|
|
4486
4487
|
const ageBit = Number(permutation.getState("solariscore:age_bit"));
|
|
@@ -4527,7 +4528,7 @@ var DurabilitySensorItemComponent = class {
|
|
|
4527
4528
|
};
|
|
4528
4529
|
|
|
4529
4530
|
// src/misc/DynamicDatabase.ts
|
|
4530
|
-
import { Entity as
|
|
4531
|
+
import { Entity as Entity4, system as system5, World as World2 } from "@minecraft/server";
|
|
4531
4532
|
var DynamicDatabase = class _DynamicDatabase {
|
|
4532
4533
|
constructor(provider, dataId) {
|
|
4533
4534
|
this.provider = provider;
|
|
@@ -4540,7 +4541,7 @@ var DynamicDatabase = class _DynamicDatabase {
|
|
|
4540
4541
|
isSaving = false;
|
|
4541
4542
|
lastSerializedData;
|
|
4542
4543
|
static getInstance(provider, dataId) {
|
|
4543
|
-
if (provider instanceof
|
|
4544
|
+
if (provider instanceof Entity4 && !provider.isValid) {
|
|
4544
4545
|
return void 0;
|
|
4545
4546
|
}
|
|
4546
4547
|
if (!this.instances.has(provider)) {
|
|
@@ -4607,7 +4608,7 @@ var DynamicDatabase = class _DynamicDatabase {
|
|
|
4607
4608
|
saveOnNextTick() {
|
|
4608
4609
|
if (!this.isSaving) {
|
|
4609
4610
|
this.isSaving = true;
|
|
4610
|
-
|
|
4611
|
+
system5.runTimeout(() => {
|
|
4611
4612
|
this.save();
|
|
4612
4613
|
this.isSaving = false;
|
|
4613
4614
|
}, 2);
|
|
@@ -4637,7 +4638,7 @@ var solarisCoreItemComponentClassMap = {
|
|
|
4637
4638
|
};
|
|
4638
4639
|
var SolarisCore = class {
|
|
4639
4640
|
setEnabledBlockComponents(componentIds) {
|
|
4640
|
-
|
|
4641
|
+
system6.beforeEvents.startup.subscribe(({ blockComponentRegistry }) => {
|
|
4641
4642
|
for (const id of componentIds) {
|
|
4642
4643
|
const ComponentClass = solarisCoreBlockComponentClassMap[id];
|
|
4643
4644
|
if (!ComponentClass) continue;
|
|
@@ -4646,7 +4647,7 @@ var SolarisCore = class {
|
|
|
4646
4647
|
});
|
|
4647
4648
|
}
|
|
4648
4649
|
setEnabledItemComponents(componentIds) {
|
|
4649
|
-
|
|
4650
|
+
system6.beforeEvents.startup.subscribe(({ itemComponentRegistry }) => {
|
|
4650
4651
|
for (const id of componentIds) {
|
|
4651
4652
|
const ComponentClass = solarisCoreItemComponentClassMap[id];
|
|
4652
4653
|
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;
|
|
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,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM;IAKnE,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityUtil.d.ts","sourceRoot":"","sources":["../../src/utils/EntityUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,
|
|
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"}
|