结构化重生版是一个简单的库,用于帮助添加自定义村庄结构。
结构化提供了一个注册表,允许您向村庄等拼图中的StructurePool添加自定义结构。假设我们想将village/plains/houses/plainssmallhouse_1添加到沙漠房屋池中。只需将新结构注册到目标池,并指定权重和一些可选修饰符。在与调用任何其他服务器端注册事件(例如注册物品或方块)相同的位置调用这些register方法。
FabricStructurePoolRegistry.register(
Identifier("minecraft:village/desert/houses"), //目标池
Identifier("minecraft:village/plains/houses/plains_small_house_1"), //要添加的新结构nbt
2, //结构在池中的权重
StructureProcessorLists.MOSSIFY_10_PERCENT) //可选处理器,用于添加苔藓效果
如果您没有特殊需求,可以使用registerSimple来简化操作:
FabricStructurePoolRegistry.registerSimple(
Identifier("minecraft:village/desert/houses"), //目标池
Identifier("minecraft:village/plains/houses/plains_small_house_1"), //要添加的新结构nbt
2) //结构在池中的权重
注册方法非常灵活,提供了多个可选参数以满足需求。在许多情况下,使用registerSimple方法就足够了,但主要的register方法可用于实现更复杂的功能,例如为许多村庄结构添加随机苔石效果。
参数:
poolId:必需,要修改的结构目标池
structureId:必需,新结构nbt的位置标识符
weight:必需,结构被选中生成的概率。权重1到3大约对应每个村庄生成1个结构
processor:可选,定义自定义生成调整,如随机苔石
projection:可选,定义结构与地面的交互方式(在空间中保持刚性或适应地形)
type:可选,定义所需的structurePoolElement类型。大多数情况下不需要此参数
如果您想对结构池进行更高级的操作,也可以直接注册回调并添加任意事件代码。注册回调的示例如下:
StructurePoolAddCallback.EVENT.register(structurePool -> {
if(structurePool.getUnderlying().getId().toString().equals("minecraft:village/plains/houses")) {
structurePool.addStructurePoolElement(new SinglePoolElement("village/desert/houses/desert_small_house_1"), 50);
}
});
您可以使用Modrinth内置的Maven仓库将此库添加为项目依赖。{VERSION}是您要使用的版本号。例如,此库的第一个版本上传的版本号为1.18.2-01。
在build.gradle中:
repositories {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}
dependencies {
modImplementation "maven.modrinth:Wd844r7Q:{VERSION}"
include("maven.modrinth:Wd844r7Q:{VERSION}")
}
在build.gradle.kts中:
repositories {
maven {
name = "Modrinth"
url = uri("https://api.modrinth.com/maven")
content {
includeGroup("maven.modrinth")
}
}
}
dependencies {
modImplementation("maven.modrinth:Wd844r7Q:{VERSION}")
include("maven.modrinth:Wd844r7Q:{VERSION}")
} 友情链接: 网易我的世界 | 泰拉瑞亚 | ocent云计算 | 米饭Minecraft插件文档 | 友链合作
历史访问人数:90,637 | 历史访问人次:180,640
今日访问人数:1,420 | 今日访问人次:1,512
昨日访问人数:19,978 | 昨日访问人次:22,291
Copyright © 2019-2026 我的世界服务器列表站. All rights reserved.
❤ Powered by GermMC 京ICP备17023959号-6