Structurized Reborn

模组

· 作者 fzzyhmstrs

一个用于添加自定义村庄结构的简易库

0 本站下载 0 关注 更新于 2 年前

需要前置:Fabric API

最新 1.21-01 · 1.21.1 · Fabric / Quilt

一键开服(送7天)

Structurized Reborn

这是 Draylar 的 Structurized 的重制版本。原版请参见:

Structurized Reborn 是一个简单的库,用于辅助添加自定义村庄结构。

锁块修改

Structurized 提供了一个注册表,允许你向如村庄等场景中的锁块(jigsaws)的 StructurePool 中添加自定义结构。假设我们要将 village/plains/houses/plains_small_house_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}")
}

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源