@orusteam/solariscore 2.5.15 → 2.6.1

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,9 +1,8 @@
1
- import { BlockComponentPlayerBreakEvent, BlockComponentPlayerInteractEvent, BlockComponentPlayerPlaceBeforeEvent, BlockComponentRedstoneUpdateEvent, BlockCustomComponent } from "@minecraft/server";
1
+ import { BlockComponentPlayerInteractEvent, BlockComponentPlayerPlaceBeforeEvent, BlockComponentRedstoneUpdateEvent, BlockCustomComponent } from "@minecraft/server";
2
2
  export declare class DoorBlockComponent implements BlockCustomComponent {
3
3
  constructor();
4
4
  beforeOnPlayerPlace(event: BlockComponentPlayerPlaceBeforeEvent): void;
5
5
  onRedstoneUpdate({ block, powerLevel }: BlockComponentRedstoneUpdateEvent): void;
6
- onPlayerBreak({ block, brokenBlockPermutation }: BlockComponentPlayerBreakEvent): void;
7
6
  onPlayerInteract({ block }: BlockComponentPlayerInteractEvent): void;
8
7
  }
9
8
  //# sourceMappingURL=DoorBlockComponent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DoorBlockComponent.d.ts","sourceRoot":"","sources":["../../../src/block/components/DoorBlockComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,8BAA8B,EAAE,iCAAiC,EAAE,oCAAoC,EAAE,iCAAiC,EAAE,oBAAoB,EAA4B,MAAM,mBAAmB,CAAC;AA4BtO,qBAAa,kBAAmB,YAAW,oBAAoB;;IAQ3D,mBAAmB,CAAC,KAAK,EAAE,oCAAoC;IA2D/D,gBAAgB,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,iCAAiC;IAOzE,aAAa,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,EAAE,8BAA8B;IAQ/E,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;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"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- import { system as system6 } from "@minecraft/server";
2
+ import { system as system5 } from "@minecraft/server";
3
3
 
4
4
  // node_modules/@minecraft/math/lib/src/general/clamp.js
5
5
  function clampNumber(val, min, max) {
@@ -4187,27 +4187,21 @@ var CropBlockComponent = class {
4187
4187
  };
4188
4188
 
4189
4189
  // src/block/components/DoorBlockComponent.ts
4190
- import { BlockPermutation, system as system3 } from "@minecraft/server";
4190
+ import { BlockPermutation } from "@minecraft/server";
4191
4191
  function doorIsOpen(block) {
4192
4192
  const allStates = block.permutation.getAllStates();
4193
4193
  return Boolean(allStates["solariscore:open_bit"]);
4194
4194
  }
4195
4195
  function tryToggleDoor(block) {
4196
4196
  const allStates = block.permutation.getAllStates();
4197
- const isUpper = allStates["solariscore:upper_block_bit"];
4198
4197
  const isOpen = allStates["solariscore:open_bit"];
4199
- const otherPart = isUpper ? block.below() : block.above();
4200
- if (otherPart?.typeId === block.typeId) {
4201
- block.setPermutation(block.permutation.withState("solariscore:open_bit", !isOpen));
4202
- otherPart.setPermutation(otherPart.permutation.withState("solariscore:open_bit", !isOpen));
4203
- const interactSoundId = isOpen ? "close.wooden_door" : "open.wooden_door";
4204
- block.dimension.playSound(interactSoundId, block.location);
4205
- }
4198
+ 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);
4206
4201
  }
4207
4202
  var DoorBlockComponent = class {
4208
4203
  constructor() {
4209
4204
  this.beforeOnPlayerPlace = this.beforeOnPlayerPlace.bind(this);
4210
- this.onPlayerBreak = this.onPlayerBreak.bind(this);
4211
4205
  this.onPlayerInteract = this.onPlayerInteract.bind(this);
4212
4206
  this.onRedstoneUpdate = this.onRedstoneUpdate.bind(this);
4213
4207
  }
@@ -4215,14 +4209,13 @@ var DoorBlockComponent = class {
4215
4209
  const { block, permutationToPlace } = event;
4216
4210
  const allStates = permutationToPlace.getAllStates();
4217
4211
  const cardinalDirection = allStates["minecraft:cardinal_direction"];
4218
- const aboveBlock = block.above();
4219
4212
  const eastBlock = block.east();
4220
4213
  const northBlock = block.north();
4221
4214
  const southBlock = block.south();
4222
4215
  const westBlock = block.west();
4223
4216
  const getSolidBlocksCount = (leftBlock2, rightBlock2) => ({
4224
- left: [!leftBlock2.isAir, !leftBlock2?.above()?.isAir].filter(Boolean).length,
4225
- right: [!rightBlock2.isAir, !rightBlock2?.above()?.isAir].filter(Boolean).length
4217
+ left: [!leftBlock2?.isAir, !leftBlock2?.above()?.isAir].filter(Boolean).length,
4218
+ right: [!rightBlock2?.isAir, !rightBlock2?.above()?.isAir].filter(Boolean).length
4226
4219
  });
4227
4220
  let leftBlock;
4228
4221
  let rightBlock;
@@ -4250,18 +4243,7 @@ var DoorBlockComponent = class {
4250
4243
  allStates["solariscore:door_hinge_bit"] = true;
4251
4244
  }
4252
4245
  }
4253
- if (!block.below()?.isAir && block.typeId === aboveBlock?.typeId) {
4254
- const upperBlockStates = { ...allStates };
4255
- upperBlockStates["solariscore:upper_block_bit"] = true;
4256
- const upperBlockPermutation = BlockPermutation.resolve(permutationToPlace.type.id, upperBlockStates);
4257
- event.permutationToPlace = BlockPermutation.resolve(permutationToPlace.type.id, allStates);
4258
- system3.run(() => {
4259
- aboveBlock.setType(permutationToPlace.type.id);
4260
- aboveBlock.setPermutation(upperBlockPermutation);
4261
- });
4262
- } else {
4263
- event.cancel = true;
4264
- }
4246
+ event.permutationToPlace = BlockPermutation.resolve(permutationToPlace.type.id, allStates);
4265
4247
  }
