sapdon 3.0.1 → 3.0.3
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 +3 -1
- package/dist/cli/build.js +3 -1
- package/dist/cli/dev-server/client.js +2 -1
- package/dist/cli/dev-server/handles.d.ts +4 -0
- package/dist/cli/dev-server/handles.js +5 -0
- package/dist/cli/dev-server/index.d.ts +3 -2
- package/dist/cli/dev-server/index.js +12 -6
- package/dist/cli/dev-server/server.d.ts +13 -5
- package/dist/cli/dev-server/server.js +51 -42
- package/dist/cli/dev-server/syncFiles.js +2 -1
- package/dist/cli/index.d.ts +23 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/init.d.ts +1 -1
- package/dist/cli/load.d.ts +1 -1
- package/dist/cli/start.js +1 -155
- package/dist/cli/utils.d.ts +1 -1
- package/dist/core/addon/block/block.d.ts +2 -2
- package/dist/core/addon/controllers/animationController.d.ts +1 -1
- package/dist/core/addon/entity/clientEntity.d.ts +11 -11
- package/dist/core/addon/entity/entity.d.ts +4 -4
- package/dist/core/addon/item/attachable.d.ts +10 -10
- package/dist/core/addon/manifest.d.ts +1 -1
- package/dist/core/biome/biomeComponent.d.ts +1 -1
- package/dist/core/block/basicBlock.d.ts +1 -1
- package/dist/core/block/blockComponent.d.ts +4 -4
- package/dist/core/block/geometryBlock.d.ts +1 -1
- package/dist/core/entity/basicEntity.d.ts +9 -9
- package/dist/core/entity/behavior/randomStroll.d.ts +1 -1
- package/dist/core/entity/behavior/tempt.d.ts +2 -2
- package/dist/core/entity/clientEntity.d.ts +2 -2
- package/dist/core/entity/componets/entityComponet.d.ts +4 -4
- package/dist/core/entity/data/nativeEntityData.d.ts +2 -2
- package/dist/core/entity/navigation/walk.d.ts +19 -19
- package/dist/core/factory/entityFactory.d.ts +3 -3
- package/dist/core/factory/itemFactory.d.ts +1 -1
- package/dist/core/factory/uiFactory.d.ts +2 -1
- package/dist/core/factory/uiFactory.js +1 -1
- package/dist/core/feature-rule/condition/biomeFilter.d.ts +2 -2
- package/dist/core/feature-rule/condition/featureConditions.d.ts +2 -2
- package/dist/core/feature-rule/distribution/coordinateDistribution.d.ts +1 -1
- package/dist/core/feature-rule/distribution/featureDistribution.d.ts +4 -4
- package/dist/core/index.d.ts +2062 -24
- package/dist/core/index.js +1 -21
- package/dist/core/item/attachable.d.ts +1 -1
- package/dist/core/item/item.d.ts +1 -1
- package/dist/core/item/itemComponents.d.ts +1 -1
- package/dist/core/texture.d.ts +1 -1
- package/dist/core/ui/buttonMapping.d.ts +3 -3
- package/dist/core/ui/dataBindingObject.d.ts +11 -11
- package/dist/core/ui/properties/control.d.ts +23 -23
- package/dist/core/ui/properties/dataBinding.d.ts +1 -1
- package/dist/core/ui/properties/factory.d.ts +1 -1
- package/dist/core/ui/properties/gridProp.d.ts +7 -7
- package/dist/core/ui/properties/input.d.ts +11 -11
- package/dist/core/ui/properties/layout.d.ts +12 -12
- package/dist/core/ui/properties/scrollView.d.ts +12 -12
- package/dist/core/ui/properties/sound.d.ts +4 -4
- package/dist/core/ui/properties/sprite.d.ts +19 -19
- package/dist/core/ui/properties/text.d.ts +15 -15
- package/dist/core/ui/systems/chest.d.ts +2 -1
- package/dist/core/ui/systems/chest.js +1 -1
- package/dist/core/ui/systems/containerUISystem.d.ts +8 -5
- package/dist/core/ui/systems/containerUISystem.js +9 -1
- package/dist/core/ui/systems/guidebook.d.ts +2 -1
- package/dist/core/ui/systems/guidebook.js +1 -1
- package/dist/core/ui/systems/serverForm.d.ts +2 -1
- package/dist/core/ui/systems/serverForm.js +1 -1
- package/dist/core/ui/systems/system.js +2 -2
- package/dist/oc/index.d.ts +142 -0
- package/dist/oc/index.js +1 -0
- package/doc/cli.md +24 -0
- package/doc/sapdon-ts.md +51 -5
- package/package.json +6 -8
package/dist/core/index.js
CHANGED
|
@@ -1,21 +1 @@
|
|
|
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
|
+
import t from"fs";import e from"path";import{fileURLToPath as i}from"url";class r{static setTick(t,e){return(new Map).set("minecraft:tick",{interval_range:t,looping:e})}static setCustomComponents(t){return(new Map).set("minecraft:custom_components",[...t])}static setTransformation(t=[0,0,0],e=[1,1,1],i=[0,0,0],r=[0,0,0],s=[0,0,0]){const n=(t,e)=>{if(!Array.isArray(t)||3!==t.length||!t.every((t=>"number"==typeof t&&!isNaN(t))))throw new Error(`${e} 必须是一个包含 3 个有效数字的数组`)};n(t,"translation"),n(e,"scale"),n(i,"scale_pivot"),n(r,"rotation"),n(s,"rotation_pivot");const o={translation:t,scale:e,scale_pivot:i,rotation:r,rotation_pivot:s},a=new Map;return a.set("minecraft:transformation",o),a}static setBreathability(t){if("solid"!==t&&"air"!==t)throw new Error('breathability must be either "solid" or "air"');return(new Map).set("minecraft:breathability",t)}static setCollisionBoxEnabled(t){if("boolean"!=typeof t)throw new Error("enabled must be a boolean");return(new Map).set("minecraft:collision_box",t)}static setCollisionBoxCustom(t,e){if(!Array.isArray(t)||3!==t.length)throw new Error("origin must be an array of 3 numbers");if(!Array.isArray(e)||3!==e.length)throw new Error("size must be an array of 3 numbers");const[i,r,s]=t,[n,o,a]=e;if(i<-8||i>8||r<0||r>16||s<-8||s>8)throw new Error("origin must be in the range (-8, 0, -8) to (8, 16, 8)");if(i+n<-8||i+n>8||r+o<0||r+o>16||s+a<-8||s+a>8)throw new Error("origin + size must be in the range (-8, 0, -8) to (8, 16, 8)");return(new Map).set("minecraft:collision_box",{origin:t,size:e})}static setCraftingTable(t,e){if(!Array.isArray(t)||t.length>64)throw new Error("craftingTags must be an array with a maximum of 64 tags");for(const e of t)if("string"!=typeof e||e.length>64)throw new Error("each crafting tag must be a string with a maximum of 64 characters");if(e&&"string"!=typeof e)throw new Error("tableName must be a string");return(new Map).set("minecraft:crafting_table",{crafting_tags:t,table_name:e})}static setDestructibleByExplosionEnabled(t){if("boolean"!=typeof t)throw new Error("enabled must be a boolean");return(new Map).set("minecraft:destructible_by_explosion",t)}static setDestructibleByExplosionCustom(t){if("number"!=typeof t)throw new Error("explosionResistance must be a number");return(new Map).set("minecraft:destructible_by_explosion",{explosion_resistance:t})}static setDestructibleByMiningEnabled(t){if("boolean"!=typeof t)throw new Error("enabled must be a boolean");return(new Map).set("minecraft:destructible_by_mining",t)}static setDestructibleByMiningCustom(t,e){if("number"!=typeof t)throw new Error("secondsToDestroy must be a number");if(e&&Array.isArray(e))for(const t of e){if("number"!=typeof t.destroy_speed)throw new Error("destroy_speed must be a number");if(!t.item)throw new Error("item is required in item_specific_speeds")}return(new Map).set("minecraft:destructible_by_mining",{seconds_to_destroy:t,item_specific_speeds:e})}static setDisplayName(t){if("string"!=typeof t)throw new Error("displayName must be a string");return(new Map).set("minecraft:display_name",t)}static setFlammableEnabled(t){if("boolean"!=typeof t)throw new Error("enabled must be a boolean");return(new Map).set("minecraft:flammable",t)}static setFlammableCustom(t,e){if("number"!=typeof t||t<0)throw new Error("catchChanceModifier must be a number greater than or equal to 0");if("number"!=typeof e||e<0)throw new Error("destroyChanceModifier must be a number greater than or equal to 0");return(new Map).set("minecraft:flammable",{catch_chance_modifier:t,destroy_chance_modifier:e})}static setFriction(t){if("number"!=typeof t||t<0||t>.9)throw new Error("friction must be a number between 0.0 and 0.9");return(new Map).set("minecraft:friction",t)}static setGeometry(t,e){if("string"!=typeof t)throw new Error("identifier must be a string");return(new Map).set("minecraft:geometry",{identifier:t,bone_visibility:e})}static setItemVisual(t,e){if("string"!=typeof t)throw new Error("geometry must be a string");if(!e||"object"!=typeof e)throw new Error("materialInstances must be an object");return(new Map).set("minecraft:item_visual",{geometry:t,material_instances:e})}static setLightDampening(t){if("number"!=typeof t||t<0||t>15)throw new Error("lightDampening must be a number between 0 and 15");return(new Map).set("minecraft:light_dampening",t)}static setLightEmission(t){if("number"!=typeof t||t<0||t>15)throw new Error("lightEmission must be a number between 0 and 15");return(new Map).set("minecraft:light_emission",t)}static setLiquidDetection(t,e,i,r){if("boolean"!=typeof t)throw new Error("canContainLiquid must be a boolean");if(e&&"water"!==e)throw new Error('liquidType must be "water"');if(i&&!["blocking","broken","popped","no_reaction"].includes(i))throw new Error('onLiquidTouches must be one of: "blocking", "broken", "popped", "no_reaction"');const s=["up","down","north","south","east","west"];if(r&&Array.isArray(r))for(const t of r)if(!s.includes(t))throw new Error('stopsLiquidFlowingFromDirection must be one of: "up", "down", "north", "south", "east", "west"');return(new Map).set("minecraft:liquid_detection",{can_contain_liquid:t,liquid_type:e,on_liquid_touches:i,stops_liquid_flowing_from_direction:r})}static setLoot(t){if("string"!=typeof t||t.length>256)throw new Error("path must be a string with a maximum length of 256 characters");return(new Map).set("minecraft:loot",t)}static setMapColor(t){if("string"==typeof t){if(!/^#[0-9A-Fa-f]{6}$/.test(t))throw new Error('mapColor must be a valid hex string (e.g., "#FFFFFF")')}else{if(!Array.isArray(t))throw new Error("mapColor must be a hex string or an RGB array");if(3!==t.length||t.some((t=>"number"!=typeof t||t<0||t>255)))throw new Error("mapColor must be a valid RGB array (e.g., [255, 255, 255])")}return(new Map).set("minecraft:map_color",t)}static setMaterialInstances(t){if(!t||"object"!=typeof t)throw new Error("instances must be an object");if(!t["*"])throw new Error('material_instances must include a "*" material instance');for(const[e,i]of Object.entries(t))if("object"==typeof i){if(!i.texture||"string"!=typeof i.texture)throw new Error(`material instance "${e}" must have a texture`);if(void 0!==i.ambient_occlusion&&"boolean"!=typeof i.ambient_occlusion&&"number"!=typeof i.ambient_occlusion)throw new Error(`ambient_occlusion in material instance "${e}" must be a boolean or number`);if(void 0!==i.face_dimming&&"boolean"!=typeof i.face_dimming)throw new Error(`face_dimming in material instance "${e}" must be a boolean`);if(i.render_method&&!["opaque","double_sided","blend","alpha_test","alpha_test_single_sided"].includes(i.render_method))throw new Error(`render_method in material instance "${e}" must be one of: opaque, double_sided, blend, alpha_test, alpha_test_single_sided`)}else if("string"!=typeof i)throw new Error(`material instance "${e}" must be an object or a string`);return(new Map).set("minecraft:material_instances",t)}static setPlacementFilter(t){if(!Array.isArray(t)||0===t.length||t.length>64)throw new Error("conditions must be an array with 1 to 64 elements");for(const e of t){if(e.allowed_faces&&Array.isArray(e.allowed_faces)){const t=["up","down","north","south","east","west","side","all"];for(const i of e.allowed_faces)if(!t.includes(i))throw new Error(`allowed_faces must be one of: ${t.join(", ")}`)}if(e.block_filter&&Array.isArray(e.block_filter))for(const t of e.block_filter)if("string"!=typeof t){if("object"!=typeof t||null===t)throw new Error("block_filter must be a string or a BlockDescriptor object");if(t.tags&&"string"!=typeof t.tags)throw new Error("tags in block_filter must be a string");if(t.name&&"string"!=typeof t.name)throw new Error("name in block_filter must be a string");if(t.states&&"object"!=typeof t.states)throw new Error("states in block_filter must be an object")}if(!e.allowed_faces&&!e.block_filter)throw new Error("each condition must have at least one of allowed_faces or block_filter")}return(new Map).set("minecraft:placement_filter",{conditions:t})}static setRedstoneConductivity(t,e){if("boolean"!=typeof t)throw new Error("allowsWireToStepDown must be a boolean");if("boolean"!=typeof e)throw new Error("redstoneConductor must be a boolean");return(new Map).set("minecraft:redstone_conductivity",{allows_wire_to_step_down:t,redstone_conductor:e})}static setSelectionBoxEnabled(t){if("boolean"!=typeof t)throw new Error("enabled must be a boolean");return(new Map).set("minecraft:selection_box",t)}static setSelectionBoxCustom(t,e){if(!Array.isArray(t)||3!==t.length)throw new Error("origin must be an array of 3 numbers");if(!Array.isArray(e)||3!==e.length)throw new Error("size must be an array of 3 numbers");const[i,r,s]=t,[n,o,a]=e;if(i<-8||i>8||r<0||r>16||s<-8||s>8)throw new Error("origin must be in the range (-8, 0, -8) to (8, 16, 8)");if(i+n<-8||i+n>8||r+o<0||r+o>16||s+a<-8||s+a>8)throw new Error("origin + size must be in the range (-8, 0, -8) to (8, 16, 8)");return(new Map).set("minecraft:selection_box",{origin:t,size:e})}static combineComponents(...t){return new Map(t.flatMap((t=>[...t])))}static toJSON(t){return Object.fromEntries(t)}}class s{constructor(t,e,i){this.category=t,this.group=e,this.is_hidden_in_commands=i}}class n{constructor(t,e){this.format_version=t,this.definitions=e}toJson(){return{format_version:this.format_version,"minecraft:block":this.definitions}}}class o{constructor(t,e,i=[]){this.description=t,this.components=e,this.permutations=i}}class a{constructor(t,e,i,r){this.identifier=t,this.traits=e,this.states=i,this.menu_category=r}}class c{constructor(t,e,i,r={}){if(!t||"string"!=typeof t)throw new Error("identifier is required and must be a string");if(!e||"string"!=typeof e)throw new Error("category is required and must be a string");if(!Array.isArray(i))throw new Error("textures_arr must be an array ");if(6!==i.length)for(let t=i.length;t<6;t++)i.push(i[0]);const{hide_in_command:s=!1}=r;this.identifier=t,this.category=e,this.textures=i,this.group=r.group,this.hide_in_command=s,this.traits=new Map,this.states=new Map,this.components=new Map,this.permutations=[]}getId(){return this.identifier}registerTrait(t,e){return this.traits.set(t,e),this}registerState(t,e){return this.states.set(t,e),this}addComponent(t){if(!(t&&t instanceof Map))throw new Error("componentMap is required and must be a Map");for(const[e,i]of t.entries())this.components.set(e,i);return this}removeComponent(t){if(!t||"string"!=typeof t)throw new Error("key is required and must be a string");return this.components.delete(t),this}addPermutation(t,e){if(!t||"string"!=typeof t)throw new Error("condition is required and must be a string");if(!(e&&e instanceof Map))throw new Error("componentMap is required and must be a Map");return this.permutations.push({condition:t,components:Object.fromEntries(e)}),this}toJson(){return new n("1.21.50",new o(new a(this.identifier,Object.fromEntries(this.traits),Object.fromEntries(this.states),new s(this.category,this.group,this.hide_in_command)),Object.fromEntries(this.components),this.permutations)).toJson()}}class h extends c{constructor(t,e,i,r={}){if(console.log("options:",r),!Array.isArray(i)||0===i.length)throw new Error("variantDatas 必须是一个非空数组");super(t,e,i[0].textures,r),this.options=r,this.variantDatas=i,this.#t()}#t(){this.registerState("sapdon:block_variant_tag",{values:{min:0,max:this.variantDatas.length>1?this.variantDatas.length-1:1}}),this.variantDatas.forEach(((t,e)=>{const i=this.#e(t.textures,this.options),s=`q.block_state('sapdon:block_variant_tag') == ${e}`;this.addPermutation(s,r.setMaterialInstances(i))}))}#e(t){const e={},i=["*","up","down","north","south","east","west"];return t.forEach(((t,r)=>{e[i[r]]={texture:t,ambient_occlusion:this.options.ambient_occlusion||!0,face_dimming:this.options.face_dimming||!0,render_method:this.options.render_method||"alpha_test"}})),e}addVariantComponent(t,e){if(t<0||t>=this.variantDatas.length)throw new Error("variantIndex 必须在 0 到 variantDatas.length-1 之间");const i=`q.block_state('sapdon:block_variant_tag') == ${t}`;return this.addPermutation(i,e),this}}class u extends h{constructor(t,e,i,s={}){super(t,e,i,s),this.stageNum=i.length,this.addComponent(r.combineComponents(r.setCollisionBoxEnabled(!1),r.setGeometry("geometry.crop"),r.setLightEmission(0),r.setPlacementFilter([{allowed_faces:["up"],block_filter:["minecraft:farmland"]}])));for(let t=0;t<this.stageNum;t++)this.addVariantComponent(t,r.setSelectionBoxCustom([-8,0,-8],[16,(t+1)*this.stageNum/16,16]))}}class l extends c{constructor(t,e,i,s,n={}){super(t,e,[s["*"].texture],n),this.addComponent(r.combineComponents(r.setGeometry(i),r.setMaterialInstances(s)))}}class d{constructor(t,e){this.format_version=t,this.definition=e}toJson(){return{format_version:this.format_version,"minecraft:ore_feature":this.definition}}}class m{constructor(t){this.identifier=t}}class p{constructor(t,e,i){this.description=t,this.count=e,this.replace_rules=i}}class f{constructor(t,e,i){this.identifier=t,this.count=e,this.replace_rules=i}toJson(){return new d("1.17.0",new p(new m(this.identifier),this.count,this.replace_rules)).toJson()}}class _{constructor(){this.filters=[]}addLogicGroup(t,e){return this.filters.push({[t]:e}),this}addSimpleCondition(t,e,i){return this.filters.push({test:t,operator:e,value:i}),this}toJson(){return this.filters}}class w{constructor(t="uniform",e=[0,16]){this.distribution=t,this.extent=e}toJson(){return{distribution:this.distribution,extent:this.extent}}}class b{constructor(t,e){this.format_version=t,this.denifition=e}toJson(){return{format_version:this.format_version,"minecraft:feature_rules":this.denifition}}}class g{constructor(t,e,i){this.description=t,this.conditions=e,this.distribution=i}}class y{constructor(t,e){this.identifier=t,this.places_feature=e}}class x{constructor(){this.conditions={placement_pass:"underground_pass","minecraft:biome_filter":[]}}setPlacementPass(t){return this.conditions.placement_pass=t,this}setBiomeFilter(t){return this.conditions["minecraft:biome_filter"]=t.toJson(),this}toJson(){return this.conditions}}class E{constructor(){this.distribution={iterations:10,coordinate_eval_order:"zyx",x:(new w).toJson(),y:(new w).toJson(),z:(new w).toJson()}}setIterations(t){return this.distribution.iterations=t,this}setAxisDistribution(t,e){return this.distribution[t]=e.toJson(),this}toJson(){return this.distribution}}class v{constructor(t,e){this.identifier=t,this.places_feature=e,this.condition=new x,this.distribution=new E}setPlacementPass(t){this.condition.setPlacementPass(t)}setBiomeFilter(t){this.condition.setBiomeFilter(t)}setIterations(t){this.distribution.setIterations(t)}setAxisDistribution(t,e){this.distribution.setAxisDistribution(t,e)}toJson(){return new b("1.13.0",new g(new y(this.identifier,this.places_feature),this.condition.toJson(),this.distribution.toJson())).toJson()}}class C{constructor(t,e,i,r={}){this.block=new c(t,e,i,r),this.feature=new f(`${t}_ore_feature`,6,[{places_block:t,may_replace:["minecraft:stone"]}]),this.feature_rules=new v(`${t}_orefeatre_rule`,`${t}_ore_feature`),this.feature_rules.condition.setPlacementPass("underground_pass").setBiomeFilter((new _).addLogicGroup("any_of",[{test:"has_biome_tag",operator:"==",value:"overworld"},{test:"has_biome_tag",operator:"==",value:"overworld_generation"}])),this.feature_rules.distribution.setIterations(10).setAxisDistribution("x",new w("uniform",[0,16])).setAxisDistribution("y",new w("uniform",[0,64])).setAxisDistribution("z",new w("uniform",[0,16]))}}const k={CARDINAL:"cardinal",FACING:"facing",BLOCK_FACE:"block_face",LOG:"log"};class M extends c{constructor(t,e,i,r={}){super(t,e,i,r);const{rotationType:s=k.CARDINAL,yRotationOffset:n=180}=r;this.#i(s,n)}#i(t,e){switch(t){case k.CARDINAL:this.registerTrait("minecraft:placement_direction",{enabled_states:["minecraft:cardinal_direction"],y_rotation_offset:e}),this.#r();break;case k.FACING:this.registerTrait("minecraft:placement_direction",{enabled_states:["minecraft:facing_direction"]}),this.#s();break;case k.BLOCK_FACE:this.registerTrait("minecraft:placement_position",{enabled_states:["minecraft:block_face"]}),this.#n();break;case k.LOG:this.registerTrait("minecraft:placement_position",{enabled_states:["minecraft:block_face"]}),this.#o();break;default:throw new Error(`Unknown rotation type: ${t}`)}}#r(){this.addPermutation("q.block_state('minecraft:cardinal_direction') == 'north'",r.setTransformation([0,0,0],[1,1,1],[0,0,0],[0,0,0])).addPermutation("q.block_state('minecraft:cardinal_direction') == 'south'",r.setTransformation([0,0,0],[1,1,1],[0,0,0],[0,90,0])).addPermutation("q.block_state('minecraft:cardinal_direction') == 'east'",r.setTransformation([0,0,0],[1,1,1],[0,0,0],[0,180,0])).addPermutation("q.block_state('minecraft:cardinal_direction') == 'west'",r.setTransformation([0,0,0],[1,1,1],[0,0,0],[0,-90,0]))}#s(){this.addPermutation("q.block_state('minecraft:facing_direction') == 'down'",r.setTransformation([0,0,0],[1,1,1],[0,0,0],[-90,0,0])).addPermutation("q.block_state('minecraft:facing_direction') == 'up'",r.setTransformation([0,0,0],[1,1,1],[0,0,0],[90,0,0])).addPermutation("q.block_state('minecraft:facing_direction') == 'north'",r.setTransformation([0,0,0],[1,1,1],[0,0,0],[0,0,0])).addPermutation("q.block_state('minecraft:facing_direction') == 'west'",r.setTransformation([0,0,0],[1,1,1],[0,0,0],[0,90,0])).addPermutation("q.block_state('minecraft:facing_direction') == 'south'",r.setTransformation([0,0,0],[1,1,1],[0,0,0],[0,180,0])).addPermutation("q.block_state('minecraft:facing_direction') == 'east'",r.setTransformation([0,0,0],[1,1,1],[0,0,0],[0,-90,0]))}#n(){this.addPermutation("q.block_state('minecraft:block_face') == 'down'",r.setTransformation([0,0,0],[1,1,1],[-90,0,0],[0,0,0])).addPermutation("q.block_state('minecraft:block_face') == 'up'",r.setTransformation([0,0,0],[1,1,1],[90,0,0],[0,0,0])).addPermutation("q.block_state('minecraft:block_face') == 'north'",r.setTransformation([0,0,0],[1,1,1],[0,0,0],[0,0,0])).addPermutation("q.block_state('minecraft:block_face') == 'south'",r.setTransformation([0,0,0],[1,1,1],[0,180,0],[0,90,0])).addPermutation("q.block_state('minecraft:block_face') == 'east'",r.setTransformation([0,0,0],[1,1,1],[0,90,0],[0,180,0])).addPermutation("q.block_state('minecraft:block_face') == 'west'",r.setTransformation([0,0,0],[1,1,1],[0,-90,0],[0,-90,0]))}#o(){this.addPermutation("q.block_state('minecraft:block_face') == 'west' || q.block_state('minecraft:block_face') == 'east'",r.setTransformation([0,0,0],[1,1,1],[0,0,90],[0,0,0])).addPermutation("q.block_state('minecraft:block_face') == 'down' || q.block_state('minecraft:block_face') == 'up'",r.setTransformation([0,0,0],[1,1,1],[0,0,0],[0,0,0])).addPermutation("q.block_state('minecraft:block_face') == 'north' || q.block_state('minecraft:block_face') == 'south'",r.setTransformation([0,0,0],[1,1,1],[90,0,0],[0,0,0]))}}class P{static dataList=[];static register(t,e,i,r){P.dataList.push({name:t,root:e,path:i,data:r})}static getDataList(){return[...P.dataList]}}const B=t=>{if(!t||!t.identifier)throw new Error("无效的方块对象或缺少 identifier。");const e=t.identifier.replace(":","_");P.register(e,"behavior","blocks/",t)},T={createBasicBlock:function(t,e,i,r={}){if(!t||!e||!i)throw new Error("必须提供 identifier、category 和长度为 6 的 textures_arr。");const s=new c(t,e,i,{hide_in_command:!1,...r});return B(s),s},createBlock:function(t,e,i,r={}){if(!t||!e||!i||0===i.length)throw new Error("必须提供 identifier、category 和 variantDatas。");const s=new h(t,e,i,{hide_in_command:!1,ambient_occlusion:!1,face_dimming:!1,render_method:"alpha_test",...r});return B(s),s},createRotatableBlock:function(t,e,i,r={}){if(!t||!e||!i)throw new Error("必须提供 identifier、category 和 textures_arr。");const s=new M(t,e,i,{hide_in_command:!1,rotationType:"cardinal",yRotationOffset:180,...r});return B(s),s},createGeometryBlock:function(t,e,i,r,s={}){if(!(t&&e&&i&&r))throw new Error("必须提供 identifier、category、geometry 和 material_instances。");const n=new l(t,e,i,r,s);return B(n),n},createOreBlock(t,e,i,r={}){const s=new C(t,e,i,r);return B(s.block),(t=>{const e=t.identifier.split(":")[t.identifier.split(":").length-1];P.register(e,"behavior","features/",t)})(s.feature),(t=>{const e=t.identifier.split(":")[t.identifier.split(":").length-1];P.register(e,"behavior","feature_rules/",t)})(s.feature_rules),s},createCropBlock:function(t,e,i,r={}){if(!t||!e||!i||0===i.length)throw new Error("必须提供 identifier、category 和 variantDatas。");const s=new u(t,e,i,{hide_in_command:!1,ambient_occlusion:!0,face_dimming:!0,render_method:"alpha_test",...r});return B(s),s}};class S{constructor(t,e){this.format_version=t,this.definitions=e}toJson(){return{format_version:this.format_version,"minecraft:entity":this.definitions}}}class A{constructor(t,e={},i={},r={}){this.description=t,this.components=e,this.component_groups=i,this.events=r}}class O{constructor(t,e=!1,i=!1,r={},s){this.identifier=t,this.is_spawnable=e,this.is_summonable=i,this.properties=r,this.runtime_identifier=s}}class D{constructor(t,e={},i={}){if("string"!=typeof t||!t)throw new Error("identifier must be a non-empty string.");if(e.runtime_identifier&&"string"!=typeof e.runtime_identifier)throw new Error("runtime_identifier must be a string.");this.identifier=t,this.is_spawnable=e.is_spawnable??!0,this.is_summonable=e.is_summonable??!0,this.runtime_identifier=e.runtime_identifier,this.properties=new Map(Object.entries(i.description&&i.description.properties||{})),this.components=new Map(Object.entries(i.components||{})),this.component_groups=new Map(Object.entries(i.component_groups||{})),this.events=new Map(Object.entries(i.events||{}))}addProperty(t,e){return this.properties.set(t,e),this}removeProperty(t){return this.properties.delete(t),this}clearProperties(){return this.properties.clear(),this}addEvent(t,e){if(!(e instanceof Map))throw new Error("eventMap must be an instance of Map.");return this.events.set(t,e),this}removeEvent(t){return this.events.delete(t),this}clearEvents(){return this.events.clear(),this}addComponentGroup(t,e){if(!(e instanceof Map))throw new Error("componentMap must be an instance of Map.");return this.component_groups.set(t,e),this}removeComponentGroup(t){return this.component_groups.delete(t),this}clearComponentGroups(){return this.component_groups.clear(),this}addComponent(t){if(!(t instanceof Map))throw new Error("componentMap must be an instance of Map.");for(const[e,i]of t)this.components.set(e,i);return this}removeComponent(t){return this.components.delete(t),this}clearComponents(){return this.components.clear(),this}clearAll(){return this.components.clear(),this.component_groups.clear(),this.events.clear(),this}toJson(){return new S("1.16.0",new A(new O(this.identifier,this.is_spawnable,this.is_summonable,Object.fromEntries(this.properties),this.runtime_identifier),Object.fromEntries(this.components),Object.fromEntries(this.component_groups),Object.fromEntries(this.events))).toJson()}}class N{constructor(t,e){this.format_version=t,this.definitions=e}toJson(){return{format_version:this.format_version,"minecraft:client_entity":this.definitions}}}class F{constructor(t){this.description=t}}class I{constructor(t,e){this.identifier=t,this.min_engine_version=e}addMaterial(t,e){return null==this.materials&&(this.materials={}),this.materials[t]=e,this}addTexture(t,e){return null==this.textures&&(this.textures={}),this.textures[t]=e,this}addGeometry(t,e){return null==this.geometry&&(this.geometry={}),this.geometry[t]=e,this}addAnimation(t,e){return null==this.animations&&(this.animations={}),this.animations[t]=e,this}addAnimationController(t,e){return null==this.animation_controllers&&(this.animation_controllers=[]),this.animation_controllers.push({[t]:e}),this}addRenderController(t){return null==this.render_controllers&&(this.render_controllers=[]),this.render_controllers.push(t),this}addLocator(t,e){return null==this.locators&&(this.locators={}),this.locators[t]=e,this}setSpawnEgg(t,e){return this.spawn_egg={texture:t,texture_index:e},this}setScript(t,e){return null==this.scripts&&(this.scripts={}),this.scripts[t]=e,this}}class z extends I{constructor(t,e={}){super(t);Object.keys(e).forEach((t=>{"identifier"!==t&&(this[t]=e[t])}))}toJson(){return new N("1.10.0",new F(this)).toJson()}}class q{constructor(t,e,i,r,s={}){this.identifier=t,this.entity=new D(t,s,i),this.client_entity=new z(t,r).addTexture("default",e)}}const j=e.dirname(i(import.meta.url));class R{static behDataPath=e.join(j,"data_bp.json");static resDataPath=e.join(j,"data_rp.json");static behData=null;static resData=null;static loadDataSync(e){try{const i=t.readFileSync(e,"utf8");return JSON.parse(i)}catch(t){return console.error(`Failed to load data from $$${e}:`,t),{}}}static reloadDataSync(){this.behData=this.loadDataSync(this.behDataPath),this.resData=this.loadDataSync(this.resDataPath)}static getDataById(t,e){if("string"!=typeof t||"string"!=typeof e)throw new Error("type and id must be strings");return this.behData&&this.resData||this.reloadDataSync(),"beh"===t?this.behData[e]||null:this.resData[e]||null}}class L{constructor(t,e,i={}){try{const r=R.getDataById("beh",e)?.["minecraft:entity"];if(!r)throw new Error(`Behavior data not found for proto_id: ${e}`);const s=R.getDataById("res",e)?.["minecraft:client_entity"]?.description;if(!s)throw new Error(`Resource data not found for proto_id: ${e}`);i.runtime_identifier=e,this.identifier=t,this.entity=new D(t,i,r),this.client_entity=new z(t,s)}catch(e){throw console.error(`Failed to create NativeEntity ${t}:`,e),e}}}class G extends L{constructor(t,e,i={}){super(t,"minecraft:snowball",i),this.client_entity.addTexture("default",e)}}const J=(t,e)=>{t&&Object.keys(t).length>0&&P.register(t.identifier.replace(":","_"),"behavior","entities/",t),e&&Object.keys(e).length>0&&P.register(e.identifier.replace(":","_"),"resource","entity/",e)},$={createNativeEntity:function(t,e,i={}){if(!t||!e)throw new Error("必须提供 identifier、proto_id 和 texture。");const r=new L(t,e,i);return J(r.entity,r.client_entity),{behavior:r.entity,resource:r.client_entity}},createEntity:function(t,e,i,r,s={}){if(!t||!e)throw new Error("必须提供 identifier 和 texture。");const n=new q(t,e,i,r,s);return J(n.entity,n.client_entity),{behavior:n.entity,resource:n.client_entity}},createProjectile:function(t,e,i={}){if(!t||!e)throw new Error("必须提供 identifier 和 texture。");const r=new G(t,e,i);return J(r.entity,r.client_entity),{behavior:r.entity,resource:r.client_entity}}},V={createOreFeature:function(t,e,i){const r=new f(t,e,i);return(t=>{const e=t.identifier.split(":")[t.identifier.split(":").length-1];P.register(e,"behavior","features/",t)})(r),r},createFeatureRules:function(t,e){const i=new v(t,e);return(t=>{const e=t.identifier.split(":")[t.identifier.split(":").length-1];P.register(e,"behavior","feature_rules/",t)})(i),i}};class U{constructor(t,e){this.format_version=t,this.definitions=e}toJson(){return{format_version:this.format_version,"minecraft:attachable":this.definitions}}}class H{constructor(t){this.description=t}}class W{constructor(t){this.identifier=t}addMaterial(t,e){return null==this.materials&&(this.materials={}),this.materials[t]=e,this}addTexture(t,e){return null==this.textures&&(this.textures={}),this.textures[t]=e,this}addGeometry(t,e){return null==this.geometry&&(this.geometry={}),this.geometry[t]=e,this}addAnimation(t,e){return null==this.animations&&(this.animations={}),this.animations[t]=e,this}addAnimationController(t,e){return null==this.animation_controllers&&(this.animation_controllers=[]),this.animation_controllers.push({[t]:e}),this}addRenderController(t){return null==this.render_controllers&&(this.render_controllers=[]),this.render_controllers.push(t),this}addLocator(t,e){return null==this.locators&&(this.locators={}),this.locators[t]=e,this}setScript(t,e){return null==this.scripts&&(this.scripts={}),this.scripts[t]=e,this}}class K extends W{constructor(t){super(t)}getId(){return this.identifier}toJson(){return new U("1.8.0",new H(this)).toJson()}}class Z{static setDurability(t,e=0,i=100){return(new Map).set("minecraft:durability",{damage_chance:{min:e,max:i},max_durability:t})}static setBlockPlacer(t,e,i){return(new Map).set("minecraft:block_placer",{block:t,replace_block_item:e,use_on:i})}static setCustomComponents(t){return(new Map).set("minecraft:custom_components",[...t])}static setThrowable(t=!1,e=1,i=0,r=1,s=0,n=!1){return(new Map).set("minecraft:throwable",{do_swing_animation:t,launch_power_scale:e,max_draw_duration:i,max_launch_power:r,min_draw_duration:s,scale_power_by_draw_duration:n})}static setDisplayName(t){if("string"!=typeof t)throw new Error("显示名称必须是字符串类型");return(new Map).set("minecraft:display_name",{value:t})}static setFoodComponent(t,e,i,r){return(new Map).set("minecraft:food",{can_always_eat:t,nutrition:e||0,saturation_modifier:i||.6,using_converts_to:r||void 0})}static setFuel(t){if("number"!=typeof t||t<.05)throw new Error("燃料持续时间必须是一个大于或等于 0.05 的数字");return(new Map).set("minecraft:fuel",{duration:t})}static setGlint(t){if("boolean"!=typeof t)throw new Error("附魔光效值必须是布尔类型");return(new Map).set("minecraft:glint",t)}static setHandEquipped(t){if("boolean"!=typeof t)throw new Error("手持渲染方式值必须是布尔类型");return(new Map).set("minecraft:hand_equipped",t)}static setIcon(t){if("string"!=typeof t)throw new Error("图标纹理必须是字符串类型");return(new Map).set("minecraft:icon",t)}static setMaxStackSize(t=64){if("number"!=typeof t||t<=0||!Number.isInteger(t))throw new Error("最大堆叠数量必须是正整数");return(new Map).set("minecraft:max_stack_size",t)}static setProjectile(t,e){const i={};if(void 0!==t){if("number"!=typeof t||t<0)throw new Error("minimumCriticalPower 必须是非负数");i.minimum_critical_power=t}if(void 0!==e){if("string"!=typeof e)throw new Error("projectileEntity 必须是字符串类型");i.projectile_entity=e}return(new Map).set("minecraft:projectile",i)}static setUseModifiers(t,e){const i={};if(void 0!==t){if("number"!=typeof t)throw new Error("movementModifier 必须是数字类型");i.movement_modifier=t}if(void 0!==e){if("number"!=typeof e||e<0)throw new Error("useDuration 必须是非负数");i.use_duration=e}return(new Map).set("minecraft:use_modifiers",i)}static setWearable(t=0,e){const i={protection:t};if(void 0!==e){if("string"!=typeof e)throw new Error("slot 必须是字符串类型");i.slot=e}return(new Map).set("minecraft:wearable",i)}static setUseAnimation(t){if("string"!=typeof t)throw new Error("animation 必须是字符串类型");return(new Map).set("minecraft:use_animation",t)}static combineComponents(...t){return new Map(t.flatMap((t=>[...t])))}static toJSON(t){return Object.fromEntries(t)}}class Q{constructor(t,e){this.format_version=t,this.definitions=e}toJson(){return{format_version:this.format_version,"minecraft:item":this.definitions}}}class X{constructor(t,e){this.description=t,this.components=e}}class Y{constructor(t,e){this.identifier=t,this.menu_category=e}}class tt{constructor(t,e,i,r={}){if(!t||"string"!=typeof t)throw new Error("identifier is required and must be a string");if(!e||"string"!=typeof e)throw new Error("category is required and must be a string");if(!i||"string"!=typeof i)throw new Error("texture is required and must be a string");const{group:s,hide_in_command:n=!1,max_stack_size:o=64}=r;this.identifier=t,this.category=e,this.texture=i,this.group=s,this.hide_in_command=n,this.components=new Map,this.addComponent(Z.combineComponents(Z.setIcon(this.texture),Z.setMaxStackSize(o)))}addComponent(t){if(!(t&&t instanceof Map))throw new Error("componentMap is required and must be a Map");for(const[e,i]of t.entries())this.components.set(e,i);return this}removeComponent(t){if(!t||"string"!=typeof t)throw new Error("key is required and must be a string");return this.components.delete(t),this}toJson(){return new Q("1.21.40",new X(new Y(this.identifier,new s(this.category,this.group,this.hide_in_command)),Object.fromEntries(this.components))).toJson()}}class et{constructor(t,e,i,r,s={}){this.identifier=t,s.group="minecraft:itemGroup.name.chestplate",this.item=new tt(t,e,i,s),this.attachable=new K(t),this.attachable.addTexture("default",r).addMaterial("default","armor").addMaterial("enchanted","armor_enchanted").addTexture("default",r).addTexture("enchanted","textures/misc/enchanted_actor_glint").addRenderController("controller.render.armor").addGeometry("default","geometry.player.armor.chestplate").setScript("parent_setup","v.chest_layer_visible = 0.0;")}setArrachableGeometry(t,e){return this.attachable.addGeometry(t,e),this}}class it extends et{constructor(t,e,i,r={}){super(t,"equipment",e,i,r),r.group="minecraft:itemGroup.name.chestplate",this.attachable.addGeometry("default","geometry.player.armor.chestplate").setScript("parent_setup","v.chest_layer_visible = 0.0;"),this.item.addComponent(Z.combineComponents(Z.setDisplayName("我的自定义胸甲"),Z.setMaxStackSize(1),Z.setWearable(5,"slot.armor.chest")))}}class rt extends et{constructor(t,e,i,r={}){super(t,"equipment",e,i,r),r.group="minecraft:itemGroup.name.boots",this.attachable.addGeometry("default","geometry.player.armor.boots").setScript("parent_setup","v.boot_layer_visible = 0.0;"),this.item.addComponent(Z.combineComponents(Z.setDisplayName("我的自定义靴子"),Z.setMaxStackSize(1),Z.setWearable(4,"slot.armor.feet")))}}class st extends et{constructor(t,e,i,r={}){super(t,"equipment",e,i,r),r.group="minecraft:itemGroup.name.leggings",this.attachable.addGeometry("default","geometry.player.armor.leggings").setScript("parent_setup","v.leg_layer_visible = 0.0;"),this.item.addComponent(Z.combineComponents(Z.setDisplayName("我的自定义裤子"),Z.setMaxStackSize(1),Z.setWearable(6,"slot.armor.legs")))}}class nt extends et{constructor(t,e,i,r={}){super(t,"equipment",e,i,r),r.group="minecraft:itemGroup.name.helmet",this.attachable.addGeometry("default","geometry.player.armor.helmet").setScript("parent_setup","v.helmet_layer_visible = 0.0;"),this.item.addComponent(Z.combineComponents(Z.setDisplayName("我的自定义头盔"),Z.setMaxStackSize(1),Z.setWearable(3,"slot.armor.head")))}}class ot extends tt{constructor(t,e,i,r={}){super(t,e,i,r);const{animation:s="eat",movement:n=1,useDuration:o=1,canAlwaysEat:a=!1,nutrition:c=0,saturationModifier:h=1}=r;if("number"!=typeof c||c<0)throw new Error("nutrition 必须是一个非负数");if("number"!=typeof h||h<=0)throw new Error("saturationModifier 必须是一个正数");if("string"!=typeof s)throw new Error("animation 必须是字符串类型");if("boolean"!=typeof a)throw new Error("canAlwaysEat 必须是布尔类型");this.addComponent(Z.combineComponents(Z.setUseModifiers(n,o),Z.setFoodComponent(a,c,h),Z.setUseAnimation(s)))}}const at=(t,e)=>{t&&Object.keys(t).length>0&&P.register(t.identifier.replace(":","_"),"behavior","items/",t),e&&Object.keys(e).length>0&&P.register(e.identifier.replace(":","_"),"resource","attachables/",e)},ct={createItem:function(t,e,i,r={}){if(!t||!e||!i)throw new Error("必须提供 identifier、category 和 texture。");const s=new tt(t,e,i,r);let n={};return!0===r.hide_in_command&&(n=new K(t).addMaterial("default","entity_alphatest").addMaterial("enchanted","entity_alphatest_glint").addTexture("default",`textures/items/${i}`).addTexture("enchanted","textures/misc/enchanted_item_glint").addGeometry("default","geometry.large_item")),at(s,n),s},createFood:function(t,e,i,r={}){if(!t||!e||!i)throw new Error("必须提供 identifier、category 和 texture。");const s=new ot(t,e,i,{animation:"eat",canAlwaysEat:!1,nutrition:0,saturationModifier:1,...r});return at(s,{}),s},createAttachable:function(t,e,i,r={}){if(!t||!e||!i)throw new Error("必须提供 identifier、texture 和 material。");const s=new K(t);return s.addTexture("default",e),s.addMaterial("default",i),at({},s),s},createChestplateArmor:function(t,e,i,r={}){const s=new it(t,e,i,r);return at(s.item,s.attachable),s},createHelmetArmor:function(t,e,i,r={}){const s=new nt(t,e,i,r);return at(s.item,s.attachable),s},createBootArmor:function(t,e,i,r={}){const s=new rt(t,e,i,r);return at(s.item,s.attachable),s},createLeggingsArmor:function(t,e,i,r={}){const s=new st(t,e,i,r);return at(s.item,s.attachable),s}},ht="furnace",ut="crafting_table",lt="minecraft:recipe_furnace",dt="minecraft:recipe_shaped",mt="minecraft:recipe_shapeless";class pt{constructor(t,e,i={}){this.format_version=t,this.recipe_type=e,this.definitions=i}getId(){return this.definitions.description.identifier}identifier(t){return this.definitions.description={identifier:t},this}tags(t){return this.definitions.tags=t,this}toJson(){var t={format_version:this.format_version};return t[this.recipe_type]=this.definitions,t}}class ft extends pt{constructor(t,e){super(t,lt,e)}static create(t,e){return new ft(t,e)}input(t,e,i){var r;return e||i?(r={item:t},e&&(r.data=e),i&&(r.count=i)):r=t,this.definitions.input=r,this}output(t){return this.definitions.output=t,this}}class _t extends ft{constructor(t={}){super("1.17",t)}}class wt extends pt{constructor(t,e){super(t,dt,e)}assumeSymmetry(){this.definitions.assume_symmetry=!0}key(t){return this.definitions.key=t,this}pattern(t){return this.definitions.pattern=t,this}priority(t){return this.definitions.priority=t,this}output(t){return this.definitions.result="string"==typeof t?{item:t}:t,this}static create(t,e){return new wt(t,e)}}class bt extends wt{constructor(t){super("1.20",dt,t)}}class gt extends pt{constructor(t,e){super(t,mt,e)}static create(t,e){return new gt(t,e)}priority(t){return this.definitions.priority=t,this}ingredients(t){return this.definitions.ingredients=t,this}output(t){return this.definitions.result="string"==typeof t?{item:t}:t,this}}class yt extends gt{constructor(t){super("1.17",t)}}const xt=new class{registerRecipe(t){P.register(t.getId().replace(":","_"),"behavior","recipes/",t)}registerSimpleFurnace(t,e,i){return this.registerFurnace(t).tags([ht]).input(i).output(e)}registerFurnace(t){const e=(new _t).identifier(t);return this.registerRecipe(e),e}registerSimpleShaped(t,e,i,r){return this.registerShaped(t).tags([ut]).pattern(i).key(r).output(e)}registerShaped(t){const e=(new bt).identifier(t);return this.registerRecipe(e),e}registerSimpleShapeless(t,e,i){return this.registerShapeless(t).tags([ut]).ingredients(i).output(e)}registerShapeless(t){const e=(new yt).identifier(t);return this.registerRecipe(e),e}};class Et{static item_texture_sets=new Map;static getItemTextureSet(){return this.item_texture_sets}static getItemTextures(){return Object.fromEntries(this.item_texture_sets)}static registerTextureData(t,e){this.item_texture_sets.set(t,e)}static registerTexture(t,e){this.registerTextureData(t,{textures:e})}}class vt{static terrain_texture_sets=new Map;static getTerrainTextureSet(){return this.terrain_texture_sets}static getTerrainTextures(){return Object.fromEntries(this.terrain_texture_sets)}static registerTextureData(t,e){this.terrain_texture_sets.set(t,e)}static registerTexture(t,e){this.registerTextureData(t,{textures:e})}}const Ct={flipbook_textures:[],registerFlipbookTexture(t,e,i,r={}){const s={atlas_tile:t,flipbook_texture:e,ticks_per_frame:i};Object.assign(s,r),this.flipbook_textures.push(s)}};class kt{constructor(){}setIgnored(t=!1){return this.ignored=t,this}setBindingType(t){return this.binding_type=t,this}setBindingName(t){return this.binding_name=t,this}setBindingNameOverride(t){return this.binding_name_override=t,this}setBindingCollectionName(t){return this.binding_collection_name=t,this}setBindingCollectionPrefix(t){return this.binding_collection_prefix=t,this}setBindingCondition(t){return this.binding_condition=t,this}setSourceControlName(t){return this.source_control_name=t,this}setSourcePropertyName(t){return this.source_property_name=t,this}setTargetPropertyName(t){return this.target_property_name=t,this}setResolveSiblingScope(t=!1){return this.resolve_sibling_scope=t,this}}class Mt{constructor(){}setGridDimensions(t){return this.grid_dimensions=t,this}setMaximumGridItems(t){return this.maximum_grid_items=t,this}setGridDimensionBinding(t){return this.grid_dimension_binding=t,this}setGridRescalingType(t="none"){return this.grid_rescaling_type=t,this}setGridFillDirection(t="none"){return this.grid_fill_direction=t,this}setGridItemTemplate(t){return this.grid_item_template=t,this}setPrecachedGridItemCount(t){return this.precached_grid_item_count=t,this}}class Pt{constructor(){}setVisible(t=!0){return this.visible=t,this}setEnabled(t=!0){return this.enabled=t,this}setLayer(t=0){return this.layer=t,this}setAlpha(t=1){return this.alpha=t,this}setPropagateAlpha(t=!1){return this.propagate_alpha=t,this}setClipsChildren(t=!1){return this.clips_children=t,this}setAllowClipping(t=!0){return this.allow_clipping=t,this}setClipOffset(t=[0,0]){return this.clip_offset=t,this}setClipStateChangeEvent(t){return this.clip_state_change_event=t,this}setEnableScissorTest(t=!1){return this.enable_scissor_test=t,this}setPropertyBag(t){return this.property_bag=t,this}setSelected(t=!1){return this.selected=t,this}setUseChildAnchors(t=!1){return this.use_child_anchors=t,this}addControl(t){return this.controls||(this.controls=[]),this.controls.push(t),this}setAnimations(t){return this.anims=t,this}setDisableAnimFastForward(t=!1){return this.disable_anim_fast_forward=t,this}setAnimationResetName(t){return this.animation_reset_name=t,this}setIgnored(t=!1){return this.ignored=t,this}setVariables(t){return this.variables=t,this}setModifications(t){return this.modifications=t,this}setGridPosition(t){return this.grid_position=t,this}setCollectionIndex(t){return this.collection_index=t,this}}class Bt{constructor(){}setBinding(t){return this.bindings||(this.bindings=[]),this.binding=t,this}addDataBinding(t){return this.bindings||(this.bindings=[]),this.bindings.push(t),this}}class Tt{constructor(){}setName(t){return this.factory||(this.factory={}),this.factory.name=t,this}setControlName(t){return this.factory||(this.factory={}),this.factory.control_name=t,this}setControlIds(t){return this.factory||(this.factory={}),this.factory.control_ids=t,this}addControlId(t,e){return this.factory||(this.factory={}),this.factory.control_ids[t]=e,this}}class St{constructor(){}setSize(t=["default","default"]){return this.size=t,this}setMaxSize(t=["default","default"]){return this.max_size=t,this}setMinSize(t=["default","default"]){return this.min_size=t,this}setOffset(t=[0,0]){return this.offset=t,this}setAnchorFrom(t="center"){return this.anchor_from=t,this}setAnchorTo(t="center"){return this.anchor_to=t,this}setInheritMaxSiblingWidth(t=!1){return this.inherit_max_sibling_width=t,this}setInheritMaxSiblingHeight(t=!1){return this.inherit_max_sibling_height=t,this}setUseAnchoredOffset(t=!1){return this.use_anchored_offset=t,this}setContained(t=!1){return this.contained=t,this}setDraggable(t){return this.draggable=t,this}setFollowsCursor(t=!1){return this.follows_cursor=t,this}}class At{constructor(t,e,i){this.type=e,this.id=i?`${t}@${i}`:t,this.name=t,this.control=new Pt,this.properties=(new Map).set("type",e),this.variables=new Map,this.modifications=[]}enableDebug(){return this.control.addControl({debug_board:{type:"image",texture:"textures/ui/focus_border_white",nineslice_size:1,size:["100%","100%"]}}),this}setControl(t){return this.control=t,this}addControl(t){return t instanceof At?this.control.addControl(t.serialize()):this.control.addControl(t),this}addControls(t){for(let e in t)this.addControl(t[e]);return this}addVariable(t,e){return this.variables.set(`$${t}`,e),this}addProp(t,e){return this.properties.set(t,e),this}addModification(t){return this.modifications.push({array_name:t.array_name,operation:t.operation,value:t.value}),this.addProp("modifications",this.modifications),this}serialize(){const t=Object.fromEntries(this.properties);return Object.assign(t,Object.fromEntries(this.variables)),{[this.id]:t}}}class Ot{static OPERATION=Object.freeze({INSERT_BACK:"insert_back",INSERT_FRONT:"insert_front",INSERT_AFTER:"insert_after",INSERT_BEFORE:"insert_before",MOVE_BACK:"move_back",MOVE_FRONT:"move_front",MOVE_AFTER:"move_after",MOVE_BEFORE:"move_before",SWAP:"swap",REPLACE:"replace",REMOVE:"remove"})}class Dt extends At{constructor(t,e){super(t,"collection_panel",e),this.control=new Pt,this.layout=new St,this.dataBinding=new Bt,this.factory=new Tt}setCollectionName(t){return this.addProp("collection_name",t),this}setLayout(t){return this.layout=t,this}serialize(){for(const t in this.layout)this.layout.hasOwnProperty(t)&&this.properties.set(t,this.layout[t]);for(const t in this.dataBinding)this.dataBinding.hasOwnProperty(t)&&this.properties.set(t,this.dataBinding[t]);for(const t in this.factory)this.factory.hasOwnProperty(t)&&this.properties.set(t,this.factory[t]);for(const t in this.control)this.control.hasOwnProperty(t)&&this.properties.set(t,this.control[t]);return super.serialize()}}class Nt extends At{constructor(t,e){super(t,"panel",e),this.control=new Pt,this.layout=new St,this.dataBinding=new Bt,this.factory=new Tt}setLayout(t){return this.layout=t,this}serialize(){for(const t in this.layout)this.layout.hasOwnProperty(t)&&this.properties.set(t,this.layout[t]);for(const t in this.dataBinding)this.dataBinding.hasOwnProperty(t)&&this.properties.set(t,this.dataBinding[t]);for(const t in this.factory)this.factory.hasOwnProperty(t)&&this.properties.set(t,this.factory[t]);for(const t in this.control)this.control.hasOwnProperty(t)&&this.properties.set(t,this.control[t]);return super.serialize()}}class Ft extends Dt{constructor(t,e){super(t,e),this.gridNum=0,this.grid=new Mt}setGridProp(t){return this.grid=t,this}addGridItem(t,e){const i=new Nt(`grid_item_${this.gridNum}`);return i.addProp("grid_position",t),i.addControl(e),this.addControl(i),this.gridNum++,this}serialize(){for(const t in this.grid)this.grid.hasOwnProperty(t)&&this.properties.set(t,this.grid[t]);return this.properties.set("type","grid"),super.serialize()}}class It{constructor(){}setTexture(t){return this.texture=t,this}setAllowDebugMissingTexture(t=!0){return this.allow_debug_missing_texture=t,this}setUV(t){return this.uv=t,this}setUVSize(t){return this.uv_size=t,this}setTextureFileSystem(t="InUserPackage"){return this.texture_file_system=t,this}setNineSliceSize(t){return this.nineslice_size=t,this}setTiled(t){return this.tiled=t,this}setTiledScale(t=[1,1]){return this.tiled_scale=t,this}setClipDirection(t){return this.clip_direction=t,this}setClipRatio(t){return this.clip_ratio=t,this}setClipPixelPerfect(t=!1){return this.clip_pixelperfect=t,this}setKeepRatio(t=!0){return this.keep_ratio=t,this}setBilinear(t=!1){return this.bilinear=t,this}setFill(t=!1){return this.fill=t,this}setFitToWidth(t=!1){return this.$fit_to_width=t,this}setZipFolder(t){return this.zip_folder=t,this}setGrayscale(t=!1){return this.grayscale=t,this}setForceTextureReload(t=!1){return this.force_texture_reload=t,this}setBaseSize(t){return this.base_size=t,this}}class zt extends At{constructor(t,e){super(t,"image",e),this.sprite=new It,this.control=new Pt,this.layout=new St,this.dataBinding=new Bt,this.factory=new Tt}setSprite(t){return this.sprite=t,this}serialize(){for(const t in this.sprite)this.sprite.hasOwnProperty(t)&&this.properties.set(t,this.sprite[t]);for(const t in this.layout)this.layout.hasOwnProperty(t)&&this.properties.set(t,this.layout[t]);for(const t in this.dataBinding)this.dataBinding.hasOwnProperty(t)&&this.properties.set(t,this.dataBinding[t]);for(const t in this.factory)this.factory.hasOwnProperty(t)&&this.properties.set(t,this.factory[t]);for(const t in this.control)this.control.hasOwnProperty(t)&&this.properties.set(t,this.control[t]);return super.serialize()}}class qt{constructor(){}setText(t=""){return this.text=t,this}setColor(t=[1,1,1]){return this.color=t,this}setLockedColor(t){return this.locked_color=t,this}setShadow(t=!1){return this.shadow=t,this}setHideHyphen(t=!1){return this.hide_hyphen=t,this}setNotifyOnEllipses(t){return this.notify_on_ellipses=t,this}addNotifyOnEllipses(t){return this.notify_on_ellipses.push(t),this}setEnableProfanityFilter(t=!1){return this.enable_profanity_filter=t,this}setLockedAlpha(t){return this.locked_alpha=t,this}setFontSize(t="normal"){return this.font_size=t,this}setFontScaleFactor(t=1){return this.font_scale_factor=t,this}setLocalize(t=!1){return this.localize=t,this}setLinePadding(t){return this.line_padding=t,this}setFontType(t="default"){return this.font_type=t,this}setBackupFontType(t="default"){return this.backup_font_type=t,this}setTextAlignment(t){return this.text_alignment=t,this}}class jt extends At{constructor(t,e){super(t,"label",e),this.text=new qt,this.control=new Pt,this.layout=new St,this.dataBinding=new Bt,this.factory=new Tt}setLayout(t){return this.layout=t,this}setText(t){return this.text=t,this}serialize(){for(const t in this.text)this.text.hasOwnProperty(t)&&this.properties.set(t,this.text[t]);for(const t in this.layout)this.layout.hasOwnProperty(t)&&this.properties.set(t,this.layout[t]);for(const t in this.dataBinding)this.dataBinding.hasOwnProperty(t)&&this.properties.set(t,this.dataBinding[t]);for(const t in this.factory)this.factory.hasOwnProperty(t)&&this.properties.set(t,this.factory[t]);for(const t in this.control)this.control.hasOwnProperty(t)&&this.properties.set(t,this.control[t]);return super.serialize()}}class Rt extends Nt{constructor(t,e){super(t,e),this.type="stack_panel",this.orientation="vertical",this.stackNum=0,this.setLayout((new St).setSize(["100%","100%"]))}addStack(t,e,i=!1){const r=new Nt(`stack${this.stackNum}`).setLayout((new St).setSize(t)).addControl(e);return i&&r.enableDebug(),this.addControl(r),this.stackNum++,this}setOrientation(t){return this.orientation=t,this}serialize(){return this.properties.set("type","stack_panel"),this.properties.set("orientation",this.orientation),super.serialize()}}class Lt{static#a=new Map;static#c=[];static registerUISystem(t){const e=t.path+t.name+".json";this.#a.set(e,t)}static getUISystemList(){return Array.from(this.#a.values())}static addOuterUIdefs(t){if(!Array.isArray(t))throw new Error("参数必须是一个数组");this.#c=this.#c.concat(t)}static getUIdefList(){return this.#c.concat(Array.from(this.#a.keys())).filter((t=>"ui/server_form"!==t))}}class Gt{constructor(t,e){this.identifier=t,this.namespace=t.split(":")[0],this.name=t.split(":")[1],this.path=e,this.elements=new Map,this.animations=new Map,Lt.registerUISystem(this)}addElement(t){return this.elements.set(t.id,t),this}getElement(t){return this.elements.get(t)}addAnimation(t,e){this.animations.set(t,e)}getAnimation(t){return this.animations.get(t)}toJson(){const t={namespace:this.namespace};return this.elements.forEach(((e,i)=>{t[i]=e.serialize()[e.id]})),t}}class Jt{constructor(){}setButtonMappings(t){return this.button_mappings=t,this}setModal(t=!1){return this.modal=t,this}setInlineModal(t=!1){return this.inline_modal=t,this}setAlwaysListenToInput(t=!1){return this.always_listen_to_input=t,this}setAlwaysHandlePointer(t=!1){return this.always_handle_pointer=t,this}setAlwaysHandleControllerDirection(t=!1){return this.always_handle_controller_direction=t,this}setHoverEnabled(t=!1){return this.hover_enabled=t,this}setPreventTouchInput(t=!1){return this.prevent_touch_input=t,this}setConsumeEvent(t=!1){return this.consume_event=t,this}setConsumeHoverEvents(t=!1){return this.consume_hover_events=t,this}setGestureTrackingButton(t){return this.gesture_tracking_button=t,this}}class $t{constructor(){}setSoundName(t){return this.sound_name=t,this}setSoundVolume(t=1){return this.sound_volume=t,this}setSoundPitch(t=1){return this.sound_pitch=t,this}setSounds(t){return this.sounds=t,this}addSound(t){return this.sounds.push(t),this}}const Vt=new Gt("server_form:server_form","ui/"),Ut=new class extends At{constructor(t,e){super(t,"button",e),this.input=new Jt,this.sound=new $t,this.control=new Pt,this.layout=new St,this.dataBinding=new Bt,this.factory=new Tt}setDefaultControl(t){return this.addProp("default_control",t),this}setHoverControl(t){return this.addProp("hover_control",t),this}setPressedControl(t){return this.addProp("pressed_control",t),this}setLockedControl(t){return this.addProp("locked_control",t),this}setInput(t){return this.input=t,this}setSound(t){return this.sound=t,this}setLayout(t){return this.layout=t,this}serialize(){for(const t in this.layout)this.layout.hasOwnProperty(t)&&this.properties.set(t,this.layout[t]);for(const t in this.input)this.input.hasOwnProperty(t)&&this.properties.set(t,this.input[t]);for(const t in this.sound)this.sound.hasOwnProperty(t)&&this.properties.set(t,this.sound[t]);for(const t in this.dataBinding)this.dataBinding.hasOwnProperty(t)&&this.properties.set(t,this.dataBinding[t]);for(const t in this.factory)this.factory.hasOwnProperty(t)&&this.properties.set(t,this.factory[t]);for(const t in this.control)this.control.hasOwnProperty(t)&&this.properties.set(t,this.control[t]);return super.serialize()}}("sapdon_form_button_template","common.button");Ut.addVariable("pressed_button_name","button.form_button_click"),Ut.addVariable("default_texture|default","textures/gui/newgui/buttons/borderless/light"),Ut.addVariable("hover_texture|default","textures/gui/newgui/buttons/borderless/lighthover"),Ut.addVariable("pressed_texture|default","textures/gui/newgui/buttons/borderless/lightpressed"),Ut.addVariable("binding_button_text|default",""),Ut.dataBinding.addDataBinding((new kt).setBindingType("collection_details").setBindingCollectionName("form_buttons")),Ut.dataBinding.addDataBinding((new kt).setBindingType("collection").setBindingCollectionName("form_buttons").setBindingName("#form_button_text")),Ut.dataBinding.addDataBinding((new kt).setBindingType("view").setSourcePropertyName("($binding_button_text = #form_button_text)").setTargetPropertyName("#visible")),Ut.addControls([new zt("default").setSprite((new It).setTexture("$default_texture")),new zt("hover").setSprite((new It).setTexture("$hover_texture")),new zt("pressed").setSprite((new It).setTexture("$pressed_texture"))]);const Ht=new Nt("sapdon_form_button_factory");Ht.addProp("type","collection_panel"),Ht.factory.setName("buttons").setControlName("sapdon_form_button_template"),Ht.addProp("collection_name","form_buttons"),Ht.dataBinding.addDataBinding((new kt).setBindingName("#form_button_length").setBindingNameOverride("#collection_length")),Vt.addElement(Ut),Vt.addElement(Ht);class Wt{static#h=new Map;static#u=[];static addBindingTitle(t){this.#u.push(t)}static getBindingTitleList(){return this.#u.concat(Array.from(this.#h.keys()))}static getBindingContentList(){return Array.from(this.#h.values())}static bindingTitlewithContent(t,e){this.#h.set(t,e),this.#l()}static#l(){const t=this.getBindingTitleList().map((t=>(console.log("title_name",t),`'${t}'`))).join("-"),e=new At("long_form").addModification({array_name:"bindings",operation:Ot.OPERATION.INSERT_BACK,value:[(new kt).setBindingName("#title_text"),(new kt).setBindingType("view").setSourcePropertyName(`((#title_text - ${t}) = #title_text)`).setTargetPropertyName("#visible")]}),i=new Nt("custom_server_form_factory");i.factory.setName("server_form_factory").setControlIds({long_form:"@server_form.custom_root_panel"});const r=new At("main_screen_content").addModification({array_name:"controls",operation:Ot.OPERATION.INSERT_BACK,value:[i.serialize()]}),s=new Nt("custom_ui_template");s.dataBinding.addDataBinding((new kt).setBindingName("#title_text")).addDataBinding((new kt).setBindingType("view").setSourcePropertyName("(#title_text = $binding_text)").setTargetPropertyName("#visible")),s.control.addControl(new At("main",void 0,"$main_content").serialize());const n=new Nt("custom_form_root");n.dataBinding.addDataBinding((new kt).setBindingType("view").setSourceControlName("custom_root_panel").setSourcePropertyName(`(not ((#title_text - ${t}) = #title_text))`).setTargetPropertyName("#visible")),this.#h.forEach(((t,e)=>{n.control.addControl(new At("custom_ui_"+e,void 0,"custom_ui_template").addVariable("main_content",t).addVariable("binding_text",e).serialize())}));const o=new Nt("custom_root_panel");o.dataBinding.addDataBinding((new kt).setBindingName("#title_text")),o.control.addControl(n.serialize()),Vt.addElement(s).addElement(e).addElement(o).addElement(r)}}var Kt;!function(t){t.Commands="commands",t.Construction="construction",t.Equipment="equipment",t.Nature="nature",t.Items="items",t.None="none"}(Kt||(Kt={}));export{T as BlockAPI,r as BlockComponent,kt as DataBindingObject,$ as EntityAPI,V as FeatureAPI,Ct as FlipbookTextures,P as GRegistry,Ft as Grid,zt as Image,ct as ItemAPI,Kt as ItemCategory,Z as ItemComponent,Et as ItemTextureManager,jt as Label,Nt as Panel,xt as RecipeAPI,Vt as ServerFormSystem,Wt as ServerUISystem,Rt as StackPanel,At as UIElement,Gt as UISystem,Lt as UISystemRegistry,vt as terrainTextureManager};
|
package/dist/core/item/item.d.ts
CHANGED
package/dist/core/texture.d.ts
CHANGED
|
@@ -13,6 +13,6 @@ export class terrainTextureManager {
|
|
|
13
13
|
static registerTexture(texture_name: any, texture_path: any): void;
|
|
14
14
|
}
|
|
15
15
|
export namespace FlipbookTextures {
|
|
16
|
-
let flipbook_textures:
|
|
16
|
+
let flipbook_textures: never[];
|
|
17
17
|
function registerFlipbookTexture(atlas_tile: any, texture: any, ticks_per_frame: any, options?: {}): void;
|
|
18
18
|
}
|
|
@@ -20,9 +20,9 @@ export class ButtonMapping {
|
|
|
20
20
|
ignored: boolean;
|
|
21
21
|
from_button_id: string;
|
|
22
22
|
to_button_id: string;
|
|
23
|
-
mapping_type: string;
|
|
24
|
-
scope: string;
|
|
25
|
-
input_mode_condition: string;
|
|
23
|
+
mapping_type: string | null;
|
|
24
|
+
scope: string | null;
|
|
25
|
+
input_mode_condition: string | null;
|
|
26
26
|
ignore_input_scope: boolean;
|
|
27
27
|
consume_event: boolean;
|
|
28
28
|
handle_select: boolean;
|
|
@@ -23,75 +23,75 @@ export class DataBindingObject {
|
|
|
23
23
|
* @returns {DataBindingObject} 返回当前实例以支持链式调用
|
|
24
24
|
*/
|
|
25
25
|
setIgnored(ignored?: boolean): DataBindingObject;
|
|
26
|
-
ignored: boolean;
|
|
26
|
+
ignored: boolean | undefined;
|
|
27
27
|
/**
|
|
28
28
|
* 设置绑定类型。
|
|
29
29
|
* @param {string} type - 绑定类型(可能值:global, view, collection, collection_details, none)
|
|
30
30
|
* @returns {DataBindingObject} 返回当前实例以支持链式调用
|
|
31
31
|
*/
|
|
32
32
|
setBindingType(type: string): DataBindingObject;
|
|
33
|
-
binding_type: string;
|
|
33
|
+
binding_type: string | undefined;
|
|
34
34
|
/**
|
|
35
35
|
* 设置数据绑定名称或条件的值。
|
|
36
36
|
* @param {string} name - 数据绑定名称或条件的值
|
|
37
37
|
* @returns {DataBindingObject} 返回当前实例以支持链式调用
|
|
38
38
|
*/
|
|
39
39
|
setBindingName(name: string): DataBindingObject;
|
|
40
|
-
binding_name: string;
|
|
40
|
+
binding_name: string | undefined;
|
|
41
41
|
/**
|
|
42
42
|
* 设置应用 binding_name 值的 UI 元素属性名称。
|
|
43
43
|
* @param {string} nameOverride - 应用 binding_name 值的 UI 元素属性名称
|
|
44
44
|
* @returns {DataBindingObject} 返回当前实例以支持链式调用
|
|
45
45
|
*/
|
|
46
46
|
setBindingNameOverride(nameOverride: string): DataBindingObject;
|
|
47
|
-
binding_name_override: string;
|
|
47
|
+
binding_name_override: string | undefined;
|
|
48
48
|
/**
|
|
49
49
|
* 设置要使用的集合名称。
|
|
50
50
|
* @param {string} collectionName - 集合名称
|
|
51
51
|
* @returns {DataBindingObject} 返回当前实例以支持链式调用
|
|
52
52
|
*/
|
|
53
53
|
setBindingCollectionName(collectionName: string): DataBindingObject;
|
|
54
|
-
binding_collection_name: string;
|
|
54
|
+
binding_collection_name: string | undefined;
|
|
55
55
|
/**
|
|
56
56
|
* 设置集合前缀。
|
|
57
57
|
* @param {string} prefix - 集合前缀
|
|
58
58
|
* @returns {DataBindingObject} 返回当前实例以支持链式调用
|
|
59
59
|
*/
|
|
60
60
|
setBindingCollectionPrefix(prefix: string): DataBindingObject;
|
|
61
|
-
binding_collection_prefix: string;
|
|
61
|
+
binding_collection_prefix: string | undefined;
|
|
62
62
|
/**
|
|
63
63
|
* 设置数据绑定的条件。
|
|
64
64
|
* @param {string} condition - 数据绑定的条件(可能值:always, always_when_visible, visible, once, none, visibility_changed)
|
|
65
65
|
* @returns {DataBindingObject} 返回当前实例以支持链式调用
|
|
66
66
|
*/
|
|
67
67
|
setBindingCondition(condition: string): DataBindingObject;
|
|
68
|
-
binding_condition: string;
|
|
68
|
+
binding_condition: string | undefined;
|
|
69
69
|
/**
|
|
70
70
|
* 设置要观察其属性值的 UI 元素名称。
|
|
71
71
|
* @param {string} controlName - UI 元素名称
|
|
72
72
|
* @returns {DataBindingObject} 返回当前实例以支持链式调用
|
|
73
73
|
*/
|
|
74
74
|
setSourceControlName(controlName: string): DataBindingObject;
|
|
75
|
-
source_control_name: string;
|
|
75
|
+
source_control_name: string | undefined;
|
|
76
76
|
/**
|
|
77
77
|
* 设置存储 source_control_name 引用的 UI 元素的属性值。
|
|
78
78
|
* @param {string} propertyName - 属性名称
|
|
79
79
|
* @returns {DataBindingObject} 返回当前实例以支持链式调用
|
|
80
80
|
*/
|
|
81
81
|
setSourcePropertyName(propertyName: string): DataBindingObject;
|
|
82
|
-
source_property_name: string;
|
|
82
|
+
source_property_name: string | undefined;
|
|
83
83
|
/**
|
|
84
84
|
* 设置应用 source_property_name 值的 UI 元素属性。
|
|
85
85
|
* @param {string} propertyName - 属性名称
|
|
86
86
|
* @returns {DataBindingObject} 返回当前实例以支持链式调用
|
|
87
87
|
*/
|
|
88
88
|
setTargetPropertyName(propertyName: string): DataBindingObject;
|
|
89
|
-
target_property_name: string;
|
|
89
|
+
target_property_name: string | undefined;
|
|
90
90
|
/**
|
|
91
91
|
* 设置是否允许选择同级元素而非子元素。
|
|
92
92
|
* @param {boolean} resolve - 是否允许选择同级元素(默认值:false)
|
|
93
93
|
* @returns {DataBindingObject} 返回当前实例以支持链式调用
|
|
94
94
|
*/
|
|
95
95
|
setResolveSiblingScope(resolve?: boolean): DataBindingObject;
|
|
96
|
-
resolve_sibling_scope: boolean;
|
|
96
|
+
resolve_sibling_scope: boolean | undefined;
|
|
97
97
|
}
|
|
@@ -63,152 +63,152 @@ export class Control {
|
|
|
63
63
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
64
64
|
*/
|
|
65
65
|
setVisible(visible?: boolean): Control;
|
|
66
|
-
visible: boolean;
|
|
66
|
+
visible: boolean | undefined;
|
|
67
67
|
/**
|
|
68
68
|
* 设置控件的启用状态。
|
|
69
69
|
* @param {boolean} enabled - 控件是否启用(默认值:true)
|
|
70
70
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
71
71
|
*/
|
|
72
72
|
setEnabled(enabled?: boolean): Control;
|
|
73
|
-
enabled: boolean;
|
|
73
|
+
enabled: boolean | undefined;
|
|
74
74
|
/**
|
|
75
75
|
* 设置控件的层级(z-index)。
|
|
76
76
|
* @param {number} layer - 要设置的层级(默认值:0)
|
|
77
77
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
78
78
|
*/
|
|
79
79
|
setLayer(layer?: number): Control;
|
|
80
|
-
layer: number;
|
|
80
|
+
layer: number | undefined;
|
|
81
81
|
/**
|
|
82
82
|
* 设置控件的透明度。
|
|
83
83
|
* @param {number} alpha - 要设置的透明度值(默认值:1.0)
|
|
84
84
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
85
85
|
*/
|
|
86
86
|
setAlpha(alpha?: number): Control;
|
|
87
|
-
alpha: number;
|
|
87
|
+
alpha: number | undefined;
|
|
88
88
|
/**
|
|
89
89
|
* 设置透明度是否应传播到子元素。
|
|
90
90
|
* @param {boolean} propagate - 透明度是否应传播(默认值:false)
|
|
91
91
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
92
92
|
*/
|
|
93
93
|
setPropagateAlpha(propagate?: boolean): Control;
|
|
94
|
-
propagate_alpha: boolean;
|
|
94
|
+
propagate_alpha: boolean | undefined;
|
|
95
95
|
/**
|
|
96
96
|
* 设置控件是否应裁剪其子元素。
|
|
97
97
|
* @param {boolean} clips - 控件是否应裁剪其子元素(默认值:false)
|
|
98
98
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
99
99
|
*/
|
|
100
100
|
setClipsChildren(clips?: boolean): Control;
|
|
101
|
-
clips_children: boolean;
|
|
101
|
+
clips_children: boolean | undefined;
|
|
102
102
|
/**
|
|
103
103
|
* 设置控件是否允许裁剪。
|
|
104
104
|
* @param {boolean} allow - 是否允许裁剪(默认值:true)
|
|
105
105
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
106
106
|
*/
|
|
107
107
|
setAllowClipping(allow?: boolean): Control;
|
|
108
|
-
allow_clipping: boolean;
|
|
108
|
+
allow_clipping: boolean | undefined;
|
|
109
109
|
/**
|
|
110
110
|
* 设置控件的裁剪偏移量。
|
|
111
111
|
* @param {number[]} offset - 裁剪偏移量,格式为 [x, y](默认值:[0, 0])
|
|
112
112
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
113
113
|
*/
|
|
114
114
|
setClipOffset(offset?: number[]): Control;
|
|
115
|
-
clip_offset: number[];
|
|
115
|
+
clip_offset: number[] | undefined;
|
|
116
116
|
/**
|
|
117
117
|
* 设置裁剪状态更改事件。
|
|
118
118
|
* @param {string} event - 裁剪状态更改时触发的事件名称
|
|
119
119
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
120
120
|
*/
|
|
121
121
|
setClipStateChangeEvent(event: string): Control;
|
|
122
|
-
clip_state_change_event: string;
|
|
122
|
+
clip_state_change_event: string | undefined;
|
|
123
123
|
/**
|
|
124
124
|
* 设置是否启用裁剪测试。
|
|
125
125
|
* @param {boolean} enable - 是否启用裁剪测试(默认值:false)
|
|
126
126
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
127
127
|
*/
|
|
128
128
|
setEnableScissorTest(enable?: boolean): Control;
|
|
129
|
-
enable_scissor_test: boolean;
|
|
129
|
+
enable_scissor_test: boolean | undefined;
|
|
130
130
|
/**
|
|
131
131
|
* 设置控件的属性包。
|
|
132
132
|
* @param {object} bag - 要设置的属性包
|
|
133
133
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
134
134
|
*/
|
|
135
135
|
setPropertyBag(bag: object): Control;
|
|
136
|
-
property_bag:
|
|
136
|
+
property_bag: object | undefined;
|
|
137
137
|
/**
|
|
138
138
|
* 设置控件是否被选中。
|
|
139
139
|
* @param {boolean} selected - 控件是否被选中(默认值:false)
|
|
140
140
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
141
141
|
*/
|
|
142
142
|
setSelected(selected?: boolean): Control;
|
|
143
|
-
selected: boolean;
|
|
143
|
+
selected: boolean | undefined;
|
|
144
144
|
/**
|
|
145
145
|
* 设置控件是否使用子元素的锚点。
|
|
146
146
|
* @param {boolean} use - 是否使用子元素的锚点(默认值:false)
|
|
147
147
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
148
148
|
*/
|
|
149
149
|
setUseChildAnchors(use?: boolean): Control;
|
|
150
|
-
use_child_anchors: boolean;
|
|
150
|
+
use_child_anchors: boolean | undefined;
|
|
151
151
|
/**
|
|
152
152
|
* 向控件添加子控件。
|
|
153
153
|
* @param {Control} control - 要添加的子控件
|
|
154
154
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
155
155
|
*/
|
|
156
156
|
addControl(control: Control): Control;
|
|
157
|
-
controls: any[];
|
|
157
|
+
controls: any[] | undefined;
|
|
158
158
|
/**
|
|
159
159
|
* 设置控件的动画。
|
|
160
160
|
* @param {string[]} anims - 动画名称数组
|
|
161
161
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
162
162
|
*/
|
|
163
163
|
setAnimations(anims: string[]): Control;
|
|
164
|
-
anims: string[];
|
|
164
|
+
anims: string[] | undefined;
|
|
165
165
|
/**
|
|
166
166
|
* 设置是否禁用动画快进。
|
|
167
167
|
* @param {boolean} disable - 是否禁用动画快进(默认值:false)
|
|
168
168
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
169
169
|
*/
|
|
170
170
|
setDisableAnimFastForward(disable?: boolean): Control;
|
|
171
|
-
disable_anim_fast_forward: boolean;
|
|
171
|
+
disable_anim_fast_forward: boolean | undefined;
|
|
172
172
|
/**
|
|
173
173
|
* 设置动画重置名称。
|
|
174
174
|
* @param {string} name - 要重置的动画名称
|
|
175
175
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
176
176
|
*/
|
|
177
177
|
setAnimationResetName(name: string): Control;
|
|
178
|
-
animation_reset_name: string;
|
|
178
|
+
animation_reset_name: string | undefined;
|
|
179
179
|
/**
|
|
180
180
|
* 设置是否忽略该控件。
|
|
181
181
|
* @param {boolean} ignored - 是否忽略该控件(默认值:false)
|
|
182
182
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
183
183
|
*/
|
|
184
184
|
setIgnored(ignored?: boolean): Control;
|
|
185
|
-
ignored: boolean;
|
|
185
|
+
ignored: boolean | undefined;
|
|
186
186
|
/**
|
|
187
187
|
* 设置控件的变量。
|
|
188
188
|
* @param {object} variables - 要设置的变量
|
|
189
189
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
190
190
|
*/
|
|
191
191
|
setVariables(variables: object): Control;
|
|
192
|
-
variables:
|
|
192
|
+
variables: object | undefined;
|
|
193
193
|
/**
|
|
194
194
|
* 设置控件的修改项。
|
|
195
195
|
* @param {array} modifications - 要设置的修改项
|
|
196
196
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
197
197
|
*/
|
|
198
|
-
setModifications(modifications:
|
|
199
|
-
modifications: any
|
|
198
|
+
setModifications(modifications: array): Control;
|
|
199
|
+
modifications: any;
|
|
200
200
|
/**
|
|
201
201
|
* 设置控件在网格中的位置。
|
|
202
202
|
* @param {number[]} position - 网格位置,格式为 [行, 列]
|
|
203
203
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
204
204
|
*/
|
|
205
205
|
setGridPosition(position: number[]): Control;
|
|
206
|
-
grid_position: number[];
|
|
206
|
+
grid_position: number[] | undefined;
|
|
207
207
|
/**
|
|
208
208
|
* 设置控件在集合中的索引。
|
|
209
209
|
* @param {number} index - 要设置的索引
|
|
210
210
|
* @returns {Control} 返回当前实例以支持链式调用
|
|
211
211
|
*/
|
|
212
212
|
setCollectionIndex(index: number): Control;
|
|
213
|
-
collection_index: number;
|
|
213
|
+
collection_index: number | undefined;
|
|
214
214
|
}
|
|
@@ -19,47 +19,47 @@ export class GridProp {
|
|
|
19
19
|
* @returns {GridProp} 返回当前实例以支持链式调用
|
|
20
20
|
*/
|
|
21
21
|
setGridDimensions(dimensions: number[]): GridProp;
|
|
22
|
-
grid_dimensions: number[];
|
|
22
|
+
grid_dimensions: number[] | undefined;
|
|
23
23
|
/**
|
|
24
24
|
* 设置网格生成的最大项目数。
|
|
25
25
|
* @param {number} maxItems - 最大项目数
|
|
26
26
|
* @returns {GridProp} 返回当前实例以支持链式调用
|
|
27
27
|
*/
|
|
28
28
|
setMaximumGridItems(maxItems: number): GridProp;
|
|
29
|
-
maximum_grid_items: number;
|
|
29
|
+
maximum_grid_items: number | undefined;
|
|
30
30
|
/**
|
|
31
31
|
* 设置网格尺寸的绑定名称。
|
|
32
32
|
* @param {string} binding - 绑定名称
|
|
33
33
|
* @returns {GridProp} 返回当前实例以支持链式调用
|
|
34
34
|
*/
|
|
35
35
|
setGridDimensionBinding(binding: string): GridProp;
|
|
36
|
-
grid_dimension_binding: string;
|
|
36
|
+
grid_dimension_binding: string | undefined;
|
|
37
37
|
/**
|
|
38
38
|
* 设置网格重新缩放方向。
|
|
39
39
|
* @param {string} type - 可能值:vertical, horizontal, none(默认值:none)
|
|
40
40
|
* @returns {GridProp} 返回当前实例以支持链式调用
|
|
41
41
|
*/
|
|
42
42
|
setGridRescalingType(type?: string): GridProp;
|
|
43
|
-
grid_rescaling_type: string;
|
|
43
|
+
grid_rescaling_type: string | undefined;
|
|
44
44
|
/**
|
|
45
45
|
* 设置网格填充方向。
|
|
46
46
|
* @param {string} direction - 可能值:vertical, horizontal, none(默认值:none)
|
|
47
47
|
* @returns {GridProp} 返回当前实例以支持链式调用
|
|
48
48
|
*/
|
|
49
49
|
setGridFillDirection(direction?: string): GridProp;
|
|
50
|
-
grid_fill_direction: string;
|
|
50
|
+
grid_fill_direction: string | undefined;
|
|
51
51
|
/**
|
|
52
52
|
* 设置处理集合的子元素名称。
|
|
53
53
|
* @param {string} template - 元素名称(例如:"common.container_item")
|
|
54
54
|
* @returns {GridProp} 返回当前实例以支持链式调用
|
|
55
55
|
*/
|
|
56
56
|
setGridItemTemplate(template: string): GridProp;
|
|
57
|
-
grid_item_template: string;
|
|
57
|
+
grid_item_template: string | undefined;
|
|
58
58
|
/**
|
|
59
59
|
* 设置预缓存的网格项目数量。
|
|
60
60
|
* @param {number} count - 预缓存数量
|
|
61
61
|
* @returns {GridProp} 返回当前实例以支持链式调用
|
|
62
62
|
*/
|
|
63
63
|
setPrecachedGridItemCount(count: number): GridProp;
|
|
64
|
-
precached_grid_item_count: number;
|
|
64
|
+
precached_grid_item_count: number | undefined;
|
|
65
65
|
}
|
|
@@ -23,75 +23,75 @@ export class Input {
|
|
|
23
23
|
* @returns {Input} 返回当前实例以支持链式调用
|
|
24
24
|
*/
|
|
25
25
|
setButtonMappings(mappings: ButtonMapping[]): Input;
|
|
26
|
-
button_mappings: ButtonMapping[];
|
|
26
|
+
button_mappings: ButtonMapping[] | undefined;
|
|
27
27
|
/**
|
|
28
28
|
* 设置是否为模态输入。
|
|
29
29
|
* @param {boolean} modal - 是否为模态输入
|
|
30
30
|
* @returns {Input} 返回当前实例以支持链式调用
|
|
31
31
|
*/
|
|
32
32
|
setModal(modal?: boolean): Input;
|
|
33
|
-
modal: boolean;
|
|
33
|
+
modal: boolean | undefined;
|
|
34
34
|
/**
|
|
35
35
|
* 设置是否为内联模态输入。
|
|
36
36
|
* @param {boolean} inlineModal - 是否为内联模态输入
|
|
37
37
|
* @returns {Input} 返回当前实例以支持链式调用
|
|
38
38
|
*/
|
|
39
39
|
setInlineModal(inlineModal?: boolean): Input;
|
|
40
|
-
inline_modal: boolean;
|
|
40
|
+
inline_modal: boolean | undefined;
|
|
41
41
|
/**
|
|
42
42
|
* 设置是否始终监听输入。
|
|
43
43
|
* @param {boolean} alwaysListen - 是否始终监听输入
|
|
44
44
|
* @returns {Input} 返回当前实例以支持链式调用
|
|
45
45
|
*/
|
|
46
46
|
setAlwaysListenToInput(alwaysListen?: boolean): Input;
|
|
47
|
-
always_listen_to_input: boolean;
|
|
47
|
+
always_listen_to_input: boolean | undefined;
|
|
48
48
|
/**
|
|
49
49
|
* 设置是否始终处理指针事件。
|
|
50
50
|
* @param {boolean} alwaysHandle - 是否始终处理指针事件
|
|
51
51
|
* @returns {Input} 返回当前实例以支持链式调用
|
|
52
52
|
*/
|
|
53
53
|
setAlwaysHandlePointer(alwaysHandle?: boolean): Input;
|
|
54
|
-
always_handle_pointer: boolean;
|
|
54
|
+
always_handle_pointer: boolean | undefined;
|
|
55
55
|
/**
|
|
56
56
|
* 设置是否始终处理控制器方向事件。
|
|
57
57
|
* @param {boolean} alwaysHandle - 是否始终处理控制器方向事件
|
|
58
58
|
* @returns {Input} 返回当前实例以支持链式调用
|
|
59
59
|
*/
|
|
60
60
|
setAlwaysHandleControllerDirection(alwaysHandle?: boolean): Input;
|
|
61
|
-
always_handle_controller_direction: boolean;
|
|
61
|
+
always_handle_controller_direction: boolean | undefined;
|
|
62
62
|
/**
|
|
63
63
|
* 设置是否启用悬停事件。
|
|
64
64
|
* @param {boolean} enabled - 是否启用悬停事件
|
|
65
65
|
* @returns {Input} 返回当前实例以支持链式调用
|
|
66
66
|
*/
|
|
67
67
|
setHoverEnabled(enabled?: boolean): Input;
|
|
68
|
-
hover_enabled: boolean;
|
|
68
|
+
hover_enabled: boolean | undefined;
|
|
69
69
|
/**
|
|
70
70
|
* 设置是否阻止触摸输入。
|
|
71
71
|
* @param {boolean} prevent - 是否阻止触摸输入
|
|
72
72
|
* @returns {Input} 返回当前实例以支持链式调用
|
|
73
73
|
*/
|
|
74
74
|
setPreventTouchInput(prevent?: boolean): Input;
|
|
75
|
-
prevent_touch_input: boolean;
|
|
75
|
+
prevent_touch_input: boolean | undefined;
|
|
76
76
|
/**
|
|
77
77
|
* 设置是否消耗事件。
|
|
78
78
|
* @param {boolean} consume - 是否消耗事件
|
|
79
79
|
* @returns {Input} 返回当前实例以支持链式调用
|
|
80
80
|
*/
|
|
81
81
|
setConsumeEvent(consume?: boolean): Input;
|
|
82
|
-
consume_event: boolean;
|
|
82
|
+
consume_event: boolean | undefined;
|
|
83
83
|
/**
|
|
84
84
|
* 设置是否消耗悬停事件。
|
|
85
85
|
* @param {boolean} consume - 是否消耗悬停事件
|
|
86
86
|
* @returns {Input} 返回当前实例以支持链式调用
|
|
87
87
|
*/
|
|
88
88
|
setConsumeHoverEvents(consume?: boolean): Input;
|
|
89
|
-
consume_hover_events: boolean;
|
|
89
|
+
consume_hover_events: boolean | undefined;
|
|
90
90
|
/**
|
|
91
91
|
* 设置手势跟踪按钮。
|
|
92
92
|
* @param {string} button - 手势跟踪按钮
|
|
93
93
|
* @returns {Input} 返回当前实例以支持链式调用
|
|
94
94
|
*/
|
|
95
95
|
setGestureTrackingButton(button: string): Input;
|
|
96
|
-
gesture_tracking_button: string;
|
|
96
|
+
gesture_tracking_button: string | undefined;
|
|
97
97
|
}
|