### PackMetaData Full Example (JSON) Source: https://github.com/whisent/kubeloader/wiki/内容包 An extensive JSON example of PackMetaData, showcasing all available fields and demonstrating various dependency configurations. This includes required, optional, and incompatible dependencies with specific version ranges and ordering. ```json { "id": "fullpack", "name": "Full Feature Pack", "description": "A pack demonstrating all metadata features", "version": "2.3.0-beta", "authors": [ "Developer Team", "Contributor" ], "dependencies": [ { "type": "REQUIRED", "id": "example_core', "versionRange": "[2.0,3.0)", "ordering": "AFTER" }, { "type": "OPTIONAL", "id": "example_optional", "versionRange": "[1.1,2.0)", "reason": "Enhanced features" }, { "type": "INCOMPATIBLE", "id": "examplemod", "source": "MOD" } ] } ``` -------------------------------- ### Quick Generation with PackGen and ModGen Source: https://github.com/whisent/kubeloader/wiki/生成器 Shows the quick generation methods provided by PackGen and ModGen for rapidly creating ContentPacks and ContentPack Mods, useful for testing scenarios where metadata and dependency setup can be skipped. ```javascript PackGen.fastGenerateContentPack("packId",["Dev"]) ``` ```javascript ModGen.fastGenerateMod("packid") ``` -------------------------------- ### Create ContentPack Mod Info with ModGen Source: https://github.com/whisent/kubeloader/wiki/生成器 Explains how to create the `mods.toml` information for a ContentPack Mod using ModGen's `createModInfo` method. It includes examples of basic creation and detailed configuration using chained methods, including referencing metadata and adding mod dependencies. ```javascript ModGen.createModInfo("examplemod").build() ``` ```javascript let packModInfo = ModGen .createModInfo("examplemod") .fromMetaData() .withName("ExampleMod") .withForgeVersion("[47,)") .withMcVersion("1.20.1") .withDescription("这是一个测试Mod") .withAuthors(["WhiseNT"]) .withModDependencies([modDependency]) .build() ``` -------------------------------- ### Generate ContentPack using Command Line Source: https://github.com/whisent/kubeloader/wiki/生成器 Shows the command-line instruction to generate a ContentPack using the PackGen generator. It specifies the command format and the output directory. ```bash /kl pack ``` -------------------------------- ### Create ContentPack Metadata with PackGen Source: https://github.com/whisent/kubeloader/wiki/生成器 Demonstrates how to create metadata for a ContentPack using PackGen's `createMetaData` method. It shows both a basic creation and a more detailed version using chained methods for specifying authors, name, version, and description. ```javascript let metaData = PackGen.createMetaData("generater").build() ``` ```javascript let metaData = PackGen.createMetaData("generater") .withAuthors(["WhiseNT"]) .withName("测试名称") .withVersion("1.0.0") .withDescription("这是一个测试MetaData") .build() ``` -------------------------------- ### Generate ContentPack Mod using Command Line Source: https://github.com/whisent/kubeloader/wiki/生成器 Provides the command-line instruction for generating a ContentPack Mod using the ModGen generator, including the target output directory. ```bash /kl mod ``` -------------------------------- ### BlockEntityEvents.loaded Source: https://github.com/whisent/kubeloader/wiki/事件集成 当方块实体被区块加载时触发。仅在 server_scripts 中有效,事件不可取消。 ```javascript BlockEntityEvents.loaded('chest',event=>{ const pos = event.pos const level = event.level const block = event.block const blockEntity = event.blockEntity }) ``` -------------------------------- ### ContentPack Folder Structure Source: https://github.com/whisent/kubeloader/wiki/内容包 Defines the standard directory layout for a KubeLoader ContentPack when organized as a folder. It includes directories for server scripts, client scripts, startup scripts, assets, data, and the essential contentpacks.json metadata file. ```plaintext [自定义名称]/ ├── server_scripts/ # 服务端脚本 ├── client_scripts/ # 客户端脚本 ├── startup_scripts/ # 启动脚本 ├── assets/ # 资源文件 ├── data/ # 数据文件 └── contentpacks.json # PackMetaData文件(必需) ``` -------------------------------- ### ItemEntityEvents.spawned Source: https://github.com/whisent/kubeloader/wiki/事件集成 当物品实体生成时触发。仅在 server_scripts 中有效,事件可以取消。 ```javascript ItemEntityEvents.spawned('chest',event=>{ const itemEntity = event.itemEntity const level = event.level const pos = event.pos event.cancel() }) ``` -------------------------------- ### Create ContentPack Dependency with PackGen Source: https://github.com/whisent/kubeloader/wiki/生成器 Illustrates the creation of dependency data for a ContentPack using PackGen's `createDependency` method. This includes specifying the dependency type, source, and version range. ```javascript let dependency = PackGen.createDependency('required', "kubejs") .withSource('mod') .withVersionRange("*") .build() ``` -------------------------------- ### KubeLoaderEvents.tridentReleased Source: https://github.com/whisent/kubeloader/wiki/事件集成 处理三叉戟使用事件。仅在 server_scripts 中有效,事件可以取消。 ```javascript KubeLoaderEvents.tridentReleased(event=>{ let item = event.item let entity = event.entity let level = event.level let duration = event.duration let riptideLevel = event.riptideLevel event.cancel() }) ``` -------------------------------- ### Create Mod Dependency with ModGen Source: https://github.com/whisent/kubeloader/wiki/生成器 Demonstrates creating a dependency for a ContentPack Mod using ModGen's `createModDependency` method. It covers basic creation and advanced usage with chaining methods for mandatory status, ordering, side, and version range. ```javascript ModGen.createModDependency("kubeloader").build() ``` ```javascript let modDependency = ModGen .createModDependency("kubeloader") .withMandatory(true) .withOrdering("AFTER") .withSide("BOTH") .withVersionRange("[0.0.6,)") .build() ``` -------------------------------- ### ItemEntityEvents.hurt Source: https://github.com/whisent/kubeloader/wiki/事件集成 当物品实体受到伤害时触发(例如被丢进岩浆或火焰)。仅在 server_scripts 中有效,事件可以取消并设置伤害值。 ```javascript ItemEntityEvents.hurt('chest',event=>{ const itemEntity = event.itemEntity const level = event.level const source = event.damageSource const pos = event.pos event.amount = 0 event.cancel() }) ``` -------------------------------- ### BlockEntityEvents.unloaded Source: https://github.com/whisent/kubeloader/wiki/事件集成 当方块实体被区块加载时触发。仅在 server_scripts 中有效,事件不可取消。 ```javascript BlockEntityEvents.unloaded('chest',event=>{ const pos = event.pos const level = event.level const block = event.block const blockEntity = event.blockEntity }) ``` -------------------------------- ### KubeLoaderEvents.itemHurt Source: https://github.com/whisent/kubeloader/wiki/事件集成 处理物品耐久消耗事件。仅在 server_scripts 中有效,事件可以取消。 ```javascript KubeLoaderEvents.itemHurt("diamond_sword",event=>{ const item = event.item const entity = event.entity const damage = event.damage event.cancel() }) ``` -------------------------------- ### BlockEntityEvents.added Source: https://github.com/whisent/kubeloader/wiki/事件集成 当方块实体被添加到世界时触发。通常在放置带有方块实体的方块时触发。事件不可取消。 ```javascript BlockEntityEvents.added('chest',event=>{ const pos = event.pos const level = event.level const block = event.block const blockEntity = event.blockEntity }) ``` -------------------------------- ### PackMetaData Basic Structure (JSON) Source: https://github.com/whisent/kubeloader/wiki/内容包 Provides the fundamental JSON structure for PackMetaData, which is stored in contentpacks.json. This metadata defines essential information about the content pack, including its ID, name, description, version, authors, and dependencies. ```json { "id": "example-pack", "name": "Example Content Pack", "description": "An example content pack demonstrating metadata format", "version": "1.0.0", "authors": [ "Alice", "Bob" ], "dependencies": [ { "type": "REQUIRED", "id": "required-pack", "source":"PACK", "versionRange": "[1.0,2.0)", "reason": "Core functionality dependency", "ordering": "AFTER" } ] } ``` -------------------------------- ### ItemEntityEvents.tick Source: https://github.com/whisent/kubeloader/wiki/事件集成 当物品实体存在时每 tick 触发。在 client_scripts 和 server_scripts 中均有效,事件不可取消。 ```javascript ItemEntityEvents.tick('chest',event=>{ const itemEntity = event.itemEntity const level = event.level const pos = event.pos }) ``` -------------------------------- ### ItemEntityEvents.removed Source: https://github.com/whisent/kubeloader/wiki/事件集成 当物品实体被移除时触发。仅在 server_scripts 中有效,事件不可取消。 ```javascript ItemEntityEvents.removed('chest',event=>{ const itemEntity = event.itemEntity const level = event.level const pos = event.pos }) ``` -------------------------------- ### BlockEntityEvents.removed Source: https://github.com/whisent/kubeloader/wiki/事件集成 当方块实体被从世界移除时触发。通常在破坏带有方块实体的方块时触发。仅在 server_scripts 中有效,事件不可取消。 ```javascript BlockEntityEvents.removed('chest',event=>{ const pos = event.pos const level = event.level const block = event.block const blockEntity = event.blockEntity }) ``` -------------------------------- ### BlockEntityEvents.tick Source: https://github.com/whisent/kubeloader/wiki/事件集成 在方块实体添加到世界后每 tick 触发。仅在 server_scripts 中有效,事件不可取消。 ```javascript BlockEntityEvents.tick('chest',event=>{ const pos = event.pos const level = event.level const block = event.block const blockEntity = event.blockEntity }) ``` -------------------------------- ### ContentPack ZIP Archive Structure Source: https://github.com/whisent/kubeloader/wiki/内容包 Illustrates the structure of a KubeLoader ContentPack when packaged as a ZIP archive. The internal structure mirrors the folder type, with all components, including contentpacks.json, contained within the ZIP file. ```plaintext [自定义名称].zip ├── ... # 同上文件夹结构 └── contentpacks.json ``` -------------------------------- ### ContentPack Mod Type Structure Source: https://github.com/whisent/kubeloader/wiki/内容包 Describes the structure for a KubeLoader ContentPack when integrated as a mod. The content pack files are located within the 'Resources/contentpacks/' directory of the mod, maintaining the same internal organization. ```plaintext Resources ├── assets/ ├── data/ └── contentpacks/ # 在模组Resource文件夹下 ├── server_scripts/ # 服务端脚本 ├── client_scripts/ # 客户端脚本 ├── startup_scripts/ # 启动脚本 └── contentpacks.json ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.