4266
4248
  onRedstoneUpdate({ block, powerLevel }) {
4267
4249
  const isOpen = doorIsOpen(block);
@@ -4269,20 +4251,13 @@ var DoorBlockComponent = class {
4269
4251
  tryToggleDoor(block);
4270
4252
  }
4271
4253
  }
4272
- onPlayerBreak({ block, brokenBlockPermutation }) {
4273
- const isUpper = brokenBlockPermutation.getState("solariscore:upper_block_bit");
4274
- const otherPart = isUpper ? block.below() : block.above();
4275
- if (otherPart?.typeId === brokenBlockPermutation.type.id) {
4276
- otherPart.setType("minecraft:air");
4277
- }
4278
- }
4279
4254
  onPlayerInteract({ block }) {
4280
4255
  tryToggleDoor(block);
4281
4256
  }
4282
4257
  };
4283
4258
 
4284
4259
  // src/block/components/EggBlockComponent.ts
4285
- import { EquipmentSlot as EquipmentSlot3, GameMode as GameMode3, system as system4, world as world2 } from "@minecraft/server";
4260
+ import { EquipmentSlot as EquipmentSlot3, GameMode as GameMode3, system as system3, world as world2 } from "@minecraft/server";
4286
4261
  var FALL_BREAK_CHANCE = 1 / 3;
4287
4262
  var STEP_BREAK_CHANCE = 1 / 100;
4288
4263
  function canCrack(block, eggBlockParams) {
@@ -4327,7 +4302,7 @@ var EggBlockComponent = class {
4327
4302
  const bellowBlock = block.below();
4328
4303
  if (bellowBlock?.typeId === nest_block) {
4329
4304
  const location = block.center();
4330
- system4.run(() => block.dimension.spawnParticle("minecraft:crop_growth_emitter", location));
4305
+ system3.run(() => block.dimension.spawnParticle("minecraft:crop_growth_emitter", location));
4331
4306
  }
4332
4307
  }
4333
4308
  }
@@ -4548,7 +4523,7 @@ var DurabilitySensorItemComponent = class {
4548
4523
  };
4549
4524
 
4550
4525
  // src/misc/DynamicDatabase.ts
4551
- import { Entity as Entity3, system as system5, World as World2 } from "@minecraft/server";
4526
+ import { Entity as Entity3, system as system4, World as World2 } from "@minecraft/server";
4552
4527
  var DynamicDatabase = class _DynamicDatabase {
4553
4528
  constructor(provider, dataId) {
4554
4529
  this.provider = provider;
@@ -4628,7 +4603,7 @@ var DynamicDatabase = class _DynamicDatabase {
4628
4603
  saveOnNextTick() {
4629
4604
  if (!this.isSaving) {
4630
4605
  this.isSaving = true;
4631
- system5.runTimeout(() => {
4606
+ system4.runTimeout(() => {
4632
4607
  this.save();
4633
4608
  this.isSaving = false;
4634
4609
  }, 2);
@@ -4658,7 +4633,7 @@ var solarisCoreItemComponentClassMap = {
4658
4633
  };
4659
4634
  var SolarisCore = class {
4660
4635
  setEnabledBlockComponents(componentIds) {
4661
- system6.beforeEvents.startup.subscribe(({ blockComponentRegistry }) => {
4636
+ system5.beforeEvents.startup.subscribe(({ blockComponentRegistry }) => {
4662
4637
  for (const id of componentIds) {
4663
4638
  const ComponentClass = solarisCoreBlockComponentClassMap[id];
4664
4639
  if (!ComponentClass) continue;
@@ -4667,7 +4642,7 @@ var SolarisCore = class {
4667
4642
  });
4668
4643
  }
4669
4644
  setEnabledItemComponents(componentIds) {
4670
- system6.beforeEvents.startup.subscribe(({ itemComponentRegistry }) => {
4645
+ system5.beforeEvents.startup.subscribe(({ itemComponentRegistry }) => {
4671
4646
  for (const id of componentIds) {
4672
4647
  const ComponentClass = solarisCoreItemComponentClassMap[id];
4673
4648
  if (!ComponentClass) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orusteam/solariscore",
3
- "version": "2.5.15",
3
+ "version": "2.6.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",