sapdon 3.0.0 → 3.0.2
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 +9 -7
- package/doc/cli.md +24 -0
- package/doc/sapdon-ts.md +17 -5
- package/package.json +2 -2
- package/dist/cli/build.d.ts +0 -7
- package/dist/cli/build.js +0 -232
- package/dist/cli/dev-server/client.d.ts +0 -2
- package/dist/cli/dev-server/client.js +0 -20
- package/dist/cli/dev-server/config.d.ts +0 -3
- package/dist/cli/dev-server/config.js +0 -3
- package/dist/cli/dev-server/hmr.d.ts +0 -1
- package/dist/cli/dev-server/hmr.js +0 -13
- package/dist/cli/dev-server/index.d.ts +0 -3
- package/dist/cli/dev-server/index.js +0 -11
- package/dist/cli/dev-server/server.d.ts +0 -6
- package/dist/cli/dev-server/server.js +0 -50
- package/dist/cli/dev-server/syncFiles.d.ts +0 -3
- package/dist/cli/dev-server/syncFiles.js +0 -36
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.js +0 -1
- package/dist/cli/init.d.ts +0 -9
- package/dist/cli/init.js +0 -80
- package/dist/cli/load.d.ts +0 -3
- package/dist/cli/load.js +0 -94
- package/dist/cli/start.d.ts +0 -2
- package/dist/cli/start.js +0 -156
- package/dist/cli/tools/textureSet.d.ts +0 -13
- package/dist/cli/tools/textureSet.js +0 -103
- package/dist/cli/utils.d.ts +0 -13
- package/dist/cli/utils.js +0 -89
- package/dist/core/addon/biome.d.ts +0 -22
- package/dist/core/addon/biome.js +0 -27
- package/dist/core/addon/block/block.d.ts +0 -41
- package/dist/core/addon/block/block.js +0 -46
- package/dist/core/addon/controllers/animationController.d.ts +0 -43
- package/dist/core/addon/controllers/animationController.js +0 -73
- package/dist/core/addon/entity/clientEntity.d.ts +0 -107
- package/dist/core/addon/entity/clientEntity.js +0 -149
- package/dist/core/addon/entity/entity.d.ts +0 -42
- package/dist/core/addon/entity/entity.js +0 -50
- package/dist/core/addon/feature/oreFeature.d.ts +0 -19
- package/dist/core/addon/feature/oreFeature.js +0 -24
- package/dist/core/addon/featureRule.d.ts +0 -20
- package/dist/core/addon/featureRule.js +0 -25
- package/dist/core/addon/item/attachable.d.ts +0 -94
- package/dist/core/addon/item/attachable.js +0 -134
- package/dist/core/addon/item/item.d.ts +0 -19
- package/dist/core/addon/item/item.js +0 -26
- package/dist/core/addon/manifest.d.ts +0 -49
- package/dist/core/addon/manifest.js +0 -65
- package/dist/core/addon/menuCategory.d.ts +0 -6
- package/dist/core/addon/menuCategory.js +0 -7
- package/dist/core/addon/recipe/baseRecipe.d.ts +0 -12
- package/dist/core/addon/recipe/baseRecipe.js +0 -23
- package/dist/core/addon/recipe/data.d.ts +0 -66
- package/dist/core/addon/recipe/data.js +0 -74
- package/dist/core/addon/recipe/furnace.d.ts +0 -17
- package/dist/core/addon/recipe/furnace.js +0 -43
- package/dist/core/addon/recipe/shaped.d.ts +0 -26
- package/dist/core/addon/recipe/shaped.js +0 -53
- package/dist/core/addon/recipe/shapeless.d.ts +0 -18
- package/dist/core/addon/recipe/shapeless.js +0 -36
- package/dist/core/biome/biome.d.ts +0 -14
- package/dist/core/biome/biome.js +0 -23
- package/dist/core/biome/biomeComponent.d.ts +0 -46
- package/dist/core/biome/biomeComponent.js +0 -77
- package/dist/core/block/basicBlock.d.ts +0 -48
- package/dist/core/block/basicBlock.js +0 -105
- package/dist/core/block/block.d.ts +0 -32
- package/dist/core/block/block.js +0 -92
- package/dist/core/block/blockComponent.d.ts +0 -187
- package/dist/core/block/blockComponent.js +0 -500
- package/dist/core/block/cropBlock.d.ts +0 -4
- package/dist/core/block/cropBlock.js +0 -27
- package/dist/core/block/geometryBlock.d.ts +0 -12
- package/dist/core/block/geometryBlock.js +0 -16
- package/dist/core/block/oreBlock.d.ts +0 -9
- package/dist/core/block/oreBlock.js +0 -25
- package/dist/core/block/rotatableBlock.d.ts +0 -27
- package/dist/core/block/rotatableBlock.js +0 -107
- package/dist/core/block/tileBlock.d.ts +0 -17
- package/dist/core/block/tileBlock.js +0 -125
- package/dist/core/entity/basicEntity.d.ts +0 -111
- package/dist/core/entity/basicEntity.js +0 -170
- package/dist/core/entity/behavior/followMob.d.ts +0 -12
- package/dist/core/entity/behavior/followMob.js +0 -35
- package/dist/core/entity/behavior/followParent.d.ts +0 -7
- package/dist/core/entity/behavior/followParent.js +0 -15
- package/dist/core/entity/behavior/randomStroll.d.ts +0 -31
- package/dist/core/entity/behavior/randomStroll.js +0 -63
- package/dist/core/entity/behavior/tempt.d.ts +0 -73
- package/dist/core/entity/behavior/tempt.js +0 -134
- package/dist/core/entity/bundles/basicBundle.d.ts +0 -13
- package/dist/core/entity/bundles/basicBundle.js +0 -45
- package/dist/core/entity/clientEntity.d.ts +0 -20
- package/dist/core/entity/clientEntity.js +0 -37
- package/dist/core/entity/componets/entityComponet.d.ts +0 -202
- package/dist/core/entity/componets/entityComponet.js +0 -347
- package/dist/core/entity/data/nativeEntityData.d.ts +0 -9
- package/dist/core/entity/data/nativeEntityData.js +0 -38
- package/dist/core/entity/entity.d.ts +0 -15
- package/dist/core/entity/entity.js +0 -18
- package/dist/core/entity/nativeEntity.d.ts +0 -8
- package/dist/core/entity/nativeEntity.js +0 -28
- package/dist/core/entity/navigation/walk.d.ts +0 -23
- package/dist/core/entity/navigation/walk.js +0 -56
- package/dist/core/entity/projectile.d.ts +0 -3
- package/dist/core/entity/projectile.js +0 -7
- package/dist/core/factory/biomeFactory.d.ts +0 -4
- package/dist/core/factory/biomeFactory.js +0 -13
- package/dist/core/factory/blockFactory.d.ts +0 -34
- package/dist/core/factory/blockFactory.js +0 -143
- package/dist/core/factory/entityFactory.d.ts +0 -17
- package/dist/core/factory/entityFactory.js +0 -75
- package/dist/core/factory/featureFactory.d.ts +0 -6
- package/dist/core/factory/featureFactory.js +0 -23
- package/dist/core/factory/itemExtra.d.ts +0 -8
- package/dist/core/factory/itemExtra.js +0 -9
- package/dist/core/factory/itemFactory.d.ts +0 -27
- package/dist/core/factory/itemFactory.js +0 -112
- package/dist/core/factory/recipeFactory.d.ts +0 -18
- package/dist/core/factory/recipeFactory.js +0 -39
- package/dist/core/factory/uiFactory.d.ts +0 -11
- package/dist/core/factory/uiFactory.js +0 -32
- package/dist/core/feature/oreFeature.d.ts +0 -10
- package/dist/core/feature/oreFeature.js +0 -11
- package/dist/core/feature-rule/condition/biomeFilter.d.ts +0 -26
- package/dist/core/feature-rule/condition/biomeFilter.js +0 -36
- package/dist/core/feature-rule/condition/featureConditions.d.ts +0 -27
- package/dist/core/feature-rule/condition/featureConditions.js +0 -37
- package/dist/core/feature-rule/distribution/coordinateDistribution.d.ts +0 -17
- package/dist/core/feature-rule/distribution/coordinateDistribution.js +0 -23
- package/dist/core/feature-rule/distribution/featureDistribution.d.ts +0 -31
- package/dist/core/feature-rule/distribution/featureDistribution.js +0 -41
- package/dist/core/feature-rule/featureRule.d.ts +0 -17
- package/dist/core/feature-rule/featureRule.js +0 -26
- package/dist/core/index.d.ts +0 -24
- package/dist/core/index.js +0 -21
- package/dist/core/item/armor.d.ts +0 -21
- package/dist/core/item/armor.js +0 -90
- package/dist/core/item/attachable.d.ts +0 -6
- package/dist/core/item/attachable.js +0 -26
- package/dist/core/item/food.d.ts +0 -24
- package/dist/core/item/food.js +0 -38
- package/dist/core/item/item.d.ts +0 -36
- package/dist/core/item/item.js +0 -69
- package/dist/core/item/itemComponents.d.ts +0 -113
- package/dist/core/item/itemComponents.js +0 -225
- package/dist/core/registry.d.ts +0 -12
- package/dist/core/registry.js +0 -16
- package/dist/core/texture.d.ts +0 -18
- package/dist/core/texture.js +0 -38
- package/dist/core/ui/buttonMapping.d.ts +0 -97
- package/dist/core/ui/buttonMapping.js +0 -132
- package/dist/core/ui/dataBindingObject.d.ts +0 -97
- package/dist/core/ui/dataBindingObject.js +0 -134
- package/dist/core/ui/elements/button.d.ts +0 -21
- package/dist/core/ui/elements/button.js +0 -101
- package/dist/core/ui/elements/collectionPanel.d.ts +0 -12
- package/dist/core/ui/elements/collectionPanel.js +0 -53
- package/dist/core/ui/elements/grid.d.ts +0 -8
- package/dist/core/ui/elements/grid.js +0 -33
- package/dist/core/ui/elements/image.d.ts +0 -13
- package/dist/core/ui/elements/image.js +0 -55
- package/dist/core/ui/elements/label.d.ts +0 -14
- package/dist/core/ui/elements/label.js +0 -61
- package/dist/core/ui/elements/panel.d.ts +0 -11
- package/dist/core/ui/elements/panel.js +0 -49
- package/dist/core/ui/elements/scrollingPanel.d.ts +0 -14
- package/dist/core/ui/elements/scrollingPanel.js +0 -59
- package/dist/core/ui/elements/stackPanel.d.ts +0 -14
- package/dist/core/ui/elements/stackPanel.js +0 -37
- package/dist/core/ui/elements/uiElement.d.ts +0 -53
- package/dist/core/ui/elements/uiElement.js +0 -129
- package/dist/core/ui/properties/control.d.ts +0 -214
- package/dist/core/ui/properties/control.js +0 -286
- package/dist/core/ui/properties/dataBinding.d.ts +0 -6
- package/dist/core/ui/properties/dataBinding.js +0 -16
- package/dist/core/ui/properties/factory.d.ts +0 -37
- package/dist/core/ui/properties/factory.js +0 -62
- package/dist/core/ui/properties/gridProp.d.ts +0 -65
- package/dist/core/ui/properties/gridProp.js +0 -90
- package/dist/core/ui/properties/input.d.ts +0 -97
- package/dist/core/ui/properties/input.js +0 -134
- package/dist/core/ui/properties/layout.d.ts +0 -105
- package/dist/core/ui/properties/layout.js +0 -145
- package/dist/core/ui/properties/scrollView.d.ts +0 -105
- package/dist/core/ui/properties/scrollView.js +0 -145
- package/dist/core/ui/properties/sound.d.ts +0 -47
- package/dist/core/ui/properties/sound.js +0 -66
- package/dist/core/ui/properties/sprite.d.ts +0 -161
- package/dist/core/ui/properties/sprite.js +0 -222
- package/dist/core/ui/properties/text.d.ts +0 -135
- package/dist/core/ui/properties/text.js +0 -187
- package/dist/core/ui/registry/uiSystemRegistry.d.ts +0 -8
- package/dist/core/ui/registry/uiSystemRegistry.js +0 -26
- package/dist/core/ui/systems/chest.d.ts +0 -4
- package/dist/core/ui/systems/chest.js +0 -21
- package/dist/core/ui/systems/containerUISystem.d.ts +0 -64
- package/dist/core/ui/systems/containerUISystem.js +0 -206
- package/dist/core/ui/systems/guidebook.d.ts +0 -8
- package/dist/core/ui/systems/guidebook.js +0 -206
- package/dist/core/ui/systems/serverForm.d.ts +0 -12
- package/dist/core/ui/systems/serverForm.js +0 -116
- package/dist/core/ui/systems/system.d.ts +0 -16
- package/dist/core/ui/systems/system.js +0 -37
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { BiomeFilter } from "./biomeFilter.js";
|
|
2
|
-
/**
|
|
3
|
-
* 表示功能规则生成条件的类
|
|
4
|
-
*/
|
|
5
|
-
export class FeatureConditions {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.conditions = {
|
|
8
|
-
placement_pass: "underground_pass", // 默认值
|
|
9
|
-
"minecraft:biome_filter": []
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* 设置生成阶段(placement_pass)
|
|
14
|
-
* @param {string} pass - 生成阶段标识符(如 "underground_pass")
|
|
15
|
-
* @returns {FeatureConditions} 返回自身以支持链式调用
|
|
16
|
-
*/
|
|
17
|
-
setPlacementPass(pass) {
|
|
18
|
-
this.conditions.placement_pass = pass;
|
|
19
|
-
return this;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* 设置生物群系过滤器
|
|
23
|
-
* @param {BiomeFilter} biomeFilter - 生物群系过滤条件对象
|
|
24
|
-
* @returns {FeatureConditions} 返回自身以支持链式调用
|
|
25
|
-
*/
|
|
26
|
-
setBiomeFilter(biomeFilter) {
|
|
27
|
-
this.conditions["minecraft:biome_filter"] = biomeFilter.toJson();
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* 转换为 JSON 格式
|
|
32
|
-
* @returns {Object} 返回生成条件对象
|
|
33
|
-
*/
|
|
34
|
-
toJson() {
|
|
35
|
-
return this.conditions;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 表示单个坐标轴(x/y/z)分布规则的类
|
|
3
|
-
*/
|
|
4
|
-
export class CoordinateDistribution {
|
|
5
|
-
/**
|
|
6
|
-
* @param {"uniform" | "triangle"} distribution - 分布类型
|
|
7
|
-
* @param {Array<number>} extent - 范围(如 [0, 16])
|
|
8
|
-
*/
|
|
9
|
-
constructor(distribution?: "uniform" | "triangle", extent?: Array<number>);
|
|
10
|
-
distribution: "triangle" | "uniform";
|
|
11
|
-
extent: number[];
|
|
12
|
-
/**
|
|
13
|
-
* 转换为 JSON 格式
|
|
14
|
-
* @returns {Object} 返回坐标分布配置
|
|
15
|
-
*/
|
|
16
|
-
toJson(): any;
|
|
17
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 表示单个坐标轴(x/y/z)分布规则的类
|
|
3
|
-
*/
|
|
4
|
-
export class CoordinateDistribution {
|
|
5
|
-
/**
|
|
6
|
-
* @param {"uniform" | "triangle"} distribution - 分布类型
|
|
7
|
-
* @param {Array<number>} extent - 范围(如 [0, 16])
|
|
8
|
-
*/
|
|
9
|
-
constructor(distribution = "uniform", extent = [0, 16]) {
|
|
10
|
-
this.distribution = distribution;
|
|
11
|
-
this.extent = extent;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 转换为 JSON 格式
|
|
15
|
-
* @returns {Object} 返回坐标分布配置
|
|
16
|
-
*/
|
|
17
|
-
toJson() {
|
|
18
|
-
return {
|
|
19
|
-
distribution: this.distribution,
|
|
20
|
-
extent: this.extent
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 表示功能规则分布配置的类
|
|
3
|
-
*/
|
|
4
|
-
export class FeatureDistribution {
|
|
5
|
-
distribution: {
|
|
6
|
-
iterations: number;
|
|
7
|
-
coordinate_eval_order: string;
|
|
8
|
-
x: any;
|
|
9
|
-
y: any;
|
|
10
|
-
z: any;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* 设置迭代次数
|
|
14
|
-
* @param {number} iterations - 放置尝试次数
|
|
15
|
-
* @returns {FeatureDistribution} 返回自身以支持链式调用
|
|
16
|
-
*/
|
|
17
|
-
setIterations(iterations: number): FeatureDistribution;
|
|
18
|
-
/**
|
|
19
|
-
* 设置坐标轴的分布规则
|
|
20
|
-
* @param {"x" | "y" | "z"} axis - 坐标轴
|
|
21
|
-
* @param {CoordinateDistribution} config - 分布配置
|
|
22
|
-
* @returns {FeatureDistribution} 返回自身以支持链式调用
|
|
23
|
-
*/
|
|
24
|
-
setAxisDistribution(axis: "x" | "y" | "z", config: CoordinateDistribution): FeatureDistribution;
|
|
25
|
-
/**
|
|
26
|
-
* 转换为 JSON 格式
|
|
27
|
-
* @returns {Object} 返回分布规则对象
|
|
28
|
-
*/
|
|
29
|
-
toJson(): any;
|
|
30
|
-
}
|
|
31
|
-
import { CoordinateDistribution } from "./coordinateDistribution.js";
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { CoordinateDistribution } from "./coordinateDistribution.js";
|
|
2
|
-
/**
|
|
3
|
-
* 表示功能规则分布配置的类
|
|
4
|
-
*/
|
|
5
|
-
export class FeatureDistribution {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.distribution = {
|
|
8
|
-
iterations: 10, // 默认值
|
|
9
|
-
coordinate_eval_order: "zyx",
|
|
10
|
-
x: new CoordinateDistribution().toJson(),
|
|
11
|
-
y: new CoordinateDistribution().toJson(),
|
|
12
|
-
z: new CoordinateDistribution().toJson()
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* 设置迭代次数
|
|
17
|
-
* @param {number} iterations - 放置尝试次数
|
|
18
|
-
* @returns {FeatureDistribution} 返回自身以支持链式调用
|
|
19
|
-
*/
|
|
20
|
-
setIterations(iterations) {
|
|
21
|
-
this.distribution.iterations = iterations;
|
|
22
|
-
return this;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* 设置坐标轴的分布规则
|
|
26
|
-
* @param {"x" | "y" | "z"} axis - 坐标轴
|
|
27
|
-
* @param {CoordinateDistribution} config - 分布配置
|
|
28
|
-
* @returns {FeatureDistribution} 返回自身以支持链式调用
|
|
29
|
-
*/
|
|
30
|
-
setAxisDistribution(axis, config) {
|
|
31
|
-
this.distribution[axis] = config.toJson();
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* 转换为 JSON 格式
|
|
36
|
-
* @returns {Object} 返回分布规则对象
|
|
37
|
-
*/
|
|
38
|
-
toJson() {
|
|
39
|
-
return this.distribution;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export class FeatureRule {
|
|
2
|
-
constructor(identifier: any, places_feature: any);
|
|
3
|
-
identifier: any;
|
|
4
|
-
places_feature: any;
|
|
5
|
-
condition: FeatureConditions;
|
|
6
|
-
distribution: FeatureDistribution;
|
|
7
|
-
setPlacementPass(pass: any): void;
|
|
8
|
-
setBiomeFilter(biomeFilter: any): void;
|
|
9
|
-
setIterations(iterations: any): void;
|
|
10
|
-
setAxisDistribution(axis: any, config: any): void;
|
|
11
|
-
toJson(): {
|
|
12
|
-
format_version: any;
|
|
13
|
-
"minecraft:feature_rules": any;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
import { FeatureConditions } from "./condition/featureConditions.js";
|
|
17
|
-
import { FeatureDistribution } from "./distribution/featureDistribution.js";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { AddonFeatureRule, AddonFeatureRuleDecription, AddonFeatureRuleDenifition } from "../addon/featureRule.js";
|
|
2
|
-
import { FeatureConditions } from "./condition/featureConditions.js";
|
|
3
|
-
import { FeatureDistribution } from "./distribution/featureDistribution.js";
|
|
4
|
-
export class FeatureRule {
|
|
5
|
-
constructor(identifier, places_feature) {
|
|
6
|
-
this.identifier = identifier;
|
|
7
|
-
this.places_feature = places_feature;
|
|
8
|
-
this.condition = new FeatureConditions();
|
|
9
|
-
this.distribution = new FeatureDistribution();
|
|
10
|
-
}
|
|
11
|
-
setPlacementPass(pass) {
|
|
12
|
-
this.condition.setPlacementPass(pass);
|
|
13
|
-
}
|
|
14
|
-
setBiomeFilter(biomeFilter) {
|
|
15
|
-
this.condition.setBiomeFilter(biomeFilter);
|
|
16
|
-
}
|
|
17
|
-
setIterations(iterations) {
|
|
18
|
-
this.distribution.setIterations(iterations);
|
|
19
|
-
}
|
|
20
|
-
setAxisDistribution(axis, config) {
|
|
21
|
-
this.distribution.setAxisDistribution(axis, config);
|
|
22
|
-
}
|
|
23
|
-
toJson() {
|
|
24
|
-
return new AddonFeatureRule("1.13.0", new AddonFeatureRuleDenifition(new AddonFeatureRuleDecription(this.identifier, this.places_feature), this.condition.toJson(), this.distribution.toJson())).toJson();
|
|
25
|
-
}
|
|
26
|
-
}
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export * from "./factory/itemExtra.js";
|
|
2
|
-
import { ItemAPI } from "./factory/itemFactory.js";
|
|
3
|
-
import { BlockAPI } from "./factory/blockFactory.js";
|
|
4
|
-
import { FeatureAPI } from "./factory/featureFactory.js";
|
|
5
|
-
import { EntityAPI } from "./factory/entityFactory.js";
|
|
6
|
-
import { RecipeAPI } from "./factory/recipeFactory.js";
|
|
7
|
-
import { BlockComponent } from "./block/blockComponent.js";
|
|
8
|
-
import { ItemComponent } from "./item/itemComponents.js";
|
|
9
|
-
import { Image } from "./ui/elements/image.js";
|
|
10
|
-
import { Panel } from "./ui/elements/panel.js";
|
|
11
|
-
import { Label } from "./ui/elements/label.js";
|
|
12
|
-
import { UIElement } from "./ui/elements/uiElement.js";
|
|
13
|
-
import { UISystem } from "./ui/systems/system.js";
|
|
14
|
-
import { DataBindingObject } from "./ui/dataBindingObject.js";
|
|
15
|
-
import { ServerUISystem } from "./ui/systems/serverForm.js";
|
|
16
|
-
import { ServerFormSystem } from "./ui/systems/serverForm.js";
|
|
17
|
-
import { ItemTextureManager } from "./texture.js";
|
|
18
|
-
import { terrainTextureManager } from "./texture.js";
|
|
19
|
-
import { FlipbookTextures } from "./texture.js";
|
|
20
|
-
import { GRegistry } from "./registry.js";
|
|
21
|
-
import { UISystemRegistry } from "./ui/registry/uiSystemRegistry.js";
|
|
22
|
-
import { Grid } from "./ui/elements/grid.js";
|
|
23
|
-
import { StackPanel } from "./ui/elements/stackPanel.js";
|
|
24
|
-
export { ItemAPI, BlockAPI, FeatureAPI, EntityAPI, RecipeAPI, BlockComponent, ItemComponent, Image, Panel, Label, UIElement, UISystem, DataBindingObject, ServerUISystem, ServerFormSystem, ItemTextureManager, terrainTextureManager, FlipbookTextures, GRegistry, UISystemRegistry, Grid, StackPanel };
|
package/dist/core/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { BlockComponent } from "./block/blockComponent.js";
|
|
2
|
-
import { BlockAPI } from "./factory/blockFactory.js";
|
|
3
|
-
import { EntityAPI } from "./factory/entityFactory.js";
|
|
4
|
-
import { FeatureAPI } from "./factory/featureFactory.js";
|
|
5
|
-
import { ItemAPI } from "./factory/itemFactory.js";
|
|
6
|
-
import { RecipeAPI } from "./factory/recipeFactory.js";
|
|
7
|
-
import { GRegistry } from "./registry.js";
|
|
8
|
-
import { ItemComponent } from "./item/itemComponents.js";
|
|
9
|
-
import { FlipbookTextures, ItemTextureManager, terrainTextureManager } from "./texture.js";
|
|
10
|
-
import { DataBindingObject } from "./ui/dataBindingObject.js";
|
|
11
|
-
import { Grid } from "./ui/elements/grid.js";
|
|
12
|
-
import { Image } from "./ui/elements/image.js";
|
|
13
|
-
import { Label } from "./ui/elements/label.js";
|
|
14
|
-
import { Panel } from "./ui/elements/panel.js";
|
|
15
|
-
import { StackPanel } from "./ui/elements/stackPanel.js";
|
|
16
|
-
import { UIElement } from "./ui/elements/uiElement.js";
|
|
17
|
-
import { UISystemRegistry } from "./ui/registry/uiSystemRegistry.js";
|
|
18
|
-
import { ServerFormSystem, ServerUISystem } from "./ui/systems/serverForm.js";
|
|
19
|
-
import { UISystem } from "./ui/systems/system.js";
|
|
20
|
-
export { ItemAPI, BlockAPI, FeatureAPI, EntityAPI, RecipeAPI, BlockComponent, ItemComponent, Image, Panel, Label, UIElement, UISystem, DataBindingObject, ServerUISystem, ServerFormSystem, ItemTextureManager, terrainTextureManager, FlipbookTextures, GRegistry, UISystemRegistry, Grid, StackPanel };
|
|
21
|
-
export * from './factory/itemExtra.js';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export class Armor {
|
|
2
|
-
constructor(identifier: any, category: any, item_texture: any, texture_path: any, options?: {});
|
|
3
|
-
identifier: any;
|
|
4
|
-
item: Item;
|
|
5
|
-
attachable: Attachable;
|
|
6
|
-
setArrachableGeometry(key: any, geometry: any): this;
|
|
7
|
-
}
|
|
8
|
-
export class Chestplate extends Armor {
|
|
9
|
-
constructor(identifier: any, item_texture: any, texture_path: any, options?: {});
|
|
10
|
-
}
|
|
11
|
-
export class Boot extends Armor {
|
|
12
|
-
constructor(identifier: any, item_texture: any, texture_path: any, options?: {});
|
|
13
|
-
}
|
|
14
|
-
export class Leggings extends Armor {
|
|
15
|
-
constructor(identifier: any, item_texture: any, texture_path: any, options?: {});
|
|
16
|
-
}
|
|
17
|
-
export class Helmet extends Armor {
|
|
18
|
-
constructor(identifier: any, item_texture: any, texture_path: any, options?: {});
|
|
19
|
-
}
|
|
20
|
-
import { Item } from "./item.js";
|
|
21
|
-
import { Attachable } from "./attachable.js";
|
package/dist/core/item/armor.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { Attachable } from "./attachable.js";
|
|
2
|
-
import { Item } from "./item.js";
|
|
3
|
-
import { ItemComponent } from "./itemComponents.js";
|
|
4
|
-
// 定义 Armor 基类
|
|
5
|
-
export class Armor {
|
|
6
|
-
constructor(identifier, category, item_texture, texture_path, options = {}) {
|
|
7
|
-
this.identifier = identifier;
|
|
8
|
-
//默认分组
|
|
9
|
-
options["group"] = "minecraft:itemGroup.name.chestplate";
|
|
10
|
-
// 创建物品
|
|
11
|
-
this.item = new Item(identifier, category, item_texture, options);
|
|
12
|
-
// 创建附加物
|
|
13
|
-
this.attachable = new Attachable(identifier);
|
|
14
|
-
// 配置附加物
|
|
15
|
-
this.attachable
|
|
16
|
-
.addTexture("default", texture_path) // 添加默认纹理
|
|
17
|
-
.addMaterial("default", "armor") // 添加默认材质
|
|
18
|
-
.addMaterial("enchanted", "armor_enchanted") // 添加附魔材质
|
|
19
|
-
.addTexture("default", texture_path)
|
|
20
|
-
.addTexture("enchanted", "textures/misc/enchanted_actor_glint") // 添加附魔纹理
|
|
21
|
-
.addRenderController("controller.render.armor") // 添加渲染控制器
|
|
22
|
-
//默认类型 胸甲
|
|
23
|
-
.addGeometry("default", "geometry.player.armor.chestplate") // 添加几何模型
|
|
24
|
-
.setScript("parent_setup", "v.chest_layer_visible = 0.0;"); // 设置脚本
|
|
25
|
-
}
|
|
26
|
-
setArrachableGeometry(key, geometry) {
|
|
27
|
-
this.attachable.addGeometry(key, geometry);
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
// 扩展 Armor 类,实现胸甲
|
|
32
|
-
export class Chestplate extends Armor {
|
|
33
|
-
constructor(identifier, item_texture, texture_path, options = {}) {
|
|
34
|
-
super(identifier, "equipment", item_texture, texture_path, options);
|
|
35
|
-
options["group"] = "minecraft:itemGroup.name.chestplate";
|
|
36
|
-
//头盔专属
|
|
37
|
-
this.attachable.addGeometry("default", "geometry.player.armor.chestplate") // 添加几何模型
|
|
38
|
-
.setScript("parent_setup", "v.chest_layer_visible = 0.0;"); // 设置脚本
|
|
39
|
-
// 自定义胸甲物品
|
|
40
|
-
this.item.addComponent(ItemComponent.combineComponents(ItemComponent.setDisplayName("我的自定义胸甲"), // 设置显示名称
|
|
41
|
-
ItemComponent.setMaxStackSize(1), // 设置最大堆叠数量
|
|
42
|
-
ItemComponent.setWearable(5, "slot.armor.chest") // 设置为可穿戴,并指定装备槽
|
|
43
|
-
));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// 扩展 Armor 类,实现靴子
|
|
47
|
-
export class Boot extends Armor {
|
|
48
|
-
constructor(identifier, item_texture, texture_path, options = {}) {
|
|
49
|
-
super(identifier, "equipment", item_texture, texture_path, options);
|
|
50
|
-
options["group"] = "minecraft:itemGroup.name.boots";
|
|
51
|
-
//头盔专属
|
|
52
|
-
this.attachable.addGeometry("default", "geometry.player.armor.boots") // 添加几何模型
|
|
53
|
-
.setScript("parent_setup", "v.boot_layer_visible = 0.0;"); // 设置脚本
|
|
54
|
-
// 自定义靴子物品
|
|
55
|
-
this.item.addComponent(ItemComponent.combineComponents(ItemComponent.setDisplayName("我的自定义靴子"), // 设置显示名称
|
|
56
|
-
ItemComponent.setMaxStackSize(1), // 设置最大堆叠数量
|
|
57
|
-
ItemComponent.setWearable(4, "slot.armor.feet") // 设置为可穿戴,并指定装备槽
|
|
58
|
-
));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
// 扩展 Armor 类,实现裤子
|
|
62
|
-
export class Leggings extends Armor {
|
|
63
|
-
constructor(identifier, item_texture, texture_path, options = {}) {
|
|
64
|
-
super(identifier, "equipment", item_texture, texture_path, options);
|
|
65
|
-
options["group"] = "minecraft:itemGroup.name.leggings";
|
|
66
|
-
//头盔专属
|
|
67
|
-
this.attachable.addGeometry("default", "geometry.player.armor.leggings") // 添加几何模型
|
|
68
|
-
.setScript("parent_setup", "v.leg_layer_visible = 0.0;"); // 设置脚本
|
|
69
|
-
// 自定义裤子物品
|
|
70
|
-
this.item.addComponent(ItemComponent.combineComponents(ItemComponent.setDisplayName("我的自定义裤子"), // 设置显示名称
|
|
71
|
-
ItemComponent.setMaxStackSize(1), // 设置最大堆叠数量
|
|
72
|
-
ItemComponent.setWearable(6, "slot.armor.legs") // 设置为可穿戴,并指定装备槽
|
|
73
|
-
));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
// 扩展 Armor 类,实现头盔
|
|
77
|
-
export class Helmet extends Armor {
|
|
78
|
-
constructor(identifier, item_texture, texture_path, options = {}) {
|
|
79
|
-
super(identifier, "equipment", item_texture, texture_path, options);
|
|
80
|
-
options["group"] = "minecraft:itemGroup.name.helmet";
|
|
81
|
-
//头盔专属
|
|
82
|
-
this.attachable.addGeometry("default", "geometry.player.armor.helmet") // 添加几何模型
|
|
83
|
-
.setScript("parent_setup", "v.helmet_layer_visible = 0.0;"); // 设置脚本
|
|
84
|
-
// 自定义头盔物品
|
|
85
|
-
this.item.addComponent(ItemComponent.combineComponents(ItemComponent.setDisplayName("我的自定义头盔"), // 设置显示名称
|
|
86
|
-
ItemComponent.setMaxStackSize(1), // 设置最大堆叠数量
|
|
87
|
-
ItemComponent.setWearable(3, "slot.armor.head") // 设置为可穿戴,并指定装备槽
|
|
88
|
-
));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { AddonAttachable, AddonAttachableDefinition, AddonAttachableDescription } from "../addon/item/attachable.js";
|
|
2
|
-
export class Attachable extends AddonAttachableDescription {
|
|
3
|
-
constructor(identifier) {
|
|
4
|
-
super(identifier);
|
|
5
|
-
}
|
|
6
|
-
getId() {
|
|
7
|
-
return this.identifier;
|
|
8
|
-
}
|
|
9
|
-
toJson() {
|
|
10
|
-
const entity = new AddonAttachable("1.8.0", new AddonAttachableDefinition(this));
|
|
11
|
-
return entity.toJson();
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
/*
|
|
15
|
-
const attachable = new Attachable("test")
|
|
16
|
-
attachable.addMaterial("default", "armor")
|
|
17
|
-
attachable.addMaterial("enchanted","armor_enchanted")
|
|
18
|
-
attachable.addTexture("default","textures/models/armor/custom_main")
|
|
19
|
-
attachable.addTexture("enchanted", "textures/misc/enchanted_actor_glint")
|
|
20
|
-
attachable.addGeometry("default", "geometry.player.armor.chestplate")
|
|
21
|
-
attachable.addRenderController("controller.render.armor")
|
|
22
|
-
attachable.setScript("parent_setup","v.chest_layer_visible = 0.0;")
|
|
23
|
-
|
|
24
|
-
console.log(JSON.stringify(attachable.toJson(),null,2))
|
|
25
|
-
debugger
|
|
26
|
-
*/
|
package/dist/core/item/food.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export class Food extends Item {
|
|
2
|
-
/**
|
|
3
|
-
* 物品类
|
|
4
|
-
* @param {string} identifier 物品唯一标识符
|
|
5
|
-
* @param {string} category 菜单栏分类 可选:"construction", "nature", "equipment", "items", and "none"
|
|
6
|
-
* @param {string} texture 物品纹理
|
|
7
|
-
* @param {Object} options 可选参数
|
|
8
|
-
* @param {string} options.group 分组
|
|
9
|
-
* @param {boolean} options.hide_in_command 是否在命令中隐藏,默认为 false
|
|
10
|
-
* @param {string} options.animation 使用动画,默认为 "eat"
|
|
11
|
-
* @param {boolean} options.canAlwaysEat 是否总是可以食用,默认为 false
|
|
12
|
-
* @param {number} options.nutrition 营养价值,默认为 0
|
|
13
|
-
* @param {number} options.saturationModifier 饱和度修正值,默认为 1
|
|
14
|
-
*/
|
|
15
|
-
constructor(identifier: string, category: string, texture: string, options?: {
|
|
16
|
-
group: string;
|
|
17
|
-
hide_in_command: boolean;
|
|
18
|
-
animation: string;
|
|
19
|
-
canAlwaysEat: boolean;
|
|
20
|
-
nutrition: number;
|
|
21
|
-
saturationModifier: number;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
import { Item } from "./item.js";
|
package/dist/core/item/food.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { ItemComponent } from "./itemComponents.js";
|
|
2
|
-
import { Item } from "./item.js";
|
|
3
|
-
export class Food extends Item {
|
|
4
|
-
/**
|
|
5
|
-
* 物品类
|
|
6
|
-
* @param {string} identifier 物品唯一标识符
|
|
7
|
-
* @param {string} category 菜单栏分类 可选:"construction", "nature", "equipment", "items", and "none"
|
|
8
|
-
* @param {string} texture 物品纹理
|
|
9
|
-
* @param {Object} options 可选参数
|
|
10
|
-
* @param {string} options.group 分组
|
|
11
|
-
* @param {boolean} options.hide_in_command 是否在命令中隐藏,默认为 false
|
|
12
|
-
* @param {string} options.animation 使用动画,默认为 "eat"
|
|
13
|
-
* @param {boolean} options.canAlwaysEat 是否总是可以食用,默认为 false
|
|
14
|
-
* @param {number} options.nutrition 营养价值,默认为 0
|
|
15
|
-
* @param {number} options.saturationModifier 饱和度修正值,默认为 1
|
|
16
|
-
*/
|
|
17
|
-
constructor(identifier, category, texture, options = {}) {
|
|
18
|
-
// 继承父类
|
|
19
|
-
super(identifier, category, texture, options);
|
|
20
|
-
// 解构 options 并设置默认值
|
|
21
|
-
const { animation = "eat", movement = 1, useDuration = 1, canAlwaysEat = false, nutrition = 0, saturationModifier = 1, } = options;
|
|
22
|
-
// 参数验证
|
|
23
|
-
if (typeof nutrition !== "number" || nutrition < 0) {
|
|
24
|
-
throw new Error('nutrition 必须是一个非负数');
|
|
25
|
-
}
|
|
26
|
-
if (typeof saturationModifier !== "number" || saturationModifier <= 0) {
|
|
27
|
-
throw new Error('saturationModifier 必须是一个正数');
|
|
28
|
-
}
|
|
29
|
-
if (typeof animation !== "string") {
|
|
30
|
-
throw new Error('animation 必须是字符串类型');
|
|
31
|
-
}
|
|
32
|
-
if (typeof canAlwaysEat !== "boolean") {
|
|
33
|
-
throw new Error('canAlwaysEat 必须是布尔类型');
|
|
34
|
-
}
|
|
35
|
-
// 添加组件
|
|
36
|
-
this.addComponent(ItemComponent.combineComponents(ItemComponent.setUseModifiers(movement, useDuration), ItemComponent.setFoodComponent(canAlwaysEat, nutrition, saturationModifier), ItemComponent.setUseAnimation(animation)));
|
|
37
|
-
}
|
|
38
|
-
}
|
package/dist/core/item/item.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export class Item {
|
|
2
|
-
/**
|
|
3
|
-
* 物品类
|
|
4
|
-
* @param {string} identifier 物品唯一标识符
|
|
5
|
-
* @param {string} category 菜单栏分类 可选:"construction", "nature", "equipment", "items", and "none"
|
|
6
|
-
* @param {string} texture 物品纹理
|
|
7
|
-
* @param {Object} options 可选参数
|
|
8
|
-
* @param {string} options.group 分组
|
|
9
|
-
* @param {boolean} options.hide_in_command 是否在命令中隐藏,默认为 false
|
|
10
|
-
*/
|
|
11
|
-
constructor(identifier: string, category: string, texture: string, options?: {
|
|
12
|
-
group: string;
|
|
13
|
-
hide_in_command: boolean;
|
|
14
|
-
});
|
|
15
|
-
identifier: string;
|
|
16
|
-
category: string;
|
|
17
|
-
texture: string;
|
|
18
|
-
group: string;
|
|
19
|
-
hide_in_command: boolean;
|
|
20
|
-
components: Map<any, any>;
|
|
21
|
-
/**
|
|
22
|
-
* 添加组件
|
|
23
|
-
* @param {Map} componentMap 组件 Map
|
|
24
|
-
*/
|
|
25
|
-
addComponent(componentMap: Map<any, any>): this;
|
|
26
|
-
/**
|
|
27
|
-
* 移除组件
|
|
28
|
-
* @param {string} key 组件名称
|
|
29
|
-
*/
|
|
30
|
-
removeComponent(key: string): this;
|
|
31
|
-
/**
|
|
32
|
-
* 将物品转换为 JSON 格式
|
|
33
|
-
* @returns {Object} JSON 格式的物品对象
|
|
34
|
-
*/
|
|
35
|
-
toJson(): any;
|
|
36
|
-
}
|
package/dist/core/item/item.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { ItemComponent } from "./itemComponents.js";
|
|
2
|
-
import { AddonItem, AddonItemDefinition, AddonItemDescription } from "../addon/item/item.js";
|
|
3
|
-
import { AddonMenuCategory } from "../addon/menuCategory.js";
|
|
4
|
-
export class Item {
|
|
5
|
-
/**
|
|
6
|
-
* 物品类
|
|
7
|
-
* @param {string} identifier 物品唯一标识符
|
|
8
|
-
* @param {string} category 菜单栏分类 可选:"construction", "nature", "equipment", "items", and "none"
|
|
9
|
-
* @param {string} texture 物品纹理
|
|
10
|
-
* @param {Object} options 可选参数
|
|
11
|
-
* @param {string} options.group 分组
|
|
12
|
-
* @param {boolean} options.hide_in_command 是否在命令中隐藏,默认为 false
|
|
13
|
-
*/
|
|
14
|
-
constructor(identifier, category, texture, options = {}) {
|
|
15
|
-
// 参数校验
|
|
16
|
-
if (!identifier || typeof identifier !== "string") {
|
|
17
|
-
throw new Error("identifier is required and must be a string");
|
|
18
|
-
}
|
|
19
|
-
if (!category || typeof category !== "string") {
|
|
20
|
-
throw new Error("category is required and must be a string");
|
|
21
|
-
}
|
|
22
|
-
if (!texture || typeof texture !== "string") {
|
|
23
|
-
throw new Error("texture is required and must be a string");
|
|
24
|
-
}
|
|
25
|
-
const { group, hide_in_command = false, max_stack_size = 64, } = options;
|
|
26
|
-
this.identifier = identifier;
|
|
27
|
-
this.category = category;
|
|
28
|
-
this.texture = texture;
|
|
29
|
-
this.group = group;
|
|
30
|
-
this.hide_in_command = hide_in_command;
|
|
31
|
-
this.components = new Map();
|
|
32
|
-
// 初始化默认组件
|
|
33
|
-
this.addComponent(ItemComponent.combineComponents(ItemComponent.setIcon(this.texture), ItemComponent.setMaxStackSize(max_stack_size)));
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* 添加组件
|
|
37
|
-
* @param {Map} componentMap 组件 Map
|
|
38
|
-
*/
|
|
39
|
-
addComponent(componentMap) {
|
|
40
|
-
if (!componentMap || !(componentMap instanceof Map)) {
|
|
41
|
-
throw new Error("componentMap is required and must be a Map");
|
|
42
|
-
}
|
|
43
|
-
for (const [key, value] of componentMap.entries()) {
|
|
44
|
-
this.components.set(key, value);
|
|
45
|
-
}
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 移除组件
|
|
50
|
-
* @param {string} key 组件名称
|
|
51
|
-
*/
|
|
52
|
-
removeComponent(key) {
|
|
53
|
-
if (!key || typeof key !== "string") {
|
|
54
|
-
throw new Error("key is required and must be a string");
|
|
55
|
-
}
|
|
56
|
-
this.components.delete(key);
|
|
57
|
-
return this;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* 将物品转换为 JSON 格式
|
|
61
|
-
* @returns {Object} JSON 格式的物品对象
|
|
62
|
-
*/
|
|
63
|
-
toJson() {
|
|
64
|
-
const item = new AddonItem("1.21.40", // 格式版本
|
|
65
|
-
new AddonItemDefinition(new AddonItemDescription(this.identifier, new AddonMenuCategory(this.category, this.group, this.hide_in_command)), Object.fromEntries(this.components) // 将 Map 转换为普通对象
|
|
66
|
-
));
|
|
67
|
-
return item.toJson();
|
|
68
|
-
}
|
|
69
|
-
}
|