sapdon 3.3.3 → 3.4.0
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/README.md +17 -7
- package/doc/dev/architecture.md +418 -415
- package/doc/dev/cli.md +467 -467
- package/doc/dev/core.md +751 -717
- package/doc/dev/lr-paradigm.md +85 -0
- package/doc/dev/workflow.md +257 -0
- package/doc/hello_sapdon/hello_sapdon.md +3 -3
- package/doc/user/api/block.md +599 -14
- package/doc/user/api/item.md +284 -55
- package/doc/user/api/neo-guidebook.md +409 -0
- package/doc/user/api/sapdon-ui.md +185 -0
- package/doc/user/config/build-config.md +4 -5
- package/doc/user/quick-start.md +20 -6
- package/doc/user/tutorials/block.md +12 -1
- package/doc/user/tutorials/item.md +3 -3
- package/doc/user/tutorials/neo-guidebook-experience.md +381 -0
- package/doc/user/tutorials/neo-guidebook.md +640 -0
- package/doc/user/tutorials/sapdon-ui.md +207 -0
- package/package.json +5 -1
- package/prod/cli/index.js +1 -1
- package/prod/cli/start.js +1 -1
- package/prod/core/index.d.ts +1557 -299
- package/prod/core/index.js +1 -1
- package/prod/oc/index.d.ts +3 -1
- package/prod/oc/index.js +1 -1
- package/prod/utils/index.d.ts +0 -7
- package/prod/utils/index.js +1 -1
package/prod/core/index.d.ts
CHANGED
|
@@ -248,7 +248,7 @@ declare class AddonAttachable {
|
|
|
248
248
|
format_version: string;
|
|
249
249
|
definitions: AddonAttachableDefinition;
|
|
250
250
|
constructor(format_version: string, definitions: AddonAttachableDefinition);
|
|
251
|
-
toObject(): Record<string,
|
|
251
|
+
toObject(): Record<string, unknown>;
|
|
252
252
|
}
|
|
253
253
|
declare class AddonAttachableDefinition {
|
|
254
254
|
description: AddonAttachableDescription;
|
|
@@ -262,8 +262,8 @@ declare class AddonAttachableDescription {
|
|
|
262
262
|
animations?: Record<string, string>;
|
|
263
263
|
animation_controllers?: Record<string, string>[];
|
|
264
264
|
render_controllers?: string[];
|
|
265
|
-
locators?: Record<string,
|
|
266
|
-
scripts?: Record<string,
|
|
265
|
+
locators?: Record<string, unknown>;
|
|
266
|
+
scripts?: Record<string, unknown>;
|
|
267
267
|
constructor(identifier: string);
|
|
268
268
|
addMaterial(name: string, material: string): this;
|
|
269
269
|
addTexture(name: string, texture: string): this;
|
|
@@ -271,25 +271,25 @@ declare class AddonAttachableDescription {
|
|
|
271
271
|
addAnimation(name: string, animation: string): this;
|
|
272
272
|
addAnimationController(name: string, controller: string): this;
|
|
273
273
|
addRenderController(controller: string): this;
|
|
274
|
-
addLocator(name: string, locator:
|
|
275
|
-
setScript(key: string, value:
|
|
274
|
+
addLocator(name: string, locator: unknown): this;
|
|
275
|
+
setScript(key: string, value: unknown): this;
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
declare class AddonItem {
|
|
279
279
|
format_version: string;
|
|
280
280
|
definitions: AddonItemDefinition;
|
|
281
281
|
constructor(format_version: string, definitions: AddonItemDefinition);
|
|
282
|
-
toObject(): Record<string,
|
|
282
|
+
toObject(): Record<string, unknown>;
|
|
283
283
|
}
|
|
284
284
|
declare class AddonItemDefinition {
|
|
285
285
|
description: AddonItemDescription;
|
|
286
|
-
components: Record<string,
|
|
287
|
-
constructor(description: AddonItemDescription, components: Record<string,
|
|
286
|
+
components: Record<string, unknown>;
|
|
287
|
+
constructor(description: AddonItemDescription, components: Record<string, unknown>);
|
|
288
288
|
}
|
|
289
289
|
declare class AddonItemDescription {
|
|
290
290
|
identifier: string;
|
|
291
|
-
menu_category:
|
|
292
|
-
constructor(identifier: string, menu_category:
|
|
291
|
+
menu_category: AddonMenuCategory;
|
|
292
|
+
constructor(identifier: string, menu_category: AddonMenuCategory);
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
declare class AddonRecipe {
|
|
@@ -455,9 +455,9 @@ declare class BasicBlock {
|
|
|
455
455
|
/**
|
|
456
456
|
* 添加方块变体
|
|
457
457
|
* @param {string} condition 变体条件
|
|
458
|
-
* @param {Map}
|
|
458
|
+
* @param {Map|Object} component 组件 Map 或普通对象
|
|
459
459
|
*/
|
|
460
|
-
addPermutation(condition: string,
|
|
460
|
+
addPermutation(condition: string, component: Map<any, any> | Object): this;
|
|
461
461
|
/**
|
|
462
462
|
* 将方块对象转换为 JSON 格式
|
|
463
463
|
* @returns {Object} JSON 格式的方块对象
|
|
@@ -497,38 +497,37 @@ declare class Block extends BasicBlock {
|
|
|
497
497
|
#private;
|
|
498
498
|
}
|
|
499
499
|
|
|
500
|
-
|
|
500
|
+
/** @template T */
|
|
501
|
+
declare class BlockComponent<T> {
|
|
501
502
|
/**
|
|
502
|
-
*
|
|
503
|
-
* @param {string}
|
|
504
|
-
* @param {
|
|
505
|
-
* @
|
|
503
|
+
* @param {string} texture - 纹理短名
|
|
504
|
+
* @param {Object|string} [options] - 可选参数对象,或旧版 tint_method 字符串
|
|
505
|
+
* @param {number} [options.particle_count] - 粒子数量 (0-255,默认 100)
|
|
506
|
+
* @param {string} [options.tint_method] - 染色方法(如 "grass")
|
|
507
|
+
* @returns {Map<string, any>}
|
|
506
508
|
*/
|
|
507
|
-
static setDestructionParticles(texture: string,
|
|
508
|
-
texture: string;
|
|
509
|
-
tint_method: string | null;
|
|
510
|
-
}>;
|
|
509
|
+
static setDestructionParticles(texture: string, options?: Object | string): Map<string, any>;
|
|
511
510
|
/**
|
|
512
511
|
* 自定义方块组件
|
|
513
512
|
* [warning] 需要 Scripting V2.0.0
|
|
514
513
|
* @param {string} component_id 组件标识符
|
|
515
514
|
* @param {object} params 自定义参数接口对象
|
|
516
|
-
* @returns {Map} 物品组件Map
|
|
515
|
+
* @returns {Map<string, any>} 物品组件Map
|
|
517
516
|
*/
|
|
518
|
-
static setCustomComponentV2(component_id: string, params: object): Map<
|
|
517
|
+
static setCustomComponentV2(component_id: string, params: object): Map<string, any>;
|
|
519
518
|
/**
|
|
520
519
|
*
|
|
521
520
|
* @param {Array} interval_range
|
|
522
521
|
* @param {boolean} looping
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
static setTick(interval_range: any[], looping: boolean): Map<
|
|
522
|
+
* @returns {Map<string, any>}
|
|
523
|
+
*/
|
|
524
|
+
static setTick(interval_range: any[], looping: boolean): Map<string, any>;
|
|
526
525
|
/**
|
|
527
526
|
*
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
static setCustomComponents(custom_components: any[]): Map<
|
|
527
|
+
* @param {Array} custom_components
|
|
528
|
+
* @returns {Map<string, any>}
|
|
529
|
+
*/
|
|
530
|
+
static setCustomComponents(custom_components: any[]): Map<string, any>;
|
|
532
531
|
/**
|
|
533
532
|
* 创建一个用于 Minecraft 方块的变换对象,并返回一个 Map。
|
|
534
533
|
* @param {number[]} [translation=[0, 0, 0]] - 平移向量 [x, y, z]。
|
|
@@ -536,177 +535,299 @@ declare class BlockComponent {
|
|
|
536
535
|
* @param {number[]} [scale_pivot=[0, 0, 0]] - 缩放的枢轴点 [x, y, z]。
|
|
537
536
|
* @param {number[]} [rotation=[0, 0, 0]] - 旋转向量(角度)[x, y, z]。
|
|
538
537
|
* @param {number[]} [rotation_pivot=[0, 0, 0]] - 旋转的枢轴点 [x, y, z]。
|
|
539
|
-
* @returns {Map} - 一个包含变换数据的 Map 对象。
|
|
538
|
+
* @returns {Map<string, any>} - 一个包含变换数据的 Map 对象。
|
|
540
539
|
* @throws {Error} - 如果任何参数无效,则抛出错误。
|
|
541
540
|
*/
|
|
542
|
-
static setTransformation(translation?: number[], scale?: number[], scale_pivot?: number[], rotation?: number[], rotation_pivot?: number[]): Map<
|
|
541
|
+
static setTransformation(translation?: number[], scale?: number[], scale_pivot?: number[], rotation?: number[], rotation_pivot?: number[]): Map<string, any>;
|
|
543
542
|
/**
|
|
544
543
|
* 设置方块的呼吸行为。
|
|
545
544
|
* @param {String} value - 呼吸行为,可选值为 "solid" 或 "air"。
|
|
546
|
-
* @returns {Map} - 新的组件集合。
|
|
545
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
547
546
|
*/
|
|
548
|
-
static setBreathability(value: string): Map<
|
|
547
|
+
static setBreathability(value: string): Map<string, any>;
|
|
549
548
|
/**
|
|
550
549
|
* 启用或禁用方块的碰撞箱。
|
|
551
550
|
* @param {Boolean} enabled - 是否启用碰撞箱。
|
|
552
|
-
* @returns {Map} - 新的组件集合。
|
|
551
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
553
552
|
*/
|
|
554
|
-
static setCollisionBoxEnabled(enabled: boolean): Map<
|
|
553
|
+
static setCollisionBoxEnabled(enabled: boolean): Map<string, any>;
|
|
555
554
|
/**
|
|
556
555
|
* 设置自定义的碰撞箱。
|
|
557
556
|
* @param {Array} origin - 碰撞箱的起点坐标 [x, y, z]。
|
|
558
557
|
* @param {Array} size - 碰撞箱的大小 [width, height, depth]。
|
|
559
|
-
* @returns {Map} - 新的组件集合。
|
|
558
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
560
559
|
*/
|
|
561
|
-
static setCollisionBoxCustom(origin: any[], size: any[]): Map<
|
|
560
|
+
static setCollisionBoxCustom(origin: any[], size: any[]): Map<string, any>;
|
|
562
561
|
/**
|
|
563
562
|
* 设置方块的合成台属性。
|
|
564
563
|
* @param {Array} craftingTags - 合成标签。
|
|
565
564
|
* @param {String} tableName - 合成台名称。
|
|
566
|
-
* @returns {Map} - 新的组件集合。
|
|
565
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
567
566
|
*/
|
|
568
|
-
static setCraftingTable(craftingTags: any[], tableName: string): Map<
|
|
567
|
+
static setCraftingTable(craftingTags: any[], tableName: string): Map<string, any>;
|
|
569
568
|
/**
|
|
570
569
|
* 启用或禁用方块的爆炸抗性。
|
|
571
570
|
* @param {Boolean} enabled - 是否启用爆炸抗性。
|
|
572
|
-
* @returns {Map} - 新的组件集合。
|
|
571
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
573
572
|
*/
|
|
574
|
-
static setDestructibleByExplosionEnabled(enabled: boolean): Map<
|
|
573
|
+
static setDestructibleByExplosionEnabled(enabled: boolean): Map<string, any>;
|
|
575
574
|
/**
|
|
576
575
|
* 设置自定义的爆炸抗性。
|
|
577
576
|
* @param {Number} explosionResistance - 爆炸抗性值。
|
|
578
|
-
* @returns {Map} - 新的组件集合。
|
|
577
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
579
578
|
*/
|
|
580
|
-
static setDestructibleByExplosionCustom(explosionResistance: number): Map<
|
|
579
|
+
static setDestructibleByExplosionCustom(explosionResistance: number): Map<string, any>;
|
|
581
580
|
/**
|
|
582
581
|
* 启用或禁用方块的挖掘抗性。
|
|
583
582
|
* @param {Boolean} enabled - 是否启用挖掘抗性。
|
|
584
|
-
* @returns {Map} - 新的组件集合。
|
|
583
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
585
584
|
*/
|
|
586
|
-
static setDestructibleByMiningEnabled(enabled: boolean): Map<
|
|
585
|
+
static setDestructibleByMiningEnabled(enabled: boolean): Map<string, any>;
|
|
587
586
|
/**
|
|
588
587
|
* 设置自定义的挖掘抗性。
|
|
589
588
|
* @param {Number} secondsToDestroy - 破坏所需时间(秒)。
|
|
590
589
|
* @param {Array} itemSpecificSpeeds - 特定工具的挖掘速度。
|
|
591
|
-
* @returns {Map} - 新的组件集合。
|
|
590
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
592
591
|
*/
|
|
593
|
-
static setDestructibleByMiningCustom(secondsToDestroy: number, itemSpecificSpeeds: any[]): Map<
|
|
592
|
+
static setDestructibleByMiningCustom(secondsToDestroy: number, itemSpecificSpeeds: any[]): Map<string, any>;
|
|
594
593
|
/**
|
|
595
594
|
* 设置方块的显示名称。
|
|
596
595
|
* @param {String} displayName - 显示名称。
|
|
597
|
-
* @returns {Map} - 新的组件集合。
|
|
596
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
598
597
|
*/
|
|
599
|
-
static setDisplayName(displayName: string): Map<
|
|
598
|
+
static setDisplayName(displayName: string): Map<string, any>;
|
|
600
599
|
/**
|
|
601
600
|
* 启用或禁用方块的易燃性。
|
|
602
601
|
* @param {Boolean} enabled - 是否启用易燃性。
|
|
603
|
-
* @returns {Map} - 新的组件集合。
|
|
602
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
604
603
|
*/
|
|
605
|
-
static setFlammableEnabled(enabled: boolean): Map<
|
|
604
|
+
static setFlammableEnabled(enabled: boolean): Map<string, any>;
|
|
606
605
|
/**
|
|
607
606
|
* 设置自定义的易燃性。
|
|
608
607
|
* @param {Number} catchChanceModifier - 着火概率。
|
|
609
608
|
* @param {Number} destroyChanceModifier - 被火焰摧毁的概率。
|
|
610
|
-
* @
|
|
609
|
+
* @param {String} [lava_flammable] - 岩浆能否点燃该方块 ("always"|"never",默认 "never")
|
|
610
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
611
611
|
*/
|
|
612
|
-
static setFlammableCustom(catchChanceModifier: number, destroyChanceModifier: number): Map<
|
|
612
|
+
static setFlammableCustom(catchChanceModifier: number, destroyChanceModifier: number, lava_flammable?: string): Map<string, any>;
|
|
613
613
|
/**
|
|
614
614
|
* 设置方块的摩擦力。
|
|
615
615
|
* @param {Number} value - 摩擦力值,范围为 0.0 到 0.9。
|
|
616
|
-
* @returns {Map} - 新的组件集合。
|
|
616
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
617
617
|
*/
|
|
618
|
-
static setFriction(value: number): Map<
|
|
618
|
+
static setFriction(value: number): Map<string, any>;
|
|
619
619
|
/**
|
|
620
620
|
* 设置方块的几何模型。
|
|
621
621
|
* @param {String} identifier - 几何模型标识符。
|
|
622
|
-
* @param {Object}
|
|
623
|
-
* @
|
|
624
|
-
|
|
625
|
-
|
|
622
|
+
* @param {Object} [options] - 可选参数。
|
|
623
|
+
* @param {Object} [options.bone_visibility] - 骨骼可见性配置。
|
|
624
|
+
* @param {String} [options.culling] - 裁剪规则标识符(格式: <namespace>:culling.<name>)。
|
|
625
|
+
* @param {String} [options.culling_layer] - 裁剪层标识符(如 "minecraft:culling_layer.leaves")。
|
|
626
|
+
* @param {String} [options.culling_shape] - 体素形状(仅支持 "minecraft:unit_cube")。
|
|
627
|
+
* @param {Boolean|String[]} [options.uv_lock] - 是否锁定 UV 旋转,或指定骨骼名称数组。
|
|
628
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
629
|
+
*/
|
|
630
|
+
static setGeometry(identifier: string, options?: {
|
|
631
|
+
bone_visibility?: Object | undefined;
|
|
632
|
+
culling?: string | undefined;
|
|
633
|
+
culling_layer?: string | undefined;
|
|
634
|
+
culling_shape?: string | undefined;
|
|
635
|
+
uv_lock?: boolean | string[] | undefined;
|
|
636
|
+
}): Map<string, any>;
|
|
626
637
|
/**
|
|
627
638
|
* 设置方块的骨骼可见性。
|
|
628
639
|
* @param {Object} bone_visibility - 骨骼可见性配置。
|
|
629
|
-
* @returns {Map} - 新的组件集合。
|
|
640
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
630
641
|
*/
|
|
631
|
-
static setBoneVisibility(bone_visibility: Object): Map<
|
|
642
|
+
static setBoneVisibility(bone_visibility: Object): Map<string, any>;
|
|
632
643
|
/**
|
|
633
644
|
* 设置方块的物品视觉属性。
|
|
634
645
|
* @param {String} geometry - 几何模型标识符。
|
|
635
646
|
* @param {Object} materialInstances - 材质实例配置。
|
|
636
|
-
* @returns {Map} - 新的组件集合。
|
|
647
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
637
648
|
*/
|
|
638
|
-
static setItemVisual(geometry: string, materialInstances: Object): Map<
|
|
649
|
+
static setItemVisual(geometry: string, materialInstances: Object): Map<string, any>;
|
|
639
650
|
/**
|
|
640
651
|
* 设置方块的光衰减值。
|
|
641
652
|
* @param {Number} value - 光的衰减值,范围为 0 到 15。
|
|
642
|
-
* @returns {Map} - 新的组件集合。
|
|
653
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
643
654
|
*/
|
|
644
|
-
static setLightDampening(value: number): Map<
|
|
655
|
+
static setLightDampening(value: number): Map<string, any>;
|
|
645
656
|
/**
|
|
646
657
|
* 设置方块的光照强度。
|
|
647
658
|
* @param {Number} value - 光照强度,范围为 0 到 15。
|
|
648
|
-
* @returns {Map} - 新的组件集合。
|
|
659
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
649
660
|
*/
|
|
650
|
-
static setLightEmission(value: number): Map<
|
|
661
|
+
static setLightEmission(value: number): Map<string, any>;
|
|
651
662
|
/**
|
|
652
663
|
* 设置方块的液体检测属性。
|
|
653
|
-
* @param {Boolean} canContainLiquid -
|
|
654
|
-
* @param {String} liquidType -
|
|
655
|
-
* @param {String} onLiquidTouches -
|
|
656
|
-
* @param {Array} stopsLiquidFlowingFromDirection -
|
|
657
|
-
* @returns {Map} - 新的组件集合。
|
|
664
|
+
* @param {Boolean|Object} canContainLiquid - 是否可容纳液体,或是完整选项对象
|
|
665
|
+
* @param {String} [liquidType] - 液体类型
|
|
666
|
+
* @param {String} [onLiquidTouches] - 对液体的反应方式
|
|
667
|
+
* @param {Array} [stopsLiquidFlowingFromDirection] - 阻止液体流动的方向
|
|
668
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
658
669
|
*/
|
|
659
|
-
static setLiquidDetection(canContainLiquid: boolean, liquidType
|
|
670
|
+
static setLiquidDetection(canContainLiquid: boolean | Object, liquidType?: string, onLiquidTouches?: string, stopsLiquidFlowingFromDirection?: any[]): Map<string, any>;
|
|
660
671
|
/**
|
|
661
672
|
* 设置方块的战利品表路径。
|
|
662
673
|
* @param {String} path - 战利品表路径。
|
|
663
|
-
* @returns {Map} - 新的组件集合。
|
|
674
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
664
675
|
*/
|
|
665
|
-
static setLoot(path: string): Map<
|
|
676
|
+
static setLoot(path: string): Map<string, any>;
|
|
666
677
|
/**
|
|
667
678
|
* 设置方块的地图颜色。
|
|
668
|
-
* @param {String|Array} value -
|
|
669
|
-
* @returns {Map} - 新的组件集合。
|
|
679
|
+
* @param {String|Array|Object} value - 地图颜色,可以是十六进制字符串、RGB 数组或对象格式。
|
|
680
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
670
681
|
*/
|
|
671
|
-
static setMapColor(value: string | any[]): Map<
|
|
682
|
+
static setMapColor(value: string | any[] | Object): Map<string, any>;
|
|
672
683
|
/**
|
|
673
684
|
* 设置方块的材质实例。
|
|
674
685
|
* @param {Object} instances - 材质实例配置。
|
|
675
|
-
* @returns {Map} - 新的组件集合。
|
|
686
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
676
687
|
*/
|
|
677
|
-
static setMaterialInstances(instances: Object): Map<
|
|
688
|
+
static setMaterialInstances(instances: Object): Map<string, any>;
|
|
678
689
|
/**
|
|
679
690
|
* 设置方块的放置过滤条件。
|
|
680
691
|
* @param {Array} conditions - 放置条件列表。
|
|
681
|
-
* @returns {Map} - 新的组件集合。
|
|
692
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
682
693
|
*/
|
|
683
|
-
static setPlacementFilter(conditions: any[]): Map<
|
|
694
|
+
static setPlacementFilter(conditions: any[]): Map<string, any>;
|
|
684
695
|
/**
|
|
685
696
|
* 设置方块的红石导电性。
|
|
686
697
|
* @param {Boolean} allowsWireToStepDown - 是否允许红石线向下阶梯连接。
|
|
687
698
|
* @param {Boolean} redstoneConductor - 方块是否可以被红石信号激活。
|
|
688
|
-
* @returns {Map} - 新的组件集合。
|
|
699
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
689
700
|
*/
|
|
690
|
-
static setRedstoneConductivity(allowsWireToStepDown: boolean, redstoneConductor: boolean): Map<
|
|
701
|
+
static setRedstoneConductivity(allowsWireToStepDown: boolean, redstoneConductor: boolean): Map<string, any>;
|
|
691
702
|
/**
|
|
692
703
|
* 启用或禁用方块的选择框。
|
|
693
704
|
* @param {Boolean} enabled - 是否启用选择框。
|
|
694
|
-
* @returns {Map} - 新的组件集合。
|
|
705
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
695
706
|
*/
|
|
696
|
-
static setSelectionBoxEnabled(enabled: boolean): Map<
|
|
707
|
+
static setSelectionBoxEnabled(enabled: boolean): Map<string, any>;
|
|
697
708
|
/**
|
|
698
709
|
* 设置自定义的选择框。
|
|
699
710
|
* @param {Array} origin - 选择框的起点坐标 [x, y, z]。
|
|
700
711
|
* @param {Array} size - 选择框的大小 [width, height, depth]。
|
|
701
|
-
* @returns {Map} - 新的组件集合。
|
|
712
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
713
|
+
*/
|
|
714
|
+
static setSelectionBoxCustom(origin: any[], size: any[]): Map<string, any>;
|
|
715
|
+
/**
|
|
716
|
+
* 设置方块实体(Block Entity,实验性功能,需开启 Upcoming Creator Features)。
|
|
717
|
+
* @param {Boolean} [dynamic_properties=false] - 是否启用动态属性存储。
|
|
718
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
719
|
+
*/
|
|
720
|
+
static setBlockEntity(dynamic_properties?: boolean): Map<string, any>;
|
|
721
|
+
/**
|
|
722
|
+
* 设置方块的活塞移动行为。
|
|
723
|
+
* @param {String} movement_type - 移动类型: "immovable" | "popped" | "push" | "push_pull"。
|
|
724
|
+
* @param {String} [sticky] - 黏性行为: "same" 可复制黏液块/蜂蜜块功能。
|
|
725
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
726
|
+
*/
|
|
727
|
+
static setMovable(movement_type: string, sticky?: string): Map<string, any>;
|
|
728
|
+
/**
|
|
729
|
+
* 设置方块的监听红石信号行为(配合自定义组件 onRedstoneUpdate 使用)。
|
|
730
|
+
* @param {Number} min_power - 最小触发红石信号强度 (0-15)。
|
|
731
|
+
* @param {Boolean} [propagates_power] - 是否传导红石信号。
|
|
732
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
733
|
+
*/
|
|
734
|
+
static setRedstoneConsumer(min_power: number, propagates_power?: boolean): Map<string, any>;
|
|
735
|
+
/**
|
|
736
|
+
* 设置方块产生红石信号。
|
|
737
|
+
* @param {Number} power - 信号强度 (0-15)。
|
|
738
|
+
* @param {String} strongly_powered_face - 强充能方向: "up" | "down" | "north" | "south" | "east" | "west"。
|
|
739
|
+
* @param {String[]} [connected_faces] - 连接的方向数组。
|
|
740
|
+
* @param {Boolean} [transform_relative] - 面方向是否相对于变换组件的旋转。
|
|
741
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
742
|
+
*/
|
|
743
|
+
static setRedstoneProducer(power: number, strongly_powered_face: string, connected_faces?: string[], transform_relative?: boolean): Map<string, any>;
|
|
744
|
+
/**
|
|
745
|
+
* 设置方块可被替换(放置其他方块时替换此方块)。
|
|
746
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
747
|
+
*/
|
|
748
|
+
static setReplaceable(): Map<string, any>;
|
|
749
|
+
/**
|
|
750
|
+
* 设置方块的支撑形状。
|
|
751
|
+
* @param {String} shape - 支撑形状: "fence" | "stair"。
|
|
752
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
753
|
+
*/
|
|
754
|
+
static setSupport(shape: string): Map<string, any>;
|
|
755
|
+
/**
|
|
756
|
+
* 设置方块标签。
|
|
757
|
+
* @param {String[]} tags - 标签数组。
|
|
758
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
759
|
+
*/
|
|
760
|
+
static setTags(tags: string[]): Map<string, any>;
|
|
761
|
+
/**
|
|
762
|
+
* 设置方块可被拴绳拴住(类似栅栏)。
|
|
763
|
+
* @param {Number[]} [offset=[0, 12, 0]] - 拴绳结位置偏移 [x, y, z]。
|
|
764
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
765
|
+
*/
|
|
766
|
+
static setLeashable(offset?: number[]): Map<string, any>;
|
|
767
|
+
/**
|
|
768
|
+
* 设置方块对实体坠落事件的触发。
|
|
769
|
+
* @param {Number} min_fall_distance - 最小坠落距离(方块数)。
|
|
770
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
771
|
+
*/
|
|
772
|
+
static setEntityFallOn(min_fall_distance: number): Map<string, any>;
|
|
773
|
+
/**
|
|
774
|
+
* 设置方块可放入花盆(配合 setEmbeddedVisual 使用)。
|
|
775
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
776
|
+
*/
|
|
777
|
+
static setFlowerPottable(): Map<string, any>;
|
|
778
|
+
/**
|
|
779
|
+
* 设置方块与降水(雨/雪)的交互行为。
|
|
780
|
+
* @param {String} behavior - 降水行为: "obstruct_rain_accumulate_snow" | "obstruct_rain" | "snowlogging" | "none"。
|
|
781
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
782
|
+
*/
|
|
783
|
+
static setPrecipitationInteractions(behavior: string): Map<string, any>;
|
|
784
|
+
/**
|
|
785
|
+
* 设置方块的随机偏移(碰撞箱/选择框/几何)。
|
|
786
|
+
* @param {Object} axis_config - 每个轴的偏移配置。
|
|
787
|
+
* @param {Object} [axis_config.x] - X 轴配置。
|
|
788
|
+
* @param {Object} [axis_config.y] - Y 轴配置。
|
|
789
|
+
* @param {Object} [axis_config.z] - Z 轴配置。
|
|
790
|
+
* @param {Object} axis_config.x.range - 范围 {min, max}。
|
|
791
|
+
* @param {Number} [axis_config.x.steps=0] - 步数(0=任意值)。
|
|
792
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
793
|
+
*/
|
|
794
|
+
static setRandomOffset(axis_config: {
|
|
795
|
+
x?: Object | undefined;
|
|
796
|
+
y?: Object | undefined;
|
|
797
|
+
z?: Object | undefined;
|
|
798
|
+
}): Map<string, any>;
|
|
799
|
+
/**
|
|
800
|
+
* 设置方块对箱子开启的遮挡行为。
|
|
801
|
+
* @param {String} rule - 遮挡规则: "always" | "never" | "shape"。
|
|
802
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
702
803
|
*/
|
|
703
|
-
static
|
|
804
|
+
static setChestObstruction(rule: string): Map<string, any>;
|
|
805
|
+
/**
|
|
806
|
+
* 设置方块在花盆中的显示外观。
|
|
807
|
+
* @param {String|Object} geometry - 几何标识符或几何对象。
|
|
808
|
+
* @param {Object} material_instances - 材质实例。
|
|
809
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
810
|
+
*/
|
|
811
|
+
static setEmbeddedVisual(geometry: string | Object, material_instances: Object): Map<string, any>;
|
|
812
|
+
/**
|
|
813
|
+
* 设置方块与栅栏/墙等方块的连接规则。
|
|
814
|
+
* @param {String} [accepts_from="all"] - 连接来源: "all" | "only_fences" | "none"。
|
|
815
|
+
* @param {String[]} [enabled_directions] - 允许连接的方向数组。
|
|
816
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
817
|
+
*/
|
|
818
|
+
static setConnectionRule(accepts_from?: string, enabled_directions?: string[]): Map<string, any>;
|
|
819
|
+
/**
|
|
820
|
+
* 设置方块的声音。
|
|
821
|
+
* @param {String} sound - 声音名称。
|
|
822
|
+
* @returns {Map<string, any>} - 新的组件集合。
|
|
823
|
+
*/
|
|
824
|
+
static setSound(sound: string): Map<string, any>;
|
|
704
825
|
/**
|
|
705
826
|
* 将多个组件集合合并为一个。
|
|
706
827
|
* @param {...Map} componentMaps - 多个组件集合。
|
|
707
|
-
* @returns {Map} - 合并后的组件集合。
|
|
828
|
+
* @returns {Map<string, any>} - 合并后的组件集合。
|
|
708
829
|
*/
|
|
709
|
-
static combineComponents(...componentMaps: Map<any, any>[]): Map<
|
|
830
|
+
static combineComponents(...componentMaps: Map<any, any>[]): Map<string, any>;
|
|
710
831
|
/**
|
|
711
832
|
* 获取当前组件的 JSON 表示。
|
|
712
833
|
* @param {Map} components - 组件集合。
|
|
@@ -715,6 +836,144 @@ declare class BlockComponent {
|
|
|
715
836
|
static toJSON(components: Map<any, any>): Object;
|
|
716
837
|
}
|
|
717
838
|
|
|
839
|
+
interface BeforeOnPlayerPlaceEvent {
|
|
840
|
+
block: any;
|
|
841
|
+
cancel: boolean;
|
|
842
|
+
dimension: any;
|
|
843
|
+
face: string;
|
|
844
|
+
permutationToPlace: any;
|
|
845
|
+
player?: any;
|
|
846
|
+
}
|
|
847
|
+
interface OnBlockStateChangeEvent {
|
|
848
|
+
block: any;
|
|
849
|
+
dimension: any;
|
|
850
|
+
previousPermutation: any;
|
|
851
|
+
}
|
|
852
|
+
interface OnBreakEvent {
|
|
853
|
+
block: any;
|
|
854
|
+
dimension: any;
|
|
855
|
+
blockDestructionSource?: any;
|
|
856
|
+
brokenBlockPermutation: any;
|
|
857
|
+
entitySource?: any;
|
|
858
|
+
}
|
|
859
|
+
interface OnEntityEvent {
|
|
860
|
+
block: any;
|
|
861
|
+
blockPermutation: any;
|
|
862
|
+
dimension: any;
|
|
863
|
+
entitySource: any;
|
|
864
|
+
name: string;
|
|
865
|
+
}
|
|
866
|
+
interface OnEntityFallOnEvent {
|
|
867
|
+
block: any;
|
|
868
|
+
dimension: any;
|
|
869
|
+
entity?: any;
|
|
870
|
+
fallDistance: number;
|
|
871
|
+
}
|
|
872
|
+
interface OnPlaceEvent {
|
|
873
|
+
block: any;
|
|
874
|
+
dimension: any;
|
|
875
|
+
previousBlock: any;
|
|
876
|
+
}
|
|
877
|
+
interface OnPlayerBreakEvent {
|
|
878
|
+
block: any;
|
|
879
|
+
brokenBlockPermutation: any;
|
|
880
|
+
dimension: any;
|
|
881
|
+
player?: any;
|
|
882
|
+
}
|
|
883
|
+
interface OnPlayerInteractEvent {
|
|
884
|
+
block: any;
|
|
885
|
+
dimension: any;
|
|
886
|
+
face: string;
|
|
887
|
+
faceLocation: any;
|
|
888
|
+
player?: any;
|
|
889
|
+
}
|
|
890
|
+
interface OnRandomTickEvent {
|
|
891
|
+
block: any;
|
|
892
|
+
dimension: any;
|
|
893
|
+
}
|
|
894
|
+
interface OnRedstoneUpdateEvent {
|
|
895
|
+
block: any;
|
|
896
|
+
dimension: any;
|
|
897
|
+
power: number;
|
|
898
|
+
}
|
|
899
|
+
interface OnStepOffEvent {
|
|
900
|
+
block: any;
|
|
901
|
+
dimension: any;
|
|
902
|
+
entity?: any;
|
|
903
|
+
}
|
|
904
|
+
interface OnStepOnEvent {
|
|
905
|
+
block: any;
|
|
906
|
+
dimension: any;
|
|
907
|
+
entity?: any;
|
|
908
|
+
}
|
|
909
|
+
interface OnTickEvent {
|
|
910
|
+
block: any;
|
|
911
|
+
dimension: any;
|
|
912
|
+
}
|
|
913
|
+
interface BlockCustomComponentHandlers {
|
|
914
|
+
beforeOnPlayerPlace?: (event: BeforeOnPlayerPlaceEvent) => void;
|
|
915
|
+
onBlockStateChange?: (event: OnBlockStateChangeEvent) => void;
|
|
916
|
+
onBreak?: (event: OnBreakEvent) => void;
|
|
917
|
+
onEntity?: (event: OnEntityEvent) => void;
|
|
918
|
+
onEntityFallOn?: (event: OnEntityFallOnEvent) => void;
|
|
919
|
+
onPlace?: (event: OnPlaceEvent) => void;
|
|
920
|
+
onPlayerBreak?: (event: OnPlayerBreakEvent) => void;
|
|
921
|
+
onPlayerInteract?: (event: OnPlayerInteractEvent) => void;
|
|
922
|
+
onRandomTick?: (event: OnRandomTickEvent) => void;
|
|
923
|
+
onRedstoneUpdate?: (event: OnRedstoneUpdateEvent) => void;
|
|
924
|
+
onStepOff?: (event: OnStepOffEvent) => void;
|
|
925
|
+
onStepOn?: (event: OnStepOnEvent) => void;
|
|
926
|
+
onTick?: (event: OnTickEvent) => void;
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* 块自定义组件构建器 - 提供流式 API 定义块事件处理器,
|
|
930
|
+
* 并提供类型安全的事件参数绑定。
|
|
931
|
+
*
|
|
932
|
+
* @example
|
|
933
|
+
* ```ts
|
|
934
|
+
* const comp = new BlockCustomComponentBuilder('wiki:my_comp')
|
|
935
|
+
* .onTick() // 只声明事件类型,生成骨架代码
|
|
936
|
+
* .onPlayerInteract(({ player }) => { ... }) // 带完整 handler
|
|
937
|
+
*
|
|
938
|
+
* // 在 block JSON 中注册组件 ID
|
|
939
|
+
* block.addComponent(BlockComponent.setCustomComponents([comp.id()]))
|
|
940
|
+
* ```
|
|
941
|
+
*/
|
|
942
|
+
declare class BlockCustomComponentBuilder {
|
|
943
|
+
private static allInstances;
|
|
944
|
+
private componentId;
|
|
945
|
+
private handlers;
|
|
946
|
+
private declaredEvents;
|
|
947
|
+
constructor(componentId: string);
|
|
948
|
+
/** 返回所有已创建的构建器实例 */
|
|
949
|
+
static getAllInstances(): BlockCustomComponentBuilder[];
|
|
950
|
+
/** 重置实例列表(用于测试/热重载) */
|
|
951
|
+
static resetInstances(): void;
|
|
952
|
+
/** 返回组件标识符,用于 setCustomComponents */
|
|
953
|
+
id(): string;
|
|
954
|
+
/** 返回已声明(含 handler)的事件名称列表 */
|
|
955
|
+
declaredEventNames(): string[];
|
|
956
|
+
/** 返回已注册的事件处理器数量 */
|
|
957
|
+
handlerCount(): number;
|
|
958
|
+
beforeOnPlayerPlace(handler?: (event: BeforeOnPlayerPlaceEvent) => void): this;
|
|
959
|
+
onBlockStateChange(handler?: (event: OnBlockStateChangeEvent) => void): this;
|
|
960
|
+
onBreak(handler?: (event: OnBreakEvent) => void): this;
|
|
961
|
+
onEntity(handler?: (event: OnEntityEvent) => void): this;
|
|
962
|
+
onEntityFallOn(handler?: (event: OnEntityFallOnEvent) => void): this;
|
|
963
|
+
onPlace(handler?: (event: OnPlaceEvent) => void): this;
|
|
964
|
+
onPlayerBreak(handler?: (event: OnPlayerBreakEvent) => void): this;
|
|
965
|
+
onPlayerInteract(handler?: (event: OnPlayerInteractEvent) => void): this;
|
|
966
|
+
onRandomTick(handler?: (event: OnRandomTickEvent) => void): this;
|
|
967
|
+
onRedstoneUpdate(handler?: (event: OnRedstoneUpdateEvent) => void): this;
|
|
968
|
+
onStepOff(handler?: (event: OnStepOffEvent) => void): this;
|
|
969
|
+
onStepOn(handler?: (event: OnStepOnEvent) => void): this;
|
|
970
|
+
onTick(handler?: (event: OnTickEvent) => void): this;
|
|
971
|
+
/** 构建处理器对象,可用于 runtime 的 registerCustomComponent */
|
|
972
|
+
build(): BlockCustomComponentHandlers;
|
|
973
|
+
/** 生成 runtime 脚本模块源码 */
|
|
974
|
+
generateRuntimeCode(): string;
|
|
975
|
+
}
|
|
976
|
+
|
|
718
977
|
declare class CropBlock extends Block {
|
|
719
978
|
stageNum: number;
|
|
720
979
|
}
|
|
@@ -855,9 +1114,8 @@ declare class FeatureRule {
|
|
|
855
1114
|
toObject(): any;
|
|
856
1115
|
}
|
|
857
1116
|
|
|
858
|
-
declare class OreBlock {
|
|
1117
|
+
declare class OreBlock extends BasicBlock {
|
|
859
1118
|
constructor(identifier: any, category: any, textures_arr: any, options?: {});
|
|
860
|
-
block: BasicBlock;
|
|
861
1119
|
feature: OreFeature;
|
|
862
1120
|
feature_rules: FeatureRule;
|
|
863
1121
|
}
|
|
@@ -878,7 +1136,7 @@ declare class RotatableBlock extends BasicBlock {
|
|
|
878
1136
|
* @param {string} options.group 分组,默认为 "construction"
|
|
879
1137
|
* @param {boolean} options.hide_in_command 是否在命令中隐藏,默认为 false
|
|
880
1138
|
* @param {string} options.rotationType 旋转类型,默认为 "cardinal"
|
|
881
|
-
* @param {number} options.yRotationOffset 初始旋转偏移量,默认为
|
|
1139
|
+
* @param {number} options.yRotationOffset 初始旋转偏移量,默认为 0
|
|
882
1140
|
*/
|
|
883
1141
|
constructor(identifier: string, category: string, textures_arr: any[], options?: {
|
|
884
1142
|
group: string;
|
|
@@ -1060,6 +1318,71 @@ declare class TileBlock {
|
|
|
1060
1318
|
setScript(key: any, value: any): void;
|
|
1061
1319
|
}
|
|
1062
1320
|
|
|
1321
|
+
declare class GlassBlock extends BasicBlock {
|
|
1322
|
+
constructor(identifier: any, category: any, texture: any, options?: {});
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
declare class HeadBlock extends BasicBlock {
|
|
1326
|
+
constructor(identifier: any, category: any, texture: any, options?: {});
|
|
1327
|
+
#private;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
declare class FenceBlock extends BasicBlock {
|
|
1331
|
+
constructor(identifier: any, category: any, textures_arr: any, options?: {});
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
declare class StairBlock extends BasicBlock {
|
|
1335
|
+
constructor(identifier: any, category: any, textures_arr: any, options?: {});
|
|
1336
|
+
#private;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
declare class TrapdoorBlock extends BasicBlock {
|
|
1340
|
+
constructor(identifier: any, category: any, texture: any, options?: {});
|
|
1341
|
+
#private;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
declare const TintMethod: {
|
|
1345
|
+
readonly GRASS: "grass";
|
|
1346
|
+
readonly WATER: "water";
|
|
1347
|
+
readonly DEFAULT_FOLIAGE: "default_foliage";
|
|
1348
|
+
readonly EVERGREEN_FOLIAGE: "evergreen_foliage";
|
|
1349
|
+
readonly DRY_FOLIAGE: "dry_foliage";
|
|
1350
|
+
readonly BIRCH_FOLIAGE: "birch_foliage";
|
|
1351
|
+
};
|
|
1352
|
+
type TintMethod = (typeof TintMethod)[keyof typeof TintMethod];
|
|
1353
|
+
|
|
1354
|
+
interface FlipbookEntry {
|
|
1355
|
+
flipbook_texture: string;
|
|
1356
|
+
atlas_tile?: string;
|
|
1357
|
+
ticks_per_frame?: number;
|
|
1358
|
+
blend_frames?: boolean;
|
|
1359
|
+
replicate?: number;
|
|
1360
|
+
}
|
|
1361
|
+
declare class FlipbookTextureConfig {
|
|
1362
|
+
private entries;
|
|
1363
|
+
addEntry(entry: FlipbookEntry): this;
|
|
1364
|
+
addEntries(entries: FlipbookEntry[]): this;
|
|
1365
|
+
toObject(): {
|
|
1366
|
+
flipbook_textures: FlipbookEntry[];
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
interface TextureVariation {
|
|
1371
|
+
path: string;
|
|
1372
|
+
weight?: number;
|
|
1373
|
+
}
|
|
1374
|
+
interface TextureEntry {
|
|
1375
|
+
textures: string | TextureVariation[];
|
|
1376
|
+
}
|
|
1377
|
+
declare class TextureVariationConfig {
|
|
1378
|
+
private textureData;
|
|
1379
|
+
addTexture(name: string, path: string): this;
|
|
1380
|
+
addTextureWithVariations(name: string, variations: TextureVariation[]): this;
|
|
1381
|
+
toObject(): {
|
|
1382
|
+
texture_data: Record<string, TextureEntry>;
|
|
1383
|
+
};
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1063
1386
|
declare class DummyEntity extends Entity {
|
|
1064
1387
|
constructor(identifier: any, texture: any, options: {} | undefined, behData: any, resData: any);
|
|
1065
1388
|
}
|
|
@@ -1306,6 +1629,62 @@ declare class PickupItemsBehavior {
|
|
|
1306
1629
|
toObject(): Map<string, object>;
|
|
1307
1630
|
}
|
|
1308
1631
|
|
|
1632
|
+
declare class MoveTowardsHomeRestrictionBehavior {
|
|
1633
|
+
/**
|
|
1634
|
+
* 创建 minecraft:behavior.move_towards_home_restriction 组件。
|
|
1635
|
+
* @param {number} priority 行为的优先级
|
|
1636
|
+
*/
|
|
1637
|
+
constructor(priority: number);
|
|
1638
|
+
priority: number;
|
|
1639
|
+
speed_multiplier: number;
|
|
1640
|
+
/**
|
|
1641
|
+
* 设置移动速度倍数。
|
|
1642
|
+
* @param {number} speedMultiplier 移动速度倍数
|
|
1643
|
+
* @returns {MoveTowardsHomeRestrictionBehavior} 返回当前实例以支持链式调用
|
|
1644
|
+
*/
|
|
1645
|
+
setSpeedMultiplier(speedMultiplier: number): MoveTowardsHomeRestrictionBehavior;
|
|
1646
|
+
/**
|
|
1647
|
+
* 将组件转换为 JSON 对象。
|
|
1648
|
+
* @returns {Object} minecraft:behavior.move_towards_home_restriction 组件的 JSON 对象
|
|
1649
|
+
*/
|
|
1650
|
+
toObject(): Object;
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
declare class GoHomeBehavior {
|
|
1654
|
+
/**
|
|
1655
|
+
* 创建 minecraft:behavior.go_home 组件。
|
|
1656
|
+
* @param {number} priority 行为的优先级
|
|
1657
|
+
*/
|
|
1658
|
+
constructor(priority: number);
|
|
1659
|
+
priority: number;
|
|
1660
|
+
speed_multiplier: number;
|
|
1661
|
+
goal_radius: number;
|
|
1662
|
+
interval: number;
|
|
1663
|
+
/**
|
|
1664
|
+
* 设置移动速度倍数。
|
|
1665
|
+
* @param {number} speedMultiplier 移动速度倍数
|
|
1666
|
+
* @returns {GoHomeBehavior} 返回当前实例以支持链式调用
|
|
1667
|
+
*/
|
|
1668
|
+
setSpeedMultiplier(speedMultiplier: number): GoHomeBehavior;
|
|
1669
|
+
/**
|
|
1670
|
+
* 设置回家目标判定半径。
|
|
1671
|
+
* @param {number} goalRadius 判定半径(方块格)
|
|
1672
|
+
* @returns {GoHomeBehavior} 返回当前实例以支持链式调用
|
|
1673
|
+
*/
|
|
1674
|
+
setGoalRadius(goalRadius: number): GoHomeBehavior;
|
|
1675
|
+
/**
|
|
1676
|
+
* 设置回家行为执行的间隔时间(游戏刻)。
|
|
1677
|
+
* @param {number} interval 间隔时间(游戏刻)
|
|
1678
|
+
* @returns {GoHomeBehavior} 返回当前实例以支持链式调用
|
|
1679
|
+
*/
|
|
1680
|
+
setInterval(interval: number): GoHomeBehavior;
|
|
1681
|
+
/**
|
|
1682
|
+
* 将组件转换为 JSON 对象。
|
|
1683
|
+
* @returns {Object} minecraft:behavior.go_home 组件的 JSON 对象
|
|
1684
|
+
*/
|
|
1685
|
+
toObject(): Object;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1309
1688
|
declare class BasicBundle {
|
|
1310
1689
|
/**
|
|
1311
1690
|
* 添加组件到捆绑包
|
|
@@ -1807,6 +2186,53 @@ declare class EntityComponent {
|
|
|
1807
2186
|
uncertaintyBase: number;
|
|
1808
2187
|
uncertaintyMultiplier: number;
|
|
1809
2188
|
}): Map<any, any>;
|
|
2189
|
+
/**
|
|
2190
|
+
* 设置实体的家(工作站点)组件,用于限制实体的活动范围。
|
|
2191
|
+
* @param {Object} [options] - 配置选项
|
|
2192
|
+
* @param {number} [options.restriction_radius=16] - 限制半径(方块格)
|
|
2193
|
+
* @param {string[]} [options.home_block_list=["minecraft:chest"]] - 可绑定为家的方块列表
|
|
2194
|
+
* @param {string} [options.restriction_type] - 限制类型(可选,如 "limited"),需 format_version >= 1.21.40
|
|
2195
|
+
* @returns {Map} 返回 Minecraft home 组件
|
|
2196
|
+
*
|
|
2197
|
+
* @example // 基础用法 - 16格半径,箱子作为家
|
|
2198
|
+
* const home = EntityComponent.setHome();
|
|
2199
|
+
*
|
|
2200
|
+
* @example // 自定义配置
|
|
2201
|
+
* const customHome = EntityComponent.setHome({
|
|
2202
|
+
* restriction_radius: 32,
|
|
2203
|
+
* home_block_list: ["minecraft:chest", "minecraft:barrel"],
|
|
2204
|
+
* restriction_type: "limited"
|
|
2205
|
+
* });
|
|
2206
|
+
*/
|
|
2207
|
+
static setHome({ restriction_radius, home_block_list, restriction_type }?: {
|
|
2208
|
+
restriction_radius?: number | undefined;
|
|
2209
|
+
home_block_list?: string[] | undefined;
|
|
2210
|
+
restriction_type?: string | undefined;
|
|
2211
|
+
}): Map<any, any>;
|
|
2212
|
+
/**
|
|
2213
|
+
* 设置可分享物品列表(该实体感兴趣并会主动拾取的物品)
|
|
2214
|
+
* 与 minecraft:behavior.pickup_items 配合使用
|
|
2215
|
+
* @param {Object} [options] - 配置选项
|
|
2216
|
+
* @param {Array<Object>} [options.items=[]] - 物品条目列表
|
|
2217
|
+
* @param {string} options.items[].item - 物品ID
|
|
2218
|
+
* @param {number} [options.items[].want_amount] - 想要保留的数量
|
|
2219
|
+
* @param {number} [options.items[].surplus_amount] - 溢出阈值(超出此数量可分享给玩家)
|
|
2220
|
+
* @param {number} [options.items[].priority] - 优先级(数值越小优先级越高)
|
|
2221
|
+
* @param {number} [options.items[].max_amount] - 最大持有数
|
|
2222
|
+
* @param {number} [options.items[].pickup_limit] - 单次拾取数限制
|
|
2223
|
+
* @param {boolean} [options.items[].pickup_only] - 是否只拾取不分享
|
|
2224
|
+
* @param {boolean} [options.items[].stored_in_inventory] - 是否存入库存
|
|
2225
|
+
* @param {boolean} [options.items[].consume_item] - 是否消耗物品
|
|
2226
|
+
* @param {Object} [options.items[].admire] - 欣赏物品行为
|
|
2227
|
+
* @param {Object} [options.items[].barter] - 以物易物配置
|
|
2228
|
+
* @param {Object} [options.items[].craft_into] - 合成转换配置
|
|
2229
|
+
* @param {boolean} [options.all_items=false] - 是否接受任意物品
|
|
2230
|
+
* @param {boolean} [options.singular_pickup=false] - 是否一次只拾取一个
|
|
2231
|
+
* @returns {Map} 返回 Minecraft shareables 组件
|
|
2232
|
+
*/
|
|
2233
|
+
static setShareables({ items, all_items, singular_pickup }?: {
|
|
2234
|
+
items?: Object[] | undefined;
|
|
2235
|
+
}): Map<any, any>;
|
|
1810
2236
|
}
|
|
1811
2237
|
|
|
1812
2238
|
type BehaviorLiterals = 'beh' | 'behavior' | 'behaviour';
|
|
@@ -1866,13 +2292,18 @@ declare namespace BlockAPI {
|
|
|
1866
2292
|
}): RotatableBlock;
|
|
1867
2293
|
function createGeometryBlock(identifier: any, category: any, geometry: any, material_instances: any, options?: {}): GeometryBlock;
|
|
1868
2294
|
function createOreBlock(identifier: any, category: any, textures_arr: any, options?: {}): OreBlock;
|
|
1869
|
-
function
|
|
2295
|
+
function createHeadBlock(identifier: string, category: string, texture: any, options?: {
|
|
1870
2296
|
group: string;
|
|
1871
2297
|
hide_in_command: boolean;
|
|
1872
2298
|
ambient_occlusion: boolean;
|
|
1873
2299
|
face_dimming: boolean;
|
|
1874
2300
|
render_method: string;
|
|
1875
2301
|
}): CropBlock;
|
|
2302
|
+
function createGlassBlock(identifier: any, category: any, texture: any, options?: {}): GlassBlock;
|
|
2303
|
+
function createFenceBlock(identifier: any, category: any, textures_arr: any, options?: {}): FenceBlock;
|
|
2304
|
+
function createStairBlock(identifier: any, category: any, textures_arr: any, options?: {}): StairBlock;
|
|
2305
|
+
function createTrapdoorBlock(identifier: any, category: any, texture: any, options?: {}): TrapdoorBlock;
|
|
2306
|
+
function createCropBlock(identifier: any, category: any, variantDatas: any, options?: {}): CropBlock;
|
|
1876
2307
|
}
|
|
1877
2308
|
|
|
1878
2309
|
declare function registerEntity(behData: any, resData: any): void;
|
|
@@ -1900,6 +2331,10 @@ declare namespace FeatureAPI {
|
|
|
1900
2331
|
function createFeatureRules(identifier: any, places_feature: any): FeatureRule;
|
|
1901
2332
|
}
|
|
1902
2333
|
|
|
2334
|
+
/**
|
|
2335
|
+
* 物品菜单栏分类枚举
|
|
2336
|
+
* 用于 Item / Food / FlipbookItem 及 ItemAPI 的 category 参数
|
|
2337
|
+
*/
|
|
1903
2338
|
declare enum ItemCategory {
|
|
1904
2339
|
Commands = "commands",
|
|
1905
2340
|
Construction = "construction",
|
|
@@ -1908,90 +2343,395 @@ declare enum ItemCategory {
|
|
|
1908
2343
|
Items = "items",
|
|
1909
2344
|
None = "none"
|
|
1910
2345
|
}
|
|
1911
|
-
|
|
1912
|
-
|
|
2346
|
+
/**
|
|
2347
|
+
* 物品组件 Map:以 Minecraft 组件名为 key
|
|
2348
|
+
*/
|
|
2349
|
+
type ItemComponentMap = Map<string, unknown>;
|
|
2350
|
+
/**
|
|
2351
|
+
* 物品选项
|
|
2352
|
+
* snake_case(对应 Minecraft JSON 字段)与 camelCase 互为别名,camelCase 优先
|
|
2353
|
+
*/
|
|
2354
|
+
interface ItemOptions {
|
|
2355
|
+
group?: string;
|
|
2356
|
+
hide_in_command?: boolean;
|
|
2357
|
+
hideInCommand?: boolean;
|
|
2358
|
+
max_stack_size?: number;
|
|
2359
|
+
maxStackSize?: number;
|
|
2360
|
+
format_version?: string;
|
|
2361
|
+
formatVersion?: string;
|
|
1913
2362
|
/**
|
|
1914
|
-
*
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
2363
|
+
* 图标纹理名称;传 null 表示不添加 minecraft:icon 组件
|
|
2364
|
+
*/
|
|
2365
|
+
icon?: string | null;
|
|
2366
|
+
displayName?: string;
|
|
2367
|
+
}
|
|
2368
|
+
/**
|
|
2369
|
+
* 3D 手持物品骨骼变换(动画中的 position/rotation/scale)
|
|
2370
|
+
*/
|
|
2371
|
+
interface ModelBoneTransform {
|
|
2372
|
+
position?: [number, number, number];
|
|
2373
|
+
rotation?: [number, number, number];
|
|
2374
|
+
scale?: number | [number, number, number];
|
|
2375
|
+
}
|
|
2376
|
+
/**
|
|
2377
|
+
* 3D 手持物品选项(Method 2:model binding)
|
|
2378
|
+
*/
|
|
2379
|
+
interface CreateModelItemOptions extends ItemOptions {
|
|
2380
|
+
/**
|
|
2381
|
+
* 几何根骨骼名,内置动画将作用于该骨骼;必须与用户 geometry 中带
|
|
2382
|
+
* binding(q.item_slot_to_bone_name)的骨骼名一致。默认 "rightitem"。
|
|
2383
|
+
*/
|
|
2384
|
+
boneName?: string;
|
|
2385
|
+
/**
|
|
2386
|
+
* 默认材质。默认 "entity"(不透明,同官方示例);
|
|
2387
|
+
* 模型含透明像素时可用 "entity_alphatest"。
|
|
2388
|
+
*/
|
|
2389
|
+
material?: string;
|
|
2390
|
+
/**
|
|
2391
|
+
* 覆盖内置第一人称握持姿态(默认参照官方示例)
|
|
1921
2392
|
*/
|
|
1922
|
-
|
|
2393
|
+
holdFirstPerson?: ModelBoneTransform;
|
|
2394
|
+
/**
|
|
2395
|
+
* 覆盖内置第三人称握持姿态(默认参照官方示例)
|
|
2396
|
+
*/
|
|
2397
|
+
holdThirdPerson?: ModelBoneTransform;
|
|
2398
|
+
}
|
|
2399
|
+
/**
|
|
2400
|
+
* 食物选项
|
|
2401
|
+
*/
|
|
2402
|
+
interface FoodOptions extends ItemOptions {
|
|
2403
|
+
animation?: string;
|
|
2404
|
+
movement?: number;
|
|
2405
|
+
useDuration?: number;
|
|
2406
|
+
canAlwaysEat?: boolean;
|
|
2407
|
+
nutrition?: number;
|
|
2408
|
+
saturationModifier?: number;
|
|
2409
|
+
/**
|
|
2410
|
+
* 是否为肉类(自动追加 minecraft:is_meat 标签)
|
|
2411
|
+
*/
|
|
2412
|
+
isMeat?: boolean;
|
|
2413
|
+
/**
|
|
2414
|
+
* 是否为鱼类(自动追加 minecraft:is_fish 标签)
|
|
2415
|
+
*/
|
|
2416
|
+
isFish?: boolean;
|
|
2417
|
+
/**
|
|
2418
|
+
* 是否为熟食(自动追加 minecraft:is_cooked 标签)
|
|
2419
|
+
*/
|
|
2420
|
+
isCooked?: boolean;
|
|
2421
|
+
}
|
|
2422
|
+
/**
|
|
2423
|
+
* 可投掷组件选项
|
|
2424
|
+
*/
|
|
2425
|
+
interface ThrowableOptions {
|
|
2426
|
+
doSwingAnimation?: boolean;
|
|
2427
|
+
launchPowerScale?: number;
|
|
2428
|
+
maxDrawDuration?: number;
|
|
2429
|
+
maxLaunchPower?: number;
|
|
2430
|
+
minDrawDuration?: number;
|
|
2431
|
+
scalePowerByDrawDuration?: boolean;
|
|
2432
|
+
}
|
|
2433
|
+
/**
|
|
2434
|
+
* 食物组件选项
|
|
2435
|
+
*/
|
|
2436
|
+
interface FoodComponentOptions {
|
|
2437
|
+
nutrition?: number;
|
|
2438
|
+
saturationModifier?: number;
|
|
2439
|
+
canAlwaysEat?: boolean;
|
|
2440
|
+
usingConvertsTo?: string;
|
|
2441
|
+
}
|
|
2442
|
+
/**
|
|
2443
|
+
* 方块描述符:字符串、带状态的名称对象或标签 Molang 查询对象
|
|
2444
|
+
*/
|
|
2445
|
+
type BlockDescriptor = string | {
|
|
2446
|
+
name: string;
|
|
2447
|
+
states?: Record<string, unknown>;
|
|
2448
|
+
} | {
|
|
2449
|
+
tags: string;
|
|
2450
|
+
};
|
|
2451
|
+
/**
|
|
2452
|
+
* 数值范围
|
|
2453
|
+
*/
|
|
2454
|
+
interface Range {
|
|
2455
|
+
min: number;
|
|
2456
|
+
max: number;
|
|
2457
|
+
}
|
|
2458
|
+
/**
|
|
2459
|
+
* 物品稀有度
|
|
2460
|
+
*/
|
|
2461
|
+
type ItemRarity = 'common' | 'uncommon' | 'rare' | 'epic';
|
|
2462
|
+
/**
|
|
2463
|
+
* 放置方块组件选项
|
|
2464
|
+
*/
|
|
2465
|
+
interface BlockPlacerOptions {
|
|
2466
|
+
replaceBlockItem?: boolean;
|
|
2467
|
+
alignedPlacement?: boolean;
|
|
2468
|
+
useOn?: BlockDescriptor[];
|
|
2469
|
+
}
|
|
2470
|
+
/**
|
|
2471
|
+
* 使用修饰组件选项
|
|
2472
|
+
*/
|
|
2473
|
+
interface UseModifiersOptions {
|
|
2474
|
+
movementModifier?: number;
|
|
2475
|
+
useDuration?: number;
|
|
2476
|
+
emitVibrations?: boolean;
|
|
2477
|
+
startSound?: string;
|
|
2478
|
+
startUsing?: 'always' | 'if_first';
|
|
2479
|
+
}
|
|
2480
|
+
/**
|
|
2481
|
+
* 图标纹理(对象格式)
|
|
2482
|
+
*/
|
|
2483
|
+
interface IconTextures {
|
|
2484
|
+
default: string;
|
|
2485
|
+
dyed?: string;
|
|
2486
|
+
iconTrim?: string;
|
|
2487
|
+
bundleOpenBack?: string;
|
|
2488
|
+
bundleOpenFront?: string;
|
|
2489
|
+
}
|
|
2490
|
+
/**
|
|
2491
|
+
* 冷却组件选项
|
|
2492
|
+
*/
|
|
2493
|
+
interface CooldownOptions {
|
|
2494
|
+
category: string;
|
|
2495
|
+
duration: number;
|
|
2496
|
+
type?: 'use' | 'attack';
|
|
2497
|
+
}
|
|
2498
|
+
/**
|
|
2499
|
+
* 挖掘组件选项
|
|
2500
|
+
*/
|
|
2501
|
+
interface DiggerOptions {
|
|
2502
|
+
destroySpeeds: {
|
|
2503
|
+
block: BlockDescriptor;
|
|
2504
|
+
speed: number;
|
|
2505
|
+
}[];
|
|
2506
|
+
useEfficiency?: boolean;
|
|
2507
|
+
}
|
|
2508
|
+
/**
|
|
2509
|
+
* 耐久传感器阈值
|
|
2510
|
+
*/
|
|
2511
|
+
interface DurabilityThreshold {
|
|
2512
|
+
durability: number;
|
|
2513
|
+
particleType?: string;
|
|
2514
|
+
soundEvent?: string;
|
|
2515
|
+
}
|
|
2516
|
+
/**
|
|
2517
|
+
* 耐久传感器组件选项
|
|
2518
|
+
*/
|
|
2519
|
+
interface DurabilitySensorOptions {
|
|
2520
|
+
durabilityThresholds: DurabilityThreshold[];
|
|
2521
|
+
}
|
|
2522
|
+
/**
|
|
2523
|
+
* 放置实体组件选项
|
|
2524
|
+
*/
|
|
2525
|
+
interface EntityPlacerOptions {
|
|
2526
|
+
dispenseOn?: BlockDescriptor[];
|
|
2527
|
+
useOn?: BlockDescriptor[];
|
|
2528
|
+
}
|
|
2529
|
+
/**
|
|
2530
|
+
* 动能武器组件选项
|
|
2531
|
+
*/
|
|
2532
|
+
interface KineticWeaponOptions {
|
|
2533
|
+
delay: number;
|
|
2534
|
+
hitboxMargin?: number;
|
|
2535
|
+
reach?: Range;
|
|
2536
|
+
creativeReach?: Range;
|
|
2537
|
+
damageMultiplier?: number;
|
|
2538
|
+
damageModifier?: number;
|
|
2539
|
+
damageConditions?: Record<string, unknown>;
|
|
2540
|
+
dismountConditions?: Record<string, unknown>;
|
|
2541
|
+
knockbackConditions?: Record<string, unknown>;
|
|
2542
|
+
}
|
|
2543
|
+
/**
|
|
2544
|
+
* 穿刺武器组件选项
|
|
2545
|
+
*/
|
|
2546
|
+
interface PiercingWeaponOptions {
|
|
2547
|
+
hitboxMargin?: number;
|
|
2548
|
+
reach?: Range;
|
|
2549
|
+
creativeReach?: Range;
|
|
2550
|
+
}
|
|
2551
|
+
/**
|
|
2552
|
+
* 唱片组件选项
|
|
2553
|
+
*/
|
|
2554
|
+
interface RecordOptions {
|
|
2555
|
+
comparatorSignal: number;
|
|
2556
|
+
duration: number;
|
|
2557
|
+
soundEvent: string;
|
|
2558
|
+
}
|
|
2559
|
+
/**
|
|
2560
|
+
* 修复条目
|
|
2561
|
+
*/
|
|
2562
|
+
interface RepairItem {
|
|
2563
|
+
items: (string | {
|
|
2564
|
+
tags: string;
|
|
2565
|
+
})[];
|
|
2566
|
+
repairAmount?: number | string;
|
|
2567
|
+
}
|
|
2568
|
+
/**
|
|
2569
|
+
* 射击组件弹药
|
|
2570
|
+
*/
|
|
2571
|
+
interface ShooterAmmunition {
|
|
2572
|
+
item: string;
|
|
2573
|
+
searchInventory?: boolean;
|
|
2574
|
+
useInCreative?: boolean;
|
|
2575
|
+
useOffhand?: boolean;
|
|
2576
|
+
}
|
|
2577
|
+
/**
|
|
2578
|
+
* 射击组件选项
|
|
2579
|
+
*/
|
|
2580
|
+
interface ShooterOptions {
|
|
2581
|
+
ammunition: ShooterAmmunition[];
|
|
2582
|
+
chargeOnDraw?: boolean;
|
|
2583
|
+
maxDrawDuration?: number;
|
|
2584
|
+
scalePowerByDrawDuration?: boolean;
|
|
2585
|
+
}
|
|
2586
|
+
/**
|
|
2587
|
+
* 容器物品组件选项
|
|
2588
|
+
*/
|
|
2589
|
+
interface StorageItemOptions {
|
|
2590
|
+
maxSlots: number;
|
|
2591
|
+
allowNestedStorageItems: boolean;
|
|
2592
|
+
allowedItems?: string[];
|
|
2593
|
+
bannedItems?: string[];
|
|
2594
|
+
}
|
|
2595
|
+
/**
|
|
2596
|
+
* 挥砍音效组件选项
|
|
2597
|
+
*/
|
|
2598
|
+
interface SwingSoundsOptions {
|
|
2599
|
+
attackMiss?: string;
|
|
2600
|
+
attackHit?: string;
|
|
2601
|
+
attackCriticalHit?: string;
|
|
2602
|
+
}
|
|
2603
|
+
|
|
2604
|
+
declare class Attachable extends AddonAttachableDescription {
|
|
2605
|
+
#private;
|
|
2606
|
+
constructor(identifier: string, formatVersion?: string);
|
|
2607
|
+
getId(): string;
|
|
2608
|
+
toObject(): Record<string, any>;
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
declare class Item {
|
|
1923
2612
|
identifier: string;
|
|
1924
2613
|
category: string;
|
|
1925
2614
|
texture: string;
|
|
1926
|
-
group
|
|
1927
|
-
hide_in_command:
|
|
1928
|
-
format_version:
|
|
1929
|
-
components:
|
|
2615
|
+
group?: string;
|
|
2616
|
+
hide_in_command: boolean;
|
|
2617
|
+
format_version: string;
|
|
2618
|
+
components: ItemComponentMap;
|
|
2619
|
+
attachable?: Attachable;
|
|
2620
|
+
/**
|
|
2621
|
+
* 物品类
|
|
2622
|
+
* @param identifier 物品唯一标识符
|
|
2623
|
+
* @param category 菜单栏分类,见 {@link ItemCategory}
|
|
2624
|
+
* @param texture 物品纹理
|
|
2625
|
+
* @param options 可选参数
|
|
2626
|
+
*/
|
|
2627
|
+
constructor(identifier: string, category: ItemCategory, texture: string, options?: ItemOptions);
|
|
1930
2628
|
/**
|
|
1931
2629
|
* 添加组件
|
|
1932
|
-
* @param
|
|
2630
|
+
* @param componentMap 组件 Map
|
|
1933
2631
|
*/
|
|
1934
|
-
addComponent(componentMap:
|
|
2632
|
+
addComponent(componentMap: ItemComponentMap): this;
|
|
1935
2633
|
/**
|
|
1936
2634
|
* 移除组件
|
|
1937
|
-
* @param
|
|
2635
|
+
* @param key 组件名称
|
|
1938
2636
|
*/
|
|
1939
2637
|
removeComponent(key: string): this;
|
|
2638
|
+
getAttachable(): Attachable | undefined;
|
|
1940
2639
|
/**
|
|
1941
2640
|
* 将物品转换为 JSON 格式
|
|
1942
|
-
* @returns
|
|
2641
|
+
* @returns JSON 格式的物品对象
|
|
1943
2642
|
*/
|
|
1944
|
-
toObject():
|
|
2643
|
+
toObject(): Record<string, any>;
|
|
1945
2644
|
}
|
|
1946
2645
|
|
|
1947
|
-
|
|
2646
|
+
/**
|
|
2647
|
+
* 盔甲类型枚举
|
|
2648
|
+
*/
|
|
2649
|
+
declare enum ArmorType {
|
|
2650
|
+
Chestplate = "chestplate",
|
|
2651
|
+
Helmet = "helmet",
|
|
2652
|
+
Boots = "boots",
|
|
2653
|
+
Leggings = "leggings"
|
|
2654
|
+
}
|
|
2655
|
+
/**
|
|
2656
|
+
* 盔甲类型规格
|
|
2657
|
+
* 参考 Bedrock Wiki "Custom Armor":https://wiki.bedrock.dev/items/custom-armor
|
|
2658
|
+
*/
|
|
2659
|
+
interface ArmorSpec {
|
|
2660
|
+
group: string;
|
|
2661
|
+
geometry: string;
|
|
2662
|
+
script: string;
|
|
2663
|
+
protection: number;
|
|
2664
|
+
slot: string;
|
|
2665
|
+
enchantSlot: string;
|
|
2666
|
+
maxDurability: number;
|
|
2667
|
+
displayName: string;
|
|
2668
|
+
}
|
|
2669
|
+
/**
|
|
2670
|
+
* 盔甲选项
|
|
2671
|
+
* 参考 Bedrock Wiki "Custom Armor":https://wiki.bedrock.dev/items/custom-armor
|
|
2672
|
+
*/
|
|
2673
|
+
interface ArmorOptions extends ItemOptions {
|
|
2674
|
+
displayName?: string;
|
|
1948
2675
|
/**
|
|
1949
|
-
*
|
|
1950
|
-
* @param {string} identifier 物品唯一标识符
|
|
1951
|
-
* @param {string} category 菜单栏分类 可选:"construction", "nature", "equipment", "items", and "none"
|
|
1952
|
-
* @param {string} texture 物品纹理
|
|
1953
|
-
* @param {Object} options 可选参数
|
|
1954
|
-
* @param {string} options.group 分组
|
|
1955
|
-
* @param {boolean} options.hide_in_command 是否在命令中隐藏,默认为 false
|
|
1956
|
-
* @param {string} options.animation 使用动画,默认为 "eat"
|
|
1957
|
-
* @param {boolean} options.canAlwaysEat 是否总是可以食用,默认为 false
|
|
1958
|
-
* @param {number} options.nutrition 营养价值,默认为 0
|
|
1959
|
-
* @param {number} options.saturationModifier 饱和度修正值,默认为 1
|
|
2676
|
+
* 附魔槽位与等级(参考 wiki 规范,默认 { slot: 按部位, value: 10 })
|
|
1960
2677
|
*/
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
2678
|
+
enchantable?: {
|
|
2679
|
+
slot: string;
|
|
2680
|
+
value?: number;
|
|
2681
|
+
};
|
|
2682
|
+
/**
|
|
2683
|
+
* 最大耐久(参考 wiki 规范,默认按部位:头盔 363 / 胸甲 528 / 护腿 495 / 靴子 429)
|
|
2684
|
+
*/
|
|
2685
|
+
maxDurability?: number;
|
|
2686
|
+
/**
|
|
2687
|
+
* 修复条目(参考 wiki 规范,默认木棍,每次恢复 25% 最大耐久)
|
|
2688
|
+
*/
|
|
2689
|
+
repairItems?: RepairItem[];
|
|
2690
|
+
/**
|
|
2691
|
+
* 附加标签(参考 wiki 规范,默认 ["minecraft:is_armor", "minecraft:trimmable_armors"])
|
|
2692
|
+
*/
|
|
2693
|
+
tags?: string[];
|
|
2694
|
+
/**
|
|
2695
|
+
* 渲染控制器,默认 "controller.render.armor"(兼容旧版),可传 "controller.render.armor.v2"
|
|
2696
|
+
*/
|
|
2697
|
+
renderController?: string;
|
|
1975
2698
|
}
|
|
1976
|
-
|
|
2699
|
+
/**
|
|
2700
|
+
* 盔甲类
|
|
2701
|
+
* 由 ArmorType 数据表驱动,同时生成物品(Item)与可附着物(Attachable)
|
|
2702
|
+
*/
|
|
1977
2703
|
declare class Armor {
|
|
1978
|
-
|
|
1979
|
-
identifier:
|
|
2704
|
+
type: ArmorType;
|
|
2705
|
+
identifier: string;
|
|
1980
2706
|
item: Item;
|
|
1981
2707
|
attachable: Attachable;
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
2708
|
+
constructor(identifier: string, item_texture: string, texture_path: string, type?: ArmorType, options?: ArmorOptions);
|
|
2709
|
+
/**
|
|
2710
|
+
* 设置可附着物的几何模型
|
|
2711
|
+
* @param key 几何模型名称
|
|
2712
|
+
* @param geometry 几何模型标识符
|
|
2713
|
+
* @returns 当前实例,支持链式调用
|
|
2714
|
+
*/
|
|
2715
|
+
setAttachableGeometry(key: string, geometry: string): this;
|
|
2716
|
+
/**
|
|
2717
|
+
* 获取行为包与资源包的 JSON 表示
|
|
2718
|
+
* @returns { behavior, resource } 两个包的注册内容
|
|
2719
|
+
*/
|
|
2720
|
+
toObject(): {
|
|
2721
|
+
behavior: Record<string, any>;
|
|
2722
|
+
resource: Record<string, any>;
|
|
2723
|
+
};
|
|
1992
2724
|
}
|
|
1993
|
-
|
|
1994
|
-
|
|
2725
|
+
|
|
2726
|
+
declare class Food extends Item {
|
|
2727
|
+
/**
|
|
2728
|
+
* 食物类
|
|
2729
|
+
* @param identifier 物品唯一标识符
|
|
2730
|
+
* @param category 菜单栏分类,见 {@link ItemCategory}
|
|
2731
|
+
* @param texture 物品纹理
|
|
2732
|
+
* @param options 可选参数
|
|
2733
|
+
*/
|
|
2734
|
+
constructor(identifier: string, category: ItemCategory, texture: string, options?: FoodOptions);
|
|
1995
2735
|
}
|
|
1996
2736
|
|
|
1997
2737
|
/**
|
|
@@ -2031,6 +2771,11 @@ interface FlipbookItemOptions {
|
|
|
2031
2771
|
* @default "1.20.0" - 默认使用最新版本
|
|
2032
2772
|
*/
|
|
2033
2773
|
format_version?: string;
|
|
2774
|
+
/**
|
|
2775
|
+
* 翻书纹理文件的完整路径(不含 .png 后缀)。
|
|
2776
|
+
* @default `"textures/blocks/${texture}"` - 默认使用方块纹理目录
|
|
2777
|
+
*/
|
|
2778
|
+
texture_path?: string;
|
|
2034
2779
|
}
|
|
2035
2780
|
/**
|
|
2036
2781
|
* 翻书物品类
|
|
@@ -2056,31 +2801,163 @@ declare class FlipbookItem extends Item {
|
|
|
2056
2801
|
* @param options.max_stack_size - 物品的最大堆叠数量
|
|
2057
2802
|
* @param options.format_version - 格式版本号
|
|
2058
2803
|
*/
|
|
2059
|
-
constructor(identifier: string, category:
|
|
2804
|
+
constructor(identifier: string, category: ItemCategory, texture: string, options?: FlipbookItemOptions);
|
|
2060
2805
|
}
|
|
2061
2806
|
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2807
|
+
/**
|
|
2808
|
+
* 物品目录分类
|
|
2809
|
+
* 参考 Bedrock Wiki Item Catalog:仅支持 construction / equipment / items / nature 四类
|
|
2810
|
+
*/
|
|
2811
|
+
type ItemCatalogCategory = 'construction' | 'equipment' | 'items' | 'nature';
|
|
2812
|
+
/**
|
|
2813
|
+
* 可展开分组配置
|
|
2814
|
+
*/
|
|
2815
|
+
interface ItemCatalogGroupOptions {
|
|
2816
|
+
/**
|
|
2817
|
+
* 分组图标使用的物品
|
|
2818
|
+
*/
|
|
2819
|
+
icon?: string;
|
|
2820
|
+
/**
|
|
2821
|
+
* 分组的本地化键,如 "wiki:itemGroup.name.ore";同时可用作物品/方块的 menu_category.group
|
|
2822
|
+
*/
|
|
2823
|
+
name?: string;
|
|
2824
|
+
}
|
|
2825
|
+
/**
|
|
2826
|
+
* 物品目录
|
|
2827
|
+
* 生成 BP/item_catalog/crafting_item_catalog.json,
|
|
2828
|
+
* 用于指定物品在创造菜单与配方手册中的分组位置。
|
|
2829
|
+
*/
|
|
2830
|
+
declare class ItemCatalog {
|
|
2831
|
+
format_version: string;
|
|
2832
|
+
private categories;
|
|
2833
|
+
/**
|
|
2834
|
+
* @param format_version 格式版本,默认 "1.26.30"
|
|
2835
|
+
*/
|
|
2836
|
+
constructor(format_version?: string);
|
|
2837
|
+
/**
|
|
2838
|
+
* 添加一组物品到指定分类
|
|
2839
|
+
* @param category 创造菜单分类(construction/equipment/items/nature)
|
|
2840
|
+
* @param items 物品标识符列表
|
|
2841
|
+
* @param options 可展开分组配置
|
|
2842
|
+
* @returns 当前实例,支持链式调用
|
|
2843
|
+
*/
|
|
2844
|
+
addGroup(category: ItemCatalogCategory, items: string[], options?: ItemCatalogGroupOptions): this;
|
|
2845
|
+
/**
|
|
2846
|
+
* 添加单个物品到指定分类
|
|
2847
|
+
* @param category 创造菜单分类(construction/equipment/items/nature)
|
|
2848
|
+
* @param item 物品标识符
|
|
2849
|
+
* @param options 可展开分组配置
|
|
2850
|
+
* @returns 当前实例,支持链式调用
|
|
2851
|
+
*/
|
|
2852
|
+
addItem(category: ItemCatalogCategory, item: string, options?: ItemCatalogGroupOptions): this;
|
|
2853
|
+
/**
|
|
2854
|
+
* 注册到行为包的 item_catalog/ 目录
|
|
2855
|
+
* @returns 当前实例
|
|
2856
|
+
*/
|
|
2857
|
+
register(): this;
|
|
2858
|
+
/**
|
|
2859
|
+
* 将物品目录转换为 JSON 格式
|
|
2860
|
+
* @returns JSON 格式的物品目录对象
|
|
2861
|
+
*/
|
|
2862
|
+
toObject(): Record<string, any>;
|
|
2082
2863
|
}
|
|
2083
2864
|
|
|
2865
|
+
declare const ItemAPI: {
|
|
2866
|
+
/**
|
|
2867
|
+
* 创建一个普通物品。
|
|
2868
|
+
* @param identifier 物品的唯一标识符。
|
|
2869
|
+
* @param category 物品在创造菜单中的分类,见 {@link ItemCategory}。
|
|
2870
|
+
* @param texture 物品的纹理。
|
|
2871
|
+
* @param options 额外选项。
|
|
2872
|
+
* @returns 创建的物品。
|
|
2873
|
+
*/
|
|
2874
|
+
createItem(identifier: string, category: ItemCategory, texture: string, options?: ItemOptions): Item;
|
|
2875
|
+
/**
|
|
2876
|
+
* 创建一个大型物品(Item + Attachable)。
|
|
2877
|
+
* 用于在手持时显示为大型 3D 模型(如部分 3D 物品)。
|
|
2878
|
+
* @param identifier 物品的唯一标识符。
|
|
2879
|
+
* @param category 物品在创造菜单中的分类,见 {@link ItemCategory}。
|
|
2880
|
+
* @param texture 物品的纹理。
|
|
2881
|
+
* @param options 额外选项。
|
|
2882
|
+
* @returns 创建的物品。
|
|
2883
|
+
*/
|
|
2884
|
+
createLargeItem(identifier: string, category: ItemCategory, texture: string, options?: ItemOptions): Item;
|
|
2885
|
+
/**
|
|
2886
|
+
* 创建一个 3D 手持物品(Item + Attachable + 内置默认握持动画)。
|
|
2887
|
+
* 采用 Bedrock Wiki "Attachables" 的 Method 2(model binding):attachable 使用
|
|
2888
|
+
* scripts.animate 按 context.is_first_person 切换首/第三人称动画,并搭配
|
|
2889
|
+
* controller.render.item_default 渲染控制器。内置动画姿态参照官方示例
|
|
2890
|
+
* (首/第三人称各用固定值),骨骼名须与用户 geometry 中的根骨骼一致。
|
|
2891
|
+
* 用户需自行将几何模型放入 RP(geometry 根骨骼应使用
|
|
2892
|
+
* "q.item_slot_to_bone_name(c.item_slot)" 绑定槽位)。
|
|
2893
|
+
* @param identifier 物品的唯一标识符(如 "my_mod:model_sword")。
|
|
2894
|
+
* @param category 物品在创造菜单中的分类,见 {@link ItemCategory}。
|
|
2895
|
+
* @param icon 物品图标(创造菜单/物品栏显示的短名,需登记在 item_texture.json)。
|
|
2896
|
+
* 与 texture 相互独立,可分别指定。
|
|
2897
|
+
* @param texture attachable 的 3D 贴图路径。传完整路径(如 "textures/entity/skeleton/skeleton")
|
|
2898
|
+
* 将直接用作贴图;传短名(如 "amethyst_shard")则自动拼接 "textures/items/" 前缀。
|
|
2899
|
+
* @param geometry 用户几何标识符(如 "geometry.my_model")。
|
|
2900
|
+
* @param options 额外选项,见 {@link CreateModelItemOptions}。
|
|
2901
|
+
* @returns 创建的物品。
|
|
2902
|
+
*/
|
|
2903
|
+
createModelItem(identifier: string, category: ItemCategory, icon: string, texture: string, geometry: string, options?: CreateModelItemOptions): Item;
|
|
2904
|
+
/**
|
|
2905
|
+
* 创建一个食物物品。
|
|
2906
|
+
* @param identifier 食物的唯一标识符。
|
|
2907
|
+
* @param category 食物在创造菜单中的分类,见 {@link ItemCategory}。
|
|
2908
|
+
* @param texture 食物的纹理。
|
|
2909
|
+
* @param options 额外选项。
|
|
2910
|
+
* @returns 创建的食物物品。
|
|
2911
|
+
*/
|
|
2912
|
+
createFood(identifier: string, category: ItemCategory, texture: string, options?: FoodOptions): Food;
|
|
2913
|
+
/**
|
|
2914
|
+
* 创建一个可附着物品。
|
|
2915
|
+
* @param identifier 可附着物品的唯一标识符。
|
|
2916
|
+
* @param texture 可附着物品的纹理。
|
|
2917
|
+
* @param material 可附着物品的材质。
|
|
2918
|
+
* @param options 额外选项。
|
|
2919
|
+
* @returns 创建的可附着物品。
|
|
2920
|
+
*/
|
|
2921
|
+
createAttachable(identifier: string, texture: string, material: string, options?: ItemOptions): Attachable;
|
|
2922
|
+
/**
|
|
2923
|
+
* 创建一个胸甲(Item + Attachable)。
|
|
2924
|
+
* @param identifier 物品的唯一标识符。
|
|
2925
|
+
* @param item_texture 物品图标纹理名称。
|
|
2926
|
+
* @param texture_path 盔甲模型纹理路径。
|
|
2927
|
+
* @param options 额外选项。
|
|
2928
|
+
* @returns 创建的盔甲实例。
|
|
2929
|
+
*/
|
|
2930
|
+
createChestplateArmor(identifier: string, item_texture: string, texture_path: string, options?: ItemOptions): Armor;
|
|
2931
|
+
/**
|
|
2932
|
+
* 创建一个头盔(Item + Attachable)。
|
|
2933
|
+
*/
|
|
2934
|
+
createHelmetArmor(identifier: string, item_texture: string, texture_path: string, options?: ItemOptions): Armor;
|
|
2935
|
+
/**
|
|
2936
|
+
* 创建一个靴子(Item + Attachable)。
|
|
2937
|
+
*/
|
|
2938
|
+
createBootArmor(identifier: string, item_texture: string, texture_path: string, options?: ItemOptions): Armor;
|
|
2939
|
+
/**
|
|
2940
|
+
* 创建一个护腿(Item + Attachable)。
|
|
2941
|
+
*/
|
|
2942
|
+
createLeggingsArmor(identifier: string, item_texture: string, texture_path: string, options?: ItemOptions): Armor;
|
|
2943
|
+
/**
|
|
2944
|
+
* 创建并注册翻书物品。
|
|
2945
|
+
* @param identifier 物品的唯一标识符(如:"my_mod:flipbook_item")。
|
|
2946
|
+
* @param category 物品所属的分类,见 {@link ItemCategory}。
|
|
2947
|
+
* @param texture 纹理名称(不包含路径和后缀,如:"my_flipbook_texture")。
|
|
2948
|
+
* @param options 可选的配置参数对象。
|
|
2949
|
+
* @returns 创建的翻书物品。
|
|
2950
|
+
*/
|
|
2951
|
+
createFlipbookItem(identifier: string, category: ItemCategory, texture: string, options?: FlipbookItemOptions): FlipbookItem;
|
|
2952
|
+
/**
|
|
2953
|
+
* 创建物品目录(生成 BP/item_catalog/crafting_item_catalog.json)。
|
|
2954
|
+
* 用于指定物品在创造菜单与配方手册中的分组位置。
|
|
2955
|
+
* @param formatVersion 格式版本,默认 "1.26.30"
|
|
2956
|
+
* @returns 物品目录实例
|
|
2957
|
+
*/
|
|
2958
|
+
createItemCatalog(formatVersion?: string): ItemCatalog;
|
|
2959
|
+
};
|
|
2960
|
+
|
|
2084
2961
|
declare const RecipeAPI: RecipeRegistry;
|
|
2085
2962
|
declare class RecipeRegistry {
|
|
2086
2963
|
/**
|
|
@@ -2870,129 +3747,354 @@ declare namespace UiAPI {
|
|
|
2870
3747
|
declare class ItemComponent {
|
|
2871
3748
|
/**
|
|
2872
3749
|
* 设置交互按钮
|
|
2873
|
-
* @param
|
|
3750
|
+
* @param interact_text 交互文本;传 true 使用通用 "Use Item" 文案,传 false 不显示
|
|
2874
3751
|
* @returns 交互按钮组件
|
|
2875
3752
|
*/
|
|
2876
|
-
static setInteractButton(interact_text: string):
|
|
3753
|
+
static setInteractButton(interact_text: string | boolean): ItemComponentMap;
|
|
2877
3754
|
/**
|
|
2878
3755
|
* 自定义物品组件
|
|
2879
3756
|
* [warning] 需要物品格式版本 format_version >1.21.90 and Scripting V2.0.0
|
|
2880
|
-
* @param
|
|
2881
|
-
* @param
|
|
2882
|
-
* @returns
|
|
3757
|
+
* @param component_id 组件标识符
|
|
3758
|
+
* @param params 自定义参数接口对象
|
|
3759
|
+
* @returns 物品组件 Map
|
|
2883
3760
|
*/
|
|
2884
|
-
static setCustomComponentV2(component_id: string, params: object):
|
|
3761
|
+
static setCustomComponentV2(component_id: string, params: object): ItemComponentMap;
|
|
2885
3762
|
/**
|
|
2886
3763
|
* 物品的耐久度组件
|
|
2887
|
-
* @param
|
|
2888
|
-
* @param
|
|
2889
|
-
* @param
|
|
2890
|
-
* @returns
|
|
2891
|
-
*/
|
|
2892
|
-
static setDurability(max_durability: number, damage_chance_min?: number, damage_chance_max?: number):
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
3764
|
+
* @param max_durability 最大耐久
|
|
3765
|
+
* @param damage_chance_min 损坏最小几率
|
|
3766
|
+
* @param damage_chance_max 损坏最大几率
|
|
3767
|
+
* @returns 耐久度组件 Map
|
|
3768
|
+
*/
|
|
3769
|
+
static setDurability(max_durability: number, damage_chance_min?: number, damage_chance_max?: number): ItemComponentMap;
|
|
3770
|
+
/**
|
|
3771
|
+
* 设置放置方块组件
|
|
3772
|
+
* @param block 被放置的方块标识符
|
|
3773
|
+
* @param options 放置配置
|
|
3774
|
+
* @param options.replaceBlockItem 是否替换原方块物品
|
|
3775
|
+
* @param options.alignedPlacement 是否启用对齐放置
|
|
3776
|
+
* @param options.useOn 允许放置的目标方块描述符列表;省略则可放置于任何方块
|
|
3777
|
+
* @returns 组件 Map
|
|
3778
|
+
*/
|
|
3779
|
+
static setBlockPlacer(block: string, options?: BlockPlacerOptions): ItemComponentMap;
|
|
3780
|
+
/**
|
|
3781
|
+
* 设置自定义组件列表
|
|
3782
|
+
* @param custom_components 自定义组件 ID 数组
|
|
3783
|
+
* @returns 组件 Map
|
|
3784
|
+
*/
|
|
3785
|
+
static setCustomComponents(custom_components: string[]): ItemComponentMap;
|
|
2900
3786
|
/**
|
|
2901
3787
|
* 设置物品的可投掷组件。
|
|
2902
|
-
* @param
|
|
2903
|
-
* @param
|
|
2904
|
-
* @param
|
|
2905
|
-
* @param
|
|
2906
|
-
* @param
|
|
2907
|
-
* @param
|
|
2908
|
-
* @returns
|
|
3788
|
+
* @param doSwingAnimation 是否使用挥动动画。
|
|
3789
|
+
* @param launchPowerScale 投掷力量的缩放比例。
|
|
3790
|
+
* @param maxDrawDuration 最大蓄力时间。
|
|
3791
|
+
* @param maxLaunchPower 最大投掷力量。
|
|
3792
|
+
* @param minDrawDuration 最小蓄力时间。
|
|
3793
|
+
* @param scalePowerByDrawDuration 投掷力量是否随蓄力时间增加。
|
|
3794
|
+
* @returns 新的组件集合。
|
|
2909
3795
|
*/
|
|
2910
|
-
static setThrowable(doSwingAnimation?: boolean, launchPowerScale?: number, maxDrawDuration?: number, maxLaunchPower?: number, minDrawDuration?: number, scalePowerByDrawDuration?: boolean):
|
|
3796
|
+
static setThrowable(doSwingAnimation?: boolean, launchPowerScale?: number, maxDrawDuration?: number, maxLaunchPower?: number, minDrawDuration?: number, scalePowerByDrawDuration?: boolean): ItemComponentMap;
|
|
2911
3797
|
/**
|
|
2912
3798
|
* 设置物品的显示名称。
|
|
2913
|
-
* @param
|
|
2914
|
-
* @returns
|
|
3799
|
+
* @param displayName 显示名称或本地化键。
|
|
3800
|
+
* @returns 新的组件集合。
|
|
2915
3801
|
*/
|
|
2916
|
-
static setDisplayName(displayName: string):
|
|
3802
|
+
static setDisplayName(displayName: string): ItemComponentMap;
|
|
2917
3803
|
/**
|
|
2918
3804
|
* 设置物品的食物组件。
|
|
2919
|
-
* @param
|
|
2920
|
-
* @param
|
|
2921
|
-
* @param
|
|
2922
|
-
* @param
|
|
2923
|
-
* @
|
|
3805
|
+
* @param options 食物组件配置。
|
|
3806
|
+
* @param options.canAlwaysEat 是否随时可以食用。
|
|
3807
|
+
* @param options.nutrition 营养值。
|
|
3808
|
+
* @param options.saturationModifier 饱和度修正值。
|
|
3809
|
+
* @param options.usingConvertsTo 食用后转换的目标物品。
|
|
3810
|
+
* @returns 新的组件集合。
|
|
2924
3811
|
*/
|
|
2925
|
-
static setFoodComponent(
|
|
3812
|
+
static setFoodComponent(options?: FoodComponentOptions): ItemComponentMap;
|
|
2926
3813
|
/**
|
|
2927
3814
|
* 设置物品的燃料组件。
|
|
2928
|
-
* @param
|
|
2929
|
-
* @returns
|
|
3815
|
+
* @param duration 燃料燃烧的持续时间(秒),最小值为 0.05。
|
|
3816
|
+
* @returns 新的组件集合。
|
|
2930
3817
|
*/
|
|
2931
|
-
static setFuel(duration: number):
|
|
3818
|
+
static setFuel(duration: number): ItemComponentMap;
|
|
2932
3819
|
/**
|
|
2933
3820
|
* 设置物品的附魔光效组件。
|
|
2934
|
-
* @param
|
|
2935
|
-
* @returns
|
|
3821
|
+
* @param hasGlint 是否显示附魔光效。
|
|
3822
|
+
* @returns 新的组件集合。
|
|
2936
3823
|
*/
|
|
2937
|
-
static setGlint(hasGlint: boolean):
|
|
3824
|
+
static setGlint(hasGlint: boolean): ItemComponentMap;
|
|
2938
3825
|
/**
|
|
2939
3826
|
* 设置物品的手持渲染方式组件。
|
|
2940
|
-
* @param
|
|
2941
|
-
* @returns
|
|
3827
|
+
* @param isHandEquipped 是否像工具一样渲染。
|
|
3828
|
+
* @returns 新的组件集合。
|
|
2942
3829
|
*/
|
|
2943
|
-
static setHandEquipped(isHandEquipped: boolean):
|
|
3830
|
+
static setHandEquipped(isHandEquipped: boolean): ItemComponentMap;
|
|
2944
3831
|
/**
|
|
2945
3832
|
* 设置物品的图标组件。
|
|
2946
|
-
*
|
|
2947
|
-
* @
|
|
3833
|
+
* 支持字符串(default 纹理)或对象(多纹理)两种格式。
|
|
3834
|
+
* @param texture 图标纹理名称,或包含 default/dyed/iconTrim 等纹理的对象。
|
|
3835
|
+
* @returns 新的组件集合。
|
|
2948
3836
|
*/
|
|
2949
|
-
static setIcon(texture: string):
|
|
3837
|
+
static setIcon(texture: string | IconTextures): ItemComponentMap;
|
|
2950
3838
|
/**
|
|
2951
3839
|
* 设置物品的最大堆叠数量组件。
|
|
2952
|
-
* @param
|
|
2953
|
-
* @returns
|
|
3840
|
+
* @param maxStackSize 最大堆叠数量,默认值为 64。
|
|
3841
|
+
* @returns 新的组件集合。
|
|
2954
3842
|
*/
|
|
2955
|
-
static setMaxStackSize(maxStackSize?: number):
|
|
3843
|
+
static setMaxStackSize(maxStackSize?: number): ItemComponentMap;
|
|
2956
3844
|
/**
|
|
2957
3845
|
* 设置物品的投射物组件。
|
|
2958
|
-
* @param
|
|
2959
|
-
* @param
|
|
2960
|
-
* @returns
|
|
3846
|
+
* @param minimumCriticalPower 投射物需要蓄力多久才能造成暴击。
|
|
3847
|
+
* @param projectileEntity 作为投射物发射的实体名称。
|
|
3848
|
+
* @returns 新的组件集合。
|
|
2961
3849
|
*/
|
|
2962
|
-
static setProjectile(minimumCriticalPower?: number, projectileEntity?: string):
|
|
3850
|
+
static setProjectile(minimumCriticalPower?: number, projectileEntity?: string): ItemComponentMap;
|
|
2963
3851
|
/**
|
|
2964
3852
|
* 设置物品的使用修饰组件。
|
|
2965
|
-
* @param
|
|
2966
|
-
* @param
|
|
2967
|
-
* @
|
|
3853
|
+
* @param options 使用修饰配置。
|
|
3854
|
+
* @param options.movementModifier 使用物品时玩家移动速度的缩放值(0.0-1.0)。
|
|
3855
|
+
* @param options.useDuration 物品使用所需的时间(秒)。
|
|
3856
|
+
* @param options.emitVibrations 是否在开始/停止使用时发出振动。
|
|
3857
|
+
* @param options.startSound 开始使用时触发的音效。
|
|
3858
|
+
* @param options.startUsing 使用修饰生效的时机("always" 或 "if_first")。
|
|
3859
|
+
* @returns 新的组件集合。
|
|
2968
3860
|
*/
|
|
2969
|
-
static setUseModifiers(
|
|
3861
|
+
static setUseModifiers(options?: UseModifiersOptions): ItemComponentMap;
|
|
2970
3862
|
/**
|
|
2971
3863
|
* 设置物品的可穿戴组件。
|
|
2972
|
-
* @param
|
|
2973
|
-
* @param
|
|
2974
|
-
* @
|
|
3864
|
+
* @param protection 物品提供的保护值。
|
|
3865
|
+
* @param slot 物品可以穿戴的槽位(如 "slot.armor.head"、"slot.weapon.offhand" 等)。
|
|
3866
|
+
* @param hidesPlayerLocation 穿戴时是否从定位栏与定位地图中隐藏。
|
|
3867
|
+
* @returns 新的组件集合。
|
|
2975
3868
|
*/
|
|
2976
|
-
static setWearable(protection?: number, slot?: string):
|
|
3869
|
+
static setWearable(protection?: number, slot?: string, hidesPlayerLocation?: boolean): ItemComponentMap;
|
|
2977
3870
|
/**
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
3871
|
+
* 设置物品的使用动画组件。
|
|
3872
|
+
* @param animation 物品使用时的动画类型(如 "eat"、"drink" 等)。
|
|
3873
|
+
* @returns 新的组件集合。
|
|
3874
|
+
*/
|
|
3875
|
+
static setUseAnimation(animation: string): ItemComponentMap;
|
|
3876
|
+
/**
|
|
3877
|
+
* 设置物品是否可装备至副手。
|
|
3878
|
+
* @param allowed 是否允许装备至副手。
|
|
3879
|
+
* @returns 新的组件集合。
|
|
3880
|
+
*/
|
|
3881
|
+
static setAllowOffHand(allowed: boolean): ItemComponentMap;
|
|
3882
|
+
/**
|
|
3883
|
+
* 设置 Bundle 交互组件(需要同时具备 storage_item 组件)。
|
|
3884
|
+
* @param numViewableSlots 可查看的槽位数量(1-64)。
|
|
3885
|
+
* @returns 新的组件集合。
|
|
3886
|
+
*/
|
|
3887
|
+
static setBundleInteraction(numViewableSlots: number): ItemComponentMap;
|
|
3888
|
+
/**
|
|
3889
|
+
* 设置创造模式下能否破坏方块。
|
|
3890
|
+
* @param canDestroy 是否可破坏。
|
|
3891
|
+
* @returns 新的组件集合。
|
|
3892
|
+
*/
|
|
3893
|
+
static setCanDestroyInCreative(canDestroy: boolean): ItemComponentMap;
|
|
3894
|
+
/**
|
|
3895
|
+
* 设置堆肥组件。
|
|
3896
|
+
* @param compostingChance 堆肥等级增加的概率(0-100)。
|
|
3897
|
+
* @returns 新的组件集合。
|
|
3898
|
+
*/
|
|
3899
|
+
static setCompostable(compostingChance: number): ItemComponentMap;
|
|
3900
|
+
/**
|
|
3901
|
+
* 设置物品的冷却组件。
|
|
3902
|
+
* @param options 冷却配置。
|
|
3903
|
+
* @param options.category 冷却分类,相同分类的物品共享冷却。
|
|
3904
|
+
* @param options.duration 冷却时长(秒),负数会使物品无法使用。
|
|
3905
|
+
* @param options.type 冷却影响的输入类型("use" 或 "attack")。
|
|
3906
|
+
* @returns 新的组件集合。
|
|
3907
|
+
*/
|
|
3908
|
+
static setCooldown(options: CooldownOptions): ItemComponentMap;
|
|
3909
|
+
/**
|
|
3910
|
+
* 设置物品的伤害组件。
|
|
3911
|
+
* @param damage 额外伤害值(0-32767)。
|
|
3912
|
+
* @returns 新的组件集合。
|
|
3913
|
+
*/
|
|
3914
|
+
static setDamage(damage: number): ItemComponentMap;
|
|
3915
|
+
/**
|
|
3916
|
+
* 设置伤害吸收组件(需要同时具备 durability 组件并装备于盔甲槽位)。
|
|
3917
|
+
* @param absorbableCauses 可被吸收的伤害原因列表,如 ["all"]。
|
|
3918
|
+
* @returns 新的组件集合。
|
|
3919
|
+
*/
|
|
3920
|
+
static setDamageAbsorption(absorbableCauses: string[]): ItemComponentMap;
|
|
3921
|
+
/**
|
|
3922
|
+
* 设置挖掘组件。
|
|
3923
|
+
* @param options 挖掘配置。
|
|
3924
|
+
* @param options.destroySpeeds 破坏速度列表,speed 为 0 表示无法破坏该方块。
|
|
3925
|
+
* @param options.useEfficiency 效率附魔是否能影响破坏速度。
|
|
3926
|
+
* @returns 新的组件集合。
|
|
3927
|
+
*/
|
|
3928
|
+
static setDigger(options: DiggerOptions): ItemComponentMap;
|
|
3929
|
+
/**
|
|
3930
|
+
* 设置耐久传感器组件。
|
|
3931
|
+
* @param options 耐久传感器配置。
|
|
3932
|
+
* @param options.durabilityThresholds 耐久阈值列表,达到阈值时触发粒子或音效。
|
|
3933
|
+
* @returns 新的组件集合。
|
|
3934
|
+
*/
|
|
3935
|
+
static setDurabilitySensor(options: DurabilitySensorOptions): ItemComponentMap;
|
|
3936
|
+
/**
|
|
3937
|
+
* 设置可染色组件。
|
|
3938
|
+
* @param defaultColor 默认颜色,如 "#ffffff"。
|
|
3939
|
+
* @returns 新的组件集合。
|
|
3940
|
+
*/
|
|
3941
|
+
static setDyeable(defaultColor: string): ItemComponentMap;
|
|
3942
|
+
/**
|
|
3943
|
+
* 设置可附魔组件。
|
|
3944
|
+
* @param slot 可应用的附魔槽位,如 "sword"、"bow"。
|
|
3945
|
+
* @param value 附魔质量与数量(0-255)。
|
|
3946
|
+
* @returns 新的组件集合。
|
|
3947
|
+
*/
|
|
3948
|
+
static setEnchantable(slot: string, value: number): ItemComponentMap;
|
|
3949
|
+
/**
|
|
3950
|
+
* 设置放置实体组件。
|
|
3951
|
+
* @param entity 被放置的实体标识符,可带出生事件如 "wiki:entity<wiki:event>"。
|
|
3952
|
+
* @param options 放置配置。
|
|
3953
|
+
* @param options.dispenseOn 允许发射器放置的目标方块列表。
|
|
3954
|
+
* @param options.useOn 允许放置的目标方块列表。
|
|
3955
|
+
* @returns 新的组件集合。
|
|
3956
|
+
*/
|
|
3957
|
+
static setEntityPlacer(entity: string, options?: EntityPlacerOptions): ItemComponentMap;
|
|
3958
|
+
/**
|
|
3959
|
+
* 设置防火组件。
|
|
3960
|
+
* @param value 是否防火。
|
|
3961
|
+
* @returns 新的组件集合。
|
|
3962
|
+
*/
|
|
3963
|
+
static setFireResistant(value: boolean): ItemComponentMap;
|
|
3964
|
+
/**
|
|
3965
|
+
* 设置物品名颜色组件。
|
|
3966
|
+
* @param color 颜色名称,如 "minecoin_gold"。
|
|
3967
|
+
* @returns 新的组件集合。
|
|
3968
|
+
*/
|
|
3969
|
+
static setHoverTextColor(color: string): ItemComponentMap;
|
|
3970
|
+
/**
|
|
3971
|
+
* 设置动能武器组件。
|
|
3972
|
+
* @param options 动能武器配置。
|
|
3973
|
+
* @param options.delay 动能伤害开始生效前的延迟(tick)。
|
|
3974
|
+
* @param options.hitboxMargin 命中箱额外边距(格)。
|
|
3975
|
+
* @param options.reach 生效距离范围(格)。
|
|
3976
|
+
* @param options.creativeReach 创造模式下生效距离范围(格)。
|
|
3977
|
+
* @param options.damageMultiplier 基础伤害倍率。
|
|
3978
|
+
* @param options.damageModifier 附加伤害。
|
|
3979
|
+
* @param options.damageConditions 造成伤害的条件。
|
|
3980
|
+
* @param options.dismountConditions 解除骑乘的条件。
|
|
3981
|
+
* @param options.knockbackConditions 造成击退的条件。
|
|
3982
|
+
* @returns 新的组件集合。
|
|
3983
|
+
*/
|
|
3984
|
+
static setKineticWeapon(options: KineticWeaponOptions): ItemComponentMap;
|
|
3985
|
+
/**
|
|
3986
|
+
* 设置物品是否与液体方块交互。
|
|
3987
|
+
* @param clipped 是否在液体内部交互。
|
|
3988
|
+
* @returns 新的组件集合。
|
|
3989
|
+
*/
|
|
3990
|
+
static setLiquidClipped(clipped: boolean): ItemComponentMap;
|
|
3991
|
+
/**
|
|
3992
|
+
* 设置穿刺武器组件。
|
|
3993
|
+
* @param options 穿刺武器配置。
|
|
3994
|
+
* @param options.hitboxMargin 命中箱额外边距(格)。
|
|
3995
|
+
* @param options.reach 生效距离范围(格)。
|
|
3996
|
+
* @param options.creativeReach 创造模式下生效距离范围(格)。
|
|
3997
|
+
* @returns 新的组件集合。
|
|
3998
|
+
*/
|
|
3999
|
+
static setPiercingWeapon(options?: PiercingWeaponOptions): ItemComponentMap;
|
|
4000
|
+
/**
|
|
4001
|
+
* 设置物品稀有度组件(会被 hover_text_color 覆盖)。
|
|
4002
|
+
* @param rarity 稀有度:"common"、"uncommon"、"rare"、"epic"。
|
|
4003
|
+
* @returns 新的组件集合。
|
|
4004
|
+
*/
|
|
4005
|
+
static setRarity(rarity: ItemRarity): ItemComponentMap;
|
|
4006
|
+
/**
|
|
4007
|
+
* 设置唱片组件。
|
|
4008
|
+
* @param options 唱片配置。
|
|
4009
|
+
* @param options.comparatorSignal 比较器信号强度(0-15)。
|
|
4010
|
+
* @param options.duration 播放时长(秒)。
|
|
4011
|
+
* @param options.soundEvent 播放的原版音效事件。
|
|
4012
|
+
* @returns 新的组件集合。
|
|
4013
|
+
*/
|
|
4014
|
+
static setRecord(options: RecordOptions): ItemComponentMap;
|
|
4015
|
+
/**
|
|
4016
|
+
* 设置可修复组件。
|
|
4017
|
+
* @param repairItems 修复条目列表;repair_amount 可为数字或 Molang 表达式字符串。
|
|
4018
|
+
* @returns 新的组件集合。
|
|
4019
|
+
*/
|
|
4020
|
+
static setRepairable(repairItems: RepairItem[]): ItemComponentMap;
|
|
4021
|
+
/**
|
|
4022
|
+
* 设置射击组件(需要同时具备 use_modifiers 组件)。
|
|
4023
|
+
* @param options 射击配置。
|
|
4024
|
+
* @param options.ammunition 弹药列表,item 必须具有 projectile 组件。
|
|
4025
|
+
* @param options.chargeOnDraw 是否在拉弓时上弹(如弩)。
|
|
4026
|
+
* @param options.maxDrawDuration 自动发射前的最大拉弓时长(秒)。
|
|
4027
|
+
* @param options.scalePowerByDrawDuration 发射威力是否随拉弓时长增加。
|
|
4028
|
+
* @returns 新的组件集合。
|
|
4029
|
+
*/
|
|
4030
|
+
static setShooter(options: ShooterOptions): ItemComponentMap;
|
|
4031
|
+
/**
|
|
4032
|
+
* 设置是否应该消失组件。
|
|
4033
|
+
* @param shouldDespawn 掉落物是否最终消失。
|
|
4034
|
+
* @returns 新的组件集合。
|
|
4035
|
+
*/
|
|
4036
|
+
static setShouldDespawn(shouldDespawn: boolean): ItemComponentMap;
|
|
4037
|
+
/**
|
|
4038
|
+
* 设置按数据堆叠组件。
|
|
4039
|
+
* @param stackedByData 不同数据值的同种物品是否分开堆叠。
|
|
4040
|
+
* @returns 新的组件集合。
|
|
4041
|
+
*/
|
|
4042
|
+
static setStackedByData(stackedByData: boolean): ItemComponentMap;
|
|
4043
|
+
/**
|
|
4044
|
+
* 设置容器物品组件(需要 max_stack_size 为 1)。
|
|
4045
|
+
* @param options 容器配置。
|
|
4046
|
+
* @param options.maxSlots 容器槽位数量(1-64)。
|
|
4047
|
+
* @param options.allowNestedStorageItems 是否允许嵌套其他容器物品。
|
|
4048
|
+
* @param options.allowedItems 仅允许存入的物品列表。
|
|
4049
|
+
* @param options.bannedItems 禁止存入的物品列表。
|
|
4050
|
+
* @returns 新的组件集合。
|
|
4051
|
+
*/
|
|
4052
|
+
static setStorageItem(options: StorageItemOptions): ItemComponentMap;
|
|
4053
|
+
/**
|
|
4054
|
+
* 设置容器重量上限组件(需要同时具备 storage_item 组件)。
|
|
4055
|
+
* @param maxWeightLimit 容器内物品总重量上限。
|
|
4056
|
+
* @returns 新的组件集合。
|
|
4057
|
+
*/
|
|
4058
|
+
static setStorageWeightLimit(maxWeightLimit: number): ItemComponentMap;
|
|
4059
|
+
/**
|
|
4060
|
+
* 设置容器重量修正组件(0 表示不允许放入其他容器)。
|
|
4061
|
+
* @param weightInStorageItem 该物品放入容器时占用的重量(0-64)。
|
|
4062
|
+
* @returns 新的组件集合。
|
|
4063
|
+
*/
|
|
4064
|
+
static setStorageWeightModifier(weightInStorageItem: number): ItemComponentMap;
|
|
4065
|
+
/**
|
|
4066
|
+
* 设置挥动时长组件。
|
|
4067
|
+
* @param value 基础挥动时长(秒)。
|
|
4068
|
+
* @returns 新的组件集合。
|
|
4069
|
+
*/
|
|
4070
|
+
static setSwingDuration(value: number): ItemComponentMap;
|
|
4071
|
+
/**
|
|
4072
|
+
* 设置挥砍音效组件。
|
|
4073
|
+
* @param options 音效配置。
|
|
4074
|
+
* @param options.attackMiss 未命中时播放的原版音效。
|
|
4075
|
+
* @param options.attackHit 普通命中时播放的原版音效。
|
|
4076
|
+
* @param options.attackCriticalHit 暴击命中时播放的原版音效。
|
|
4077
|
+
* @returns 新的组件集合。
|
|
4078
|
+
*/
|
|
4079
|
+
static setSwingSounds(options?: SwingSoundsOptions): ItemComponentMap;
|
|
4080
|
+
/**
|
|
4081
|
+
* 设置物品标签组件。
|
|
4082
|
+
* @param tags 标签列表。
|
|
4083
|
+
* @returns 新的组件集合。
|
|
4084
|
+
*/
|
|
4085
|
+
static setTags(tags: string[]): ItemComponentMap;
|
|
2984
4086
|
/**
|
|
2985
4087
|
* 将多个组件集合合并为一个。
|
|
2986
|
-
* @param
|
|
2987
|
-
* @returns
|
|
4088
|
+
* @param componentMaps 多个组件集合。
|
|
4089
|
+
* @returns 合并后的组件集合。
|
|
2988
4090
|
*/
|
|
2989
|
-
static combineComponents(...componentMaps:
|
|
4091
|
+
static combineComponents(...componentMaps: ItemComponentMap[]): ItemComponentMap;
|
|
2990
4092
|
/**
|
|
2991
4093
|
* 获取当前组件的 JSON 表示。
|
|
2992
|
-
* @param
|
|
2993
|
-
* @returns
|
|
4094
|
+
* @param components 组件集合。
|
|
4095
|
+
* @returns 组件的 JSON 对象。
|
|
2994
4096
|
*/
|
|
2995
|
-
static toJSON(components:
|
|
4097
|
+
static toJSON(components: ItemComponentMap): Record<string, unknown>;
|
|
2996
4098
|
}
|
|
2997
4099
|
|
|
2998
4100
|
/**
|
|
@@ -3665,68 +4767,120 @@ declare class Guidebook {
|
|
|
3665
4767
|
#private;
|
|
3666
4768
|
}
|
|
3667
4769
|
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
4770
|
+
type CustomButtonConfig = {
|
|
4771
|
+
id: string;
|
|
4772
|
+
position: "bottom_left" | "bottom_right" | "bottom_middle" | "top_left" | "top_right";
|
|
4773
|
+
offset: [number, number];
|
|
4774
|
+
size: [number | string, number | string];
|
|
4775
|
+
defaultTexture: string;
|
|
4776
|
+
hoverTexture: string;
|
|
4777
|
+
pressedTexture: string;
|
|
4778
|
+
bindingButtonName: string;
|
|
4779
|
+
};
|
|
4780
|
+
type ButtonTextures = {
|
|
4781
|
+
prevDefault?: string;
|
|
4782
|
+
prevHover?: string;
|
|
4783
|
+
prevPressed?: string;
|
|
4784
|
+
nextDefault?: string;
|
|
4785
|
+
nextHover?: string;
|
|
4786
|
+
nextPressed?: string;
|
|
4787
|
+
homeDefault?: string;
|
|
4788
|
+
homeHover?: string;
|
|
4789
|
+
homePressed?: string;
|
|
4790
|
+
closeDefault?: string;
|
|
4791
|
+
closeHover?: string;
|
|
4792
|
+
closePressed?: string;
|
|
4793
|
+
};
|
|
4794
|
+
type NeoGuidebookOptions = {
|
|
4795
|
+
size?: [number, number];
|
|
4796
|
+
background?: string;
|
|
4797
|
+
debug?: boolean;
|
|
4798
|
+
buttons?: {
|
|
4799
|
+
prev?: {
|
|
4800
|
+
visible?: boolean;
|
|
4801
|
+
};
|
|
4802
|
+
next?: {
|
|
4803
|
+
visible?: boolean;
|
|
4804
|
+
};
|
|
4805
|
+
home?: {
|
|
4806
|
+
visible?: boolean;
|
|
4807
|
+
};
|
|
4808
|
+
close?: {
|
|
4809
|
+
visible?: boolean;
|
|
4810
|
+
};
|
|
4811
|
+
};
|
|
4812
|
+
textures?: ButtonTextures;
|
|
4813
|
+
};
|
|
3675
4814
|
declare class NeoGuidebook {
|
|
3676
|
-
private
|
|
4815
|
+
private identifier;
|
|
3677
4816
|
private book_pages;
|
|
3678
4817
|
private size;
|
|
3679
4818
|
private background_image;
|
|
3680
4819
|
private debug_mode;
|
|
3681
4820
|
private system;
|
|
3682
|
-
private
|
|
3683
|
-
private
|
|
4821
|
+
private content_panel_name;
|
|
4822
|
+
private content_panel_id;
|
|
4823
|
+
private buttons_panel_name;
|
|
4824
|
+
private buttons_panel_id;
|
|
3684
4825
|
private root_panel_elements;
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
4826
|
+
private custom_buttons;
|
|
4827
|
+
private button_visibility;
|
|
4828
|
+
private textures;
|
|
4829
|
+
private dirty;
|
|
4830
|
+
constructor(identifier: string, path: string, size?: [number, number], options?: NeoGuidebookOptions);
|
|
4831
|
+
getPageIds(): string[];
|
|
4832
|
+
getPageCount(): number;
|
|
4833
|
+
addCustomButton(config: CustomButtonConfig): this;
|
|
3692
4834
|
addSinglePageStack(page_id: string, page_content: Panel): void;
|
|
3693
|
-
|
|
3694
|
-
|
|
4835
|
+
addDoublePageStack(page_id: string, left_page: Panel, right_page: Panel, ratio?: [string, string]): void;
|
|
4836
|
+
private flush;
|
|
3695
4837
|
private createPagesPanel;
|
|
3696
4838
|
private initUI;
|
|
3697
|
-
private
|
|
3698
|
-
|
|
4839
|
+
private createNavButtons;
|
|
4840
|
+
private createCustomButtons;
|
|
4841
|
+
private updateUI;
|
|
4842
|
+
private tex;
|
|
3699
4843
|
private createCloseButton;
|
|
3700
|
-
/** 创建翻页按钮(通用方法) */
|
|
3701
4844
|
private createPageButton;
|
|
3702
|
-
/**创建返回章节目录按键 */
|
|
3703
4845
|
private createHomeButton;
|
|
3704
|
-
/**创建书页 */
|
|
3705
4846
|
private createBookPage;
|
|
3706
|
-
/**创建调试数据内容文本 */
|
|
3707
4847
|
private createDebugText;
|
|
3708
|
-
/**
|
|
3709
|
-
* 向系统注册一个元素
|
|
3710
|
-
* @param {UIElement} element
|
|
3711
|
-
*/
|
|
3712
4848
|
registerElement(element: UIElement): this;
|
|
3713
|
-
/**
|
|
3714
|
-
* 向根面板添加元素
|
|
3715
|
-
*/
|
|
3716
4849
|
addRootElement(element: UIElement): this;
|
|
3717
|
-
/**
|
|
3718
|
-
* 向根面板添加多个元素
|
|
3719
|
-
* @param {Array} elements
|
|
3720
|
-
*/
|
|
3721
4850
|
addRootElements(elements: UIElement[]): this;
|
|
3722
4851
|
}
|
|
3723
4852
|
|
|
4853
|
+
/**
|
|
4854
|
+
* SapdonButton:sapdon 页面壳内的表单按钮。
|
|
4855
|
+
* 默认模板固定为 server_form.form_button(集合按钮,吃 form_buttons 数据)。
|
|
4856
|
+
*/
|
|
4857
|
+
declare class SapdonButton extends UIElement {
|
|
4858
|
+
constructor(id: string);
|
|
4859
|
+
/** 设置锚点对齐(如 bottom_left / bottom_right / top_right),默认尺寸 32×32 */
|
|
4860
|
+
setAnchor(anchor: string): this;
|
|
4861
|
+
}
|
|
4862
|
+
/**
|
|
4863
|
+
* SapdonTexturedButton:sapdon 页面壳内的纹理按钮。
|
|
4864
|
+
* 默认模板固定为 server_form.sapdon_textured_button(三态纹理 + binding_button_text 门控)。
|
|
4865
|
+
*/
|
|
4866
|
+
declare class SapdonTexturedButton extends UIElement {
|
|
4867
|
+
constructor(id: string, bindingButtonName?: string);
|
|
4868
|
+
setDefaultTexture(texture: string): this;
|
|
4869
|
+
setHoverTexture(texture: string): this;
|
|
4870
|
+
setPressedTexture(texture: string): this;
|
|
4871
|
+
/** 设置锚点对齐 */
|
|
4872
|
+
setAnchor(anchor: string, size?: [number | string, number | string]): this;
|
|
4873
|
+
}
|
|
4874
|
+
|
|
3724
4875
|
declare class EmptySpace extends Panel {
|
|
3725
4876
|
constructor(id: string, size?: [string, string]);
|
|
3726
4877
|
}
|
|
3727
4878
|
declare class BookTitle extends Label {
|
|
3728
4879
|
constructor(id: string, title: string, size?: [string, string]);
|
|
3729
4880
|
}
|
|
4881
|
+
declare class BookText extends Label {
|
|
4882
|
+
constructor(id: string, text: string, size?: [string, string]);
|
|
4883
|
+
}
|
|
3730
4884
|
declare class BookTitleBar extends Panel {
|
|
3731
4885
|
private size;
|
|
3732
4886
|
constructor(id: string, text: string, size?: [string, string]);
|
|
@@ -3735,7 +4889,7 @@ declare class BookTitleBar extends Panel {
|
|
|
3735
4889
|
declare class Divider extends StackPanel {
|
|
3736
4890
|
constructor(id: string, size?: [string, string]);
|
|
3737
4891
|
}
|
|
3738
|
-
declare class BookButton extends
|
|
4892
|
+
declare class BookButton extends SapdonTexturedButton {
|
|
3739
4893
|
constructor(id: string, texture: string, size?: [string, string]);
|
|
3740
4894
|
}
|
|
3741
4895
|
declare class BookImage extends Image {
|
|
@@ -3751,7 +4905,7 @@ declare class BookRecipeGrid extends StackPanel {
|
|
|
3751
4905
|
constructor(id: string, row: number, col: number, items: string[]);
|
|
3752
4906
|
}
|
|
3753
4907
|
declare class ChapterItem extends Panel {
|
|
3754
|
-
constructor(index: number, chapterName: string, texture: string);
|
|
4908
|
+
constructor(index: number, chapterName: string, texture: string, prefix?: string);
|
|
3755
4909
|
}
|
|
3756
4910
|
declare class NeoGuidebookPage {
|
|
3757
4911
|
private panel;
|
|
@@ -3773,11 +4927,122 @@ declare class NeoGuidebookPage {
|
|
|
3773
4927
|
chapter_name: string;
|
|
3774
4928
|
chapter_texture: string;
|
|
3775
4929
|
}>): this;
|
|
3776
|
-
buildChapterList(): this;
|
|
4930
|
+
buildChapterList(prefix?: string): this;
|
|
4931
|
+
addControl(control: UIElement): this;
|
|
4932
|
+
addStack(size: [string, string], control: UIElement, debug?: boolean): this;
|
|
3777
4933
|
getPanel(): StackPanel;
|
|
3778
4934
|
clear(): this;
|
|
3779
4935
|
}
|
|
3780
4936
|
|
|
4937
|
+
/**
|
|
4938
|
+
* sapdon_ui: 页面壳路由系统(生成 server_form.json)
|
|
4939
|
+
*
|
|
4940
|
+
* 结构:
|
|
4941
|
+
* third_party_server_screen@common.base_screen (type:screen)
|
|
4942
|
+
* └─ $screen_content = custom_full_screen
|
|
4943
|
+
* ├─ native_form@main_screen_content (title 含 'sapdon_ui:' ? 隐藏 : 显示)
|
|
4944
|
+
* └─ sapdon_custom_full@sapdon_screen_content (title 含 'sapdon_ui:' 显示)
|
|
4945
|
+
* └─ (页面各自) @server_form.custom_panel_content (panel_id 精确匹配)
|
|
4946
|
+
* ├─ content@$user_content_panel (下)
|
|
4947
|
+
* └─ buttons@$user_buttons_panel (上)
|
|
4948
|
+
*/
|
|
4949
|
+
interface SapdonPageRegistration {
|
|
4950
|
+
panelId: string;
|
|
4951
|
+
contentPanel: UIElement | string;
|
|
4952
|
+
buttonsPanel?: UIElement | string;
|
|
4953
|
+
/** 页面控件�?默认 pageN) */
|
|
4954
|
+
name?: string;
|
|
4955
|
+
}
|
|
4956
|
+
declare class SapdonServerUI {
|
|
4957
|
+
static readonly MARKER = "sapdon_ui:";
|
|
4958
|
+
static readonly NS = "server_form";
|
|
4959
|
+
private static _system;
|
|
4960
|
+
private static _screenContent;
|
|
4961
|
+
private static _pageCount;
|
|
4962
|
+
/** 框架侧固定提供的按钮项模�?form_button@common_buttons.light_text_button */
|
|
4963
|
+
static createFormButtonTemplate(): UIElement;
|
|
4964
|
+
/** 框架侧固定提供的纹理按钮模板 sapdon_textured_button@common.button(三态纹理 + 门控) */
|
|
4965
|
+
static createTexturedButtonTemplate(): UIElement;
|
|
4966
|
+
/** 通用页面壳 custom_panel_content: panel_id 精确匹配 + 内容(下)/按键(上) */
|
|
4967
|
+
static createPanelContentShell(): UIElement;
|
|
4968
|
+
private static _ensureBuilt;
|
|
4969
|
+
/** 注册一个自定义页面到 sapdon_screen_content */
|
|
4970
|
+
static registerPage(reg: SapdonPageRegistration): void;
|
|
4971
|
+
static getSystem(): UISystem | null;
|
|
4972
|
+
}
|
|
4973
|
+
|
|
4974
|
+
/**
|
|
4975
|
+
* SapdonPanel:一个自定义页面 = 一个 UI 文件(text_ui_xxx.json)
|
|
4976
|
+
* 由「内容面板 + 按键面板」两个元素组成。
|
|
4977
|
+
*/
|
|
4978
|
+
declare class SapdonPanel {
|
|
4979
|
+
private system;
|
|
4980
|
+
constructor(namespace: string);
|
|
4981
|
+
/** 设置内容面板元素 */
|
|
4982
|
+
setContent(content: UIElement): this;
|
|
4983
|
+
/** 设置按键面板元素 */
|
|
4984
|
+
setButtons(buttons: UIElement): this;
|
|
4985
|
+
build(): UISystem;
|
|
4986
|
+
}
|
|
4987
|
+
|
|
4988
|
+
/**
|
|
4989
|
+
* SapdonButtonPanel:按键网格面板。
|
|
4990
|
+
* 内部造一个 Grid(collection_name 注入 form_buttons),
|
|
4991
|
+
* 通过 place() 逐个把 form_button 内容按 pos_wrap 摆到指定格。
|
|
4992
|
+
*/
|
|
4993
|
+
declare class SapdonButtonPanel {
|
|
4994
|
+
private grid;
|
|
4995
|
+
constructor(gridId: string);
|
|
4996
|
+
/** 网格尺寸 [列, 行] */
|
|
4997
|
+
setDimensions([cols, rows]: [number, number]): this;
|
|
4998
|
+
setSize(size: [number | string, number | string]): this;
|
|
4999
|
+
/** 注入按钮集合 */
|
|
5000
|
+
setCollection(collectionName: string): this;
|
|
5001
|
+
/** 摆一个按钮(内部会生成带 grid_position 的 pos_wrap 面板包裹) */
|
|
5002
|
+
place(gridPosition: [number, number], content: UIElement): this;
|
|
5003
|
+
build(): Grid;
|
|
5004
|
+
}
|
|
5005
|
+
|
|
5006
|
+
declare class UISystemRegistry {
|
|
5007
|
+
static "__#private@#ui_system_map": {};
|
|
5008
|
+
static "__#private@#ui_def_list": any[];
|
|
5009
|
+
static registerUISystem(ui_system: any): void;
|
|
5010
|
+
static addOuterUIdefs(ui_defs: any): void;
|
|
5011
|
+
}
|
|
5012
|
+
|
|
5013
|
+
interface ProgressBarLayer {
|
|
5014
|
+
color: [number, number, number];
|
|
5015
|
+
clipRatio: number;
|
|
5016
|
+
}
|
|
5017
|
+
interface HudProgressBarOptions {
|
|
5018
|
+
id: string;
|
|
5019
|
+
texture: string;
|
|
5020
|
+
uv?: [number, number];
|
|
5021
|
+
uvSize?: [number, number];
|
|
5022
|
+
barSize?: [string | number, string | number];
|
|
5023
|
+
layers: ProgressBarLayer[];
|
|
5024
|
+
states: number;
|
|
5025
|
+
fillColor?: [number, number, number];
|
|
5026
|
+
fillUv?: [number, number];
|
|
5027
|
+
segments?: {
|
|
5028
|
+
count: number;
|
|
5029
|
+
color: [number, number, number];
|
|
5030
|
+
};
|
|
5031
|
+
hudSize?: [string | number, string | number];
|
|
5032
|
+
anchorFrom?: string;
|
|
5033
|
+
anchorTo?: string;
|
|
5034
|
+
offset?: [number, number];
|
|
5035
|
+
clipDirection?: string;
|
|
5036
|
+
}
|
|
5037
|
+
declare class HudProgressBar {
|
|
5038
|
+
private panel;
|
|
5039
|
+
private options;
|
|
5040
|
+
constructor(options: HudProgressBarOptions);
|
|
5041
|
+
private build;
|
|
5042
|
+
getPanel(): Panel;
|
|
5043
|
+
mountToHud(): void;
|
|
5044
|
+
}
|
|
5045
|
+
|
|
3781
5046
|
declare namespace HudUISystem {
|
|
3782
5047
|
/**
|
|
3783
5048
|
* 获取HUD UI系统实例
|
|
@@ -3846,13 +5111,6 @@ interface ISerializer {
|
|
|
3846
5111
|
declare function jsonEncoderReplacer(_: string, v: any): any;
|
|
3847
5112
|
declare const defaultSerializer: ISerializer;
|
|
3848
5113
|
declare function Serializable(serializer?: ISerializer): (_: any, ctx: DecoratorContext) => void;
|
|
3849
|
-
/**
|
|
3850
|
-
* 只能应用一个 Serializer
|
|
3851
|
-
*
|
|
3852
|
-
* 重复的 Serializer 会被覆盖
|
|
3853
|
-
* @param target
|
|
3854
|
-
* @param ctx
|
|
3855
|
-
*/
|
|
3856
5114
|
declare const Serializer: MethodDecorator;
|
|
3857
5115
|
declare function serialize<R, T extends object>(inst: T): R;
|
|
3858
5116
|
declare const jsonEncodeDecoder: EncodeDecoder<any, string>;
|
|
@@ -3881,5 +5139,5 @@ declare namespace registry {
|
|
|
3881
5139
|
function submit(): void;
|
|
3882
5140
|
}
|
|
3883
5141
|
|
|
3884
|
-
export { AddonAnimationController, AddonAnimationStateMachine, AddonAttachable, AddonAttachableDefinition, AddonAttachableDescription, AddonBiome, AddonBiomeDefinition, AddonBiomeDescription, AddonBlock, AddonBlockDefinition, AddonBlockDescription, AddonClientEntity, AddonClientEntityDefinition, AddonClientEntityDescription, AddonEntity, AddonEntityDefinition, AddonEntityDescription, AddonFeatureRule, AddonFeatureRuleDecription, AddonFeatureRuleDenifition, AddonItem, AddonItemDefinition, AddonItemDescription, AddonManifest, AddonManifestDependency, AddonManifestHeader, AddonManifestMetadata, AddonManifestModule, AddonMenuCategory, AddonOreFeature, AddonOreFeatureDefinition, AddonOreFeatureDescription, AddonRecipe, AddonRecipeFurnace, AddonRecipeFurnace_1_12, AddonRecipeFurnace_1_17, AddonRecipeShaped, AddonRecipeShaped_1_12, AddonRecipeShaped_1_17, AddonRecipeShaped_1_19, AddonRecipeShaped_1_20, AddonRecipeShapeless, AddonRecipeShapeless_1_12, AddonRecipeShapeless_1_17, AddonRenderController, AddonRenderControllerGroup, AddonSemanticVersion, Armor, Attachable, BasicBlock, BasicBundle, BasicEntity, BasicMovementBundle, Biome, BiomeAPI, BiomeComponent, BiomeFilter, Block, BlockAPI, BlockComponent, BookButton, BookCategoryGrid, BookImage, BookRecipeGrid, BookTitle, BookTitleBar,
|
|
3885
|
-
export type { ConstructorOf, EncodeDecoder, FlipbookItemOptions, FloatLiteral, ISerializer, RawType };
|
|
5142
|
+
export { AddonAnimationController, AddonAnimationStateMachine, AddonAttachable, AddonAttachableDefinition, AddonAttachableDescription, AddonBiome, AddonBiomeDefinition, AddonBiomeDescription, AddonBlock, AddonBlockDefinition, AddonBlockDescription, AddonClientEntity, AddonClientEntityDefinition, AddonClientEntityDescription, AddonEntity, AddonEntityDefinition, AddonEntityDescription, AddonFeatureRule, AddonFeatureRuleDecription, AddonFeatureRuleDenifition, AddonItem, AddonItemDefinition, AddonItemDescription, AddonManifest, AddonManifestDependency, AddonManifestHeader, AddonManifestMetadata, AddonManifestModule, AddonMenuCategory, AddonOreFeature, AddonOreFeatureDefinition, AddonOreFeatureDescription, AddonRecipe, AddonRecipeFurnace, AddonRecipeFurnace_1_12, AddonRecipeFurnace_1_17, AddonRecipeShaped, AddonRecipeShaped_1_12, AddonRecipeShaped_1_17, AddonRecipeShaped_1_19, AddonRecipeShaped_1_20, AddonRecipeShapeless, AddonRecipeShapeless_1_12, AddonRecipeShapeless_1_17, AddonRenderController, AddonRenderControllerGroup, AddonSemanticVersion, Armor, ArmorType, Attachable, BasicBlock, BasicBundle, BasicEntity, BasicMovementBundle, Biome, BiomeAPI, BiomeComponent, BiomeFilter, Block, BlockAPI, BlockComponent, BlockCustomComponentBuilder, BookButton, BookCategoryGrid, BookImage, BookRecipeGrid, BookText, BookTitle, BookTitleBar, Button, ButtonMapping$1 as ButtonMapping, ChapterItem, ChestUISystem, ClientEntity, CollectionPanel, ContainerUISystem, Control, CoordinateDistribution, CropBlock, DataBinding, DataBindingObject, Divider, DummyEntity, EmptySpace, Entity, EntityAPI, EntityComponent, Factory, FeatureAPI, FeatureConditions, FeatureDistribution, FeatureRule, FenceBlock, FlipbookItem, FlipbookTextureConfig, FlipbookTextures, FollowMobBehavior, FollowParentBehavior, Food, GeometryBlock, GlassBlock, GoHomeBehavior, Grid, GridProp, Guidebook, HeadBlock, HudProgressBar, HudStatePanel, HudUISystem, Image, Input, Item, ItemAPI, ItemCatalog, ItemCategory, ItemComponent, ItemTextureManager, Label, Layout, Modifications, MoveTowardsHomeRestrictionBehavior, NativeEntity, NativeEntityData, Navigation, NearestAttackableTargetBehavor, NeoGuidebook, NeoGuidebookPage, NonNullMap, OreBlock, OreFeature, Panel, PickupItemsBehavior, Projectile, RandomStrollBehavior, RecipeAPI, RecipeInputTags, RecipeTags, RecipeTypes, RotatableBlock, RotationTypes, SapdonButton, SapdonButtonPanel, SapdonPanel, SapdonServerUI, SapdonTexturedButton, ScrollView, ScrollingPanel, Serializable, Serializer, ServerFormButton, ServerFormSystem, ServerUISystem, Sound, Sprite, StackPanel, StairBlock, TemptBehavior, TerrainTextureManager, Text, TextureVariationConfig, TileBlock, TintMethod, TrapdoorBlock, UIElement, UISystem, UISystemRegistry, UiAPI, decode, defaultSerializer, encode, f64, form_button_panel, getMetadata, getOrCreateMetadata, isRawJSON, jsonEncodeDecoder, jsonEncoderReplacer, mixin, registerBlock, registerEntity, registry, serialize };
|
|
5143
|
+
export type { ArmorOptions, ArmorSpec, BeforeOnPlayerPlaceEvent, BlockCustomComponentHandlers, BlockDescriptor, BlockPlacerOptions, ConstructorOf, CooldownOptions, CreateModelItemOptions, DiggerOptions, DurabilitySensorOptions, DurabilityThreshold, EncodeDecoder, EntityPlacerOptions, FlipbookEntry, FlipbookItemOptions, FloatLiteral, FoodComponentOptions, FoodOptions, ISerializer, IconTextures, ItemCatalogCategory, ItemCatalogGroupOptions, ItemComponentMap, ItemOptions, ItemRarity, KineticWeaponOptions, ModelBoneTransform, OnBlockStateChangeEvent, OnBreakEvent, OnEntityEvent, OnEntityFallOnEvent, OnPlaceEvent, OnPlayerBreakEvent, OnPlayerInteractEvent, OnRandomTickEvent, OnRedstoneUpdateEvent, OnStepOffEvent, OnStepOnEvent, OnTickEvent, PiercingWeaponOptions, Range, RawType, RecordOptions, RepairItem, SapdonPageRegistration, ShooterAmmunition, ShooterOptions, StorageItemOptions, SwingSoundsOptions, TextureEntry, TextureVariation, ThrowableOptions, UseModifiersOptions };
|