@orusteam/solariscore 2.5.8 → 2.5.10
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/block/components/GrassBlockComponent.d.ts +6 -0
- package/dist/block/components/GrassBlockComponent.d.ts.map +1 -0
- package/dist/block/components/index.d.ts +1 -1
- package/dist/block/components/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -24
- package/dist/registry/BlockComponentRegistry.d.ts +2 -0
- package/dist/registry/BlockComponentRegistry.d.ts.map +1 -0
- package/dist/registry/index.d.ts +2 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BlockComponentRandomTickEvent, BlockCustomComponent, CustomComponentParameters } from "@minecraft/server";
|
|
2
|
+
export declare class GrassBlockComponent implements BlockCustomComponent {
|
|
3
|
+
constructor();
|
|
4
|
+
onRandomTick({ block }: BlockComponentRandomTickEvent, { params }: CustomComponentParameters): void;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=GrassBlockComponent.d.ts.map
|
|
@@ -0,0 +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,7 +1,7 @@
|
|
|
1
1
|
export * from "./CropBlockComponent";
|
|
2
2
|
export * from "./DoorBlockComponent";
|
|
3
3
|
export * from "./EggBlockComponent";
|
|
4
|
-
export * from "./
|
|
4
|
+
export * from "./GrassBlockComponent";
|
|
5
5
|
export * from "./LeavesBlockComponent";
|
|
6
6
|
export * from "./ParticleEmitterBlockComponent";
|
|
7
7
|
export * from "./SaplingBlockComponent";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/block/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/block/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC;AACxB,OAAO,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4119,7 +4119,7 @@ function applyGrowthEffects(block) {
|
|
|
4119
4119
|
}
|
|
4120
4120
|
function setGrowthStage(block, value, maxStage) {
|
|
4121
4121
|
const newGrowthStage = clampNumber(value, 0, maxStage);
|
|
4122
|
-
const newPermutation = block.permutation.withState("
|
|
4122
|
+
const newPermutation = block.permutation.withState("solariscore:growth", newGrowthStage);
|
|
4123
4123
|
block.setPermutation(newPermutation);
|
|
4124
4124
|
}
|
|
4125
4125
|
function forceGrowth(block, growthStage, maxStage) {
|
|
@@ -4136,7 +4136,7 @@ var CropBlockComponent = class {
|
|
|
4136
4136
|
if (!mainhand) return;
|
|
4137
4137
|
const { permutation } = block;
|
|
4138
4138
|
const { accumulable, bone_meal_multiplication, max_stage } = params;
|
|
4139
|
-
const growthStage = Number(permutation.getState("
|
|
4139
|
+
const growthStage = Number(permutation.getState("solariscore:growth"));
|
|
4140
4140
|
const location = block.center();
|
|
4141
4141
|
const { typeId } = mainhand;
|
|
4142
4142
|
if (accumulable && typeId === block.typeId && growthStage < max_stage) {
|
|
@@ -4169,7 +4169,7 @@ var CropBlockComponent = class {
|
|
|
4169
4169
|
const { natural_growth } = params;
|
|
4170
4170
|
if (natural_growth) {
|
|
4171
4171
|
const { permutation } = block;
|
|
4172
|
-
const growthStage = Number(permutation.getState("
|
|
4172
|
+
const growthStage = Number(permutation.getState("solariscore:growth"));
|
|
4173
4173
|
const { max_stage } = params;
|
|
4174
4174
|
setGrowthStage(block, growthStage + 1, max_stage);
|
|
4175
4175
|
}
|
|
@@ -4180,16 +4180,16 @@ var CropBlockComponent = class {
|
|
|
4180
4180
|
import { BlockPermutation, system as system3 } from "@minecraft/server";
|
|
4181
4181
|
function doorIsOpen(block) {
|
|
4182
4182
|
const allStates = block.permutation.getAllStates();
|
|
4183
|
-
return Boolean(allStates["
|
|
4183
|
+
return Boolean(allStates["solariscore:open_bit"]);
|
|
4184
4184
|
}
|
|
4185
4185
|
function tryToggleDoor(block) {
|
|
4186
4186
|
const allStates = block.permutation.getAllStates();
|
|
4187
|
-
const isUpper = allStates["
|
|
4188
|
-
const isOpen = allStates["
|
|
4187
|
+
const isUpper = allStates["solariscore:upper_block_bit"];
|
|
4188
|
+
const isOpen = allStates["solariscore:open_bit"];
|
|
4189
4189
|
const otherPart = isUpper ? block.below() : block.above();
|
|
4190
4190
|
if (otherPart?.typeId === block.typeId) {
|
|
4191
|
-
block.setPermutation(block.permutation.withState("
|
|
4192
|
-
otherPart.setPermutation(otherPart.permutation.withState("
|
|
4191
|
+
block.setPermutation(block.permutation.withState("solariscore:open_bit", !isOpen));
|
|
4192
|
+
otherPart.setPermutation(otherPart.permutation.withState("solariscore:open_bit", !isOpen));
|
|
4193
4193
|
const interactSoundId = isOpen ? "close.wooden_door" : "open.wooden_door";
|
|
4194
4194
|
block.dimension.playSound(interactSoundId, block.location);
|
|
4195
4195
|
}
|
|
@@ -4237,12 +4237,12 @@ var DoorBlockComponent = class {
|
|
|
4237
4237
|
if (leftBlock && rightBlock) {
|
|
4238
4238
|
const { left, right } = getSolidBlocksCount(leftBlock, rightBlock);
|
|
4239
4239
|
if (left > right || rightBlock?.typeId === permutationToPlace.type.id) {
|
|
4240
|
-
allStates["
|
|
4240
|
+
allStates["solariscore:door_hinge_bit"] = true;
|
|
4241
4241
|
}
|
|
4242
4242
|
}
|
|
4243
4243
|
if (!block.below()?.isAir && block.typeId === aboveBlock?.typeId) {
|
|
4244
4244
|
const upperBlockStates = { ...allStates };
|
|
4245
|
-
upperBlockStates["
|
|
4245
|
+
upperBlockStates["solariscore:upper_block_bit"] = true;
|
|
4246
4246
|
const upperBlockPermutation = BlockPermutation.resolve(permutationToPlace.type.id, upperBlockStates);
|
|
4247
4247
|
event.permutationToPlace = BlockPermutation.resolve(permutationToPlace.type.id, allStates);
|
|
4248
4248
|
system3.run(() => {
|
|
@@ -4260,7 +4260,7 @@ var DoorBlockComponent = class {
|
|
|
4260
4260
|
}
|
|
4261
4261
|
}
|
|
4262
4262
|
onPlayerBreak({ block, brokenBlockPermutation }) {
|
|
4263
|
-
const isUpper = brokenBlockPermutation.getState("
|
|
4263
|
+
const isUpper = brokenBlockPermutation.getState("solariscore:upper_block_bit");
|
|
4264
4264
|
const otherPart = isUpper ? block.below() : block.above();
|
|
4265
4265
|
if (otherPart?.typeId === brokenBlockPermutation.type.id) {
|
|
4266
4266
|
otherPart.setType("minecraft:air");
|
|
@@ -4292,12 +4292,12 @@ function tryBreakEgg(block, eggBlockParams) {
|
|
|
4292
4292
|
if (eggBlockParams.sensitive) {
|
|
4293
4293
|
const { permutation } = block;
|
|
4294
4294
|
const location = block.center();
|
|
4295
|
-
const eggCount = Number(permutation.getState("
|
|
4295
|
+
const eggCount = Number(permutation.getState("solariscore:egg_count"));
|
|
4296
4296
|
if (eggCount <= 0) {
|
|
4297
4297
|
block.dimension.runCommand(`setblock ${location.x} ${location.y} ${location.z} air [] destroy`);
|
|
4298
4298
|
return;
|
|
4299
4299
|
}
|
|
4300
|
-
const newPermutation = permutation.withState("
|
|
4300
|
+
const newPermutation = permutation.withState("solariscore:egg_count", eggCount - 1);
|
|
4301
4301
|
block.setPermutation(newPermutation);
|
|
4302
4302
|
block.dimension.playSound(eggBlockParams.break_sound ?? "dig.stone", location);
|
|
4303
4303
|
}
|
|
@@ -4332,7 +4332,7 @@ var EggBlockComponent = class {
|
|
|
4332
4332
|
onPlayerBreak({ block, brokenBlockPermutation, player }) {
|
|
4333
4333
|
if (player && player.getGameMode() === GameMode3.Survival) {
|
|
4334
4334
|
const location = block.center();
|
|
4335
|
-
const eggCount = Number(brokenBlockPermutation.getState("
|
|
4335
|
+
const eggCount = Number(brokenBlockPermutation.getState("solariscore:egg_count"));
|
|
4336
4336
|
const mainHand = EntityUtil.getEquippedItem(player, EquipmentSlot3.Mainhand);
|
|
4337
4337
|
const items = [];
|
|
4338
4338
|
for (let i = 0; i < eggCount; i++) {
|
|
@@ -4352,11 +4352,11 @@ var EggBlockComponent = class {
|
|
|
4352
4352
|
if (mainHand?.typeId === block.typeId) {
|
|
4353
4353
|
const { add_egg_sound, max_eggs_per_block } = params;
|
|
4354
4354
|
const { permutation } = block;
|
|
4355
|
-
let eggCount = Number(permutation.getState("
|
|
4355
|
+
let eggCount = Number(permutation.getState("solariscore:egg_count"));
|
|
4356
4356
|
if (++eggCount >= (max_eggs_per_block ?? 1)) {
|
|
4357
4357
|
return;
|
|
4358
4358
|
}
|
|
4359
|
-
const newPermutation = permutation.withState("
|
|
4359
|
+
const newPermutation = permutation.withState("solariscore:egg_count", eggCount);
|
|
4360
4360
|
const location = block.center();
|
|
4361
4361
|
block.setPermutation(newPermutation);
|
|
4362
4362
|
dimension.playSound(add_egg_sound ?? "dig.stone", location);
|
|
@@ -4370,9 +4370,9 @@ var EggBlockComponent = class {
|
|
|
4370
4370
|
if (canCrack(block, eggBlockParams)) {
|
|
4371
4371
|
const { permutation } = block;
|
|
4372
4372
|
const location = block.center();
|
|
4373
|
-
const crackedState = String(permutation.getState("
|
|
4373
|
+
const crackedState = String(permutation.getState("solariscore:cracked_state"));
|
|
4374
4374
|
if (crackedState === "max_cracked") {
|
|
4375
|
-
const eggCount = Number(permutation.getState("
|
|
4375
|
+
const eggCount = Number(permutation.getState("solariscore:egg_count"));
|
|
4376
4376
|
dimension.playSound(drop_sound ?? "", location);
|
|
4377
4377
|
dimension.runCommand(`setblock ${location.x} ${location.y} ${location.z} air [] destroy`);
|
|
4378
4378
|
for (let i = 0; i <= eggCount; i++) {
|
|
@@ -4380,7 +4380,7 @@ var EggBlockComponent = class {
|
|
|
4380
4380
|
}
|
|
4381
4381
|
return;
|
|
4382
4382
|
}
|
|
4383
|
-
const newPermutation = permutation.withState("
|
|
4383
|
+
const newPermutation = permutation.withState("solariscore:cracked_state", crackedState === "no_cracks" ? "cracked" : "max_cracked");
|
|
4384
4384
|
block.setPermutation(newPermutation);
|
|
4385
4385
|
dimension.playSound(crack_sound ?? "", location);
|
|
4386
4386
|
}
|
|
@@ -4395,7 +4395,7 @@ var EggBlockComponent = class {
|
|
|
4395
4395
|
}
|
|
4396
4396
|
};
|
|
4397
4397
|
|
|
4398
|
-
// src/block/components/
|
|
4398
|
+
// src/block/components/GrassBlockComponent.ts
|
|
4399
4399
|
var nearbyOffsets = [
|
|
4400
4400
|
new Vector3Builder(1, 0, 0),
|
|
4401
4401
|
new Vector3Builder(-1, 0, 0),
|
|
@@ -4498,7 +4498,7 @@ var SaplingBlockComponent = class {
|
|
|
4498
4498
|
const mainhand = EntityUtil.getEquippedItem(player, EquipmentSlot4.Mainhand);
|
|
4499
4499
|
if (!mainhand || mainhand.typeId !== "minecraft:bone_meal") return;
|
|
4500
4500
|
const { permutation } = block;
|
|
4501
|
-
const ageBit = Number(permutation.getState("
|
|
4501
|
+
const ageBit = Number(permutation.getState("solariscore:age_bit"));
|
|
4502
4502
|
applyGrowthEffects(block);
|
|
4503
4503
|
ItemUtil.decrementStack(player);
|
|
4504
4504
|
if (player.getGameMode() === GameMode4.Creative) {
|
|
@@ -4507,7 +4507,7 @@ var SaplingBlockComponent = class {
|
|
|
4507
4507
|
}
|
|
4508
4508
|
if (Math.random() < 0.45) {
|
|
4509
4509
|
const newAgeBit = Math.min(1, ageBit + 1);
|
|
4510
|
-
const newPermutation = permutation.withState("
|
|
4510
|
+
const newPermutation = permutation.withState("solariscore:age_bit", newAgeBit);
|
|
4511
4511
|
block.setPermutation(newPermutation);
|
|
4512
4512
|
if (newAgeBit === 1) {
|
|
4513
4513
|
tryPlaceFeature(block, params);
|
|
@@ -4517,11 +4517,11 @@ var SaplingBlockComponent = class {
|
|
|
4517
4517
|
}
|
|
4518
4518
|
onRandomTick({ block }, { params }) {
|
|
4519
4519
|
const { permutation } = block;
|
|
4520
|
-
const ageBit = Number(permutation.getState("
|
|
4520
|
+
const ageBit = Number(permutation.getState("solariscore:age_bit"));
|
|
4521
4521
|
if (ageBit === 1) {
|
|
4522
4522
|
tryPlaceFeature(block, params);
|
|
4523
4523
|
} else {
|
|
4524
|
-
const newPermutation = permutation.withState("
|
|
4524
|
+
const newPermutation = permutation.withState("solariscore:age_bit", ageBit + 1);
|
|
4525
4525
|
block.setPermutation(newPermutation);
|
|
4526
4526
|
}
|
|
4527
4527
|
}
|
|
@@ -4636,6 +4636,21 @@ function getDynamicDatabase(provider, dataId) {
|
|
|
4636
4636
|
}
|
|
4637
4637
|
throw new Error("Inst\xE2ncia de DynamicDatabase n\xE3o encontrada para o provedor fornecido.");
|
|
4638
4638
|
}
|
|
4639
|
+
|
|
4640
|
+
// src/registry/BlockComponentRegistry.ts
|
|
4641
|
+
import { system as system6 } from "@minecraft/server";
|
|
4642
|
+
function registryBlockComponents() {
|
|
4643
|
+
system6.beforeEvents.startup.subscribe(({ blockComponentRegistry }) => {
|
|
4644
|
+
blockComponentRegistry.registerCustomComponent("solariscore:crop", new CropBlockComponent());
|
|
4645
|
+
blockComponentRegistry.registerCustomComponent("solariscore:door", new DoorBlockComponent());
|
|
4646
|
+
blockComponentRegistry.registerCustomComponent("solariscore:egg", new EggBlockComponent());
|
|
4647
|
+
blockComponentRegistry.registerCustomComponent("solariscore:grass", new GrassBlockComponent());
|
|
4648
|
+
blockComponentRegistry.registerCustomComponent("solariscore:leaves", new LeavesBlockComponent());
|
|
4649
|
+
blockComponentRegistry.registerCustomComponent("solariscore:grass", new ParticleEmitterBlockComponent());
|
|
4650
|
+
blockComponentRegistry.registerCustomComponent("solariscore:grass", new SaplingBlockComponent());
|
|
4651
|
+
});
|
|
4652
|
+
}
|
|
4653
|
+
registryBlockComponents();
|
|
4639
4654
|
export {
|
|
4640
4655
|
BlockBuilder,
|
|
4641
4656
|
BlockUtil,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockComponentRegistry.d.ts","sourceRoot":"","sources":["../../src/registry/BlockComponentRegistry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAC"}
|