方块
与物品一样,你需要先创建一个 BlockBuilder
。
导入:import mods.contenttweaker.block.BlockBuilder;
新建 BlockBuilder
与 ItemBuilder
不同,它的构造函数需要一个 MCMaterial
参数。游戏里有哪些 MCMaterial
,你依然可以用 /ct dump
查看。
new BlockBuilder(<blockmaterial:earth>);
这个参数可以省略,会取默认值
<blockmaterial:iron>
设定属性
你可以用以下方法设定属性,这些方法也是一样是链性调用的。
方法及参数 | 例子 | 描述 |
|
| 如果你的方块模型不是完整方块,或者有透明的地方,一定要调用这个方法以避免你的方块变成 X 光方块。 |
|
| 设定方块需要工具才能挖掘。 |
|
| 同时设置硬度和抗爆等级 |
|
| 设置硬度和抗爆等级 |
|
| 挖掘等级 |
|
| 挖掘工具 |
|
| 创造标签 |
|
| 亮度 |
|
| 设定该方块的掉落与什么相同,CoT 还是会自动生成这个方块的默认战利品表,但是会被游戏忽略 |
|
| 一组多少个物品?(默认值 64) |
|
| 设置物品稀有度,会影响游戏内物品名字的颜色,可使用 COMMON UNCOMMON RARE EPIC |
|
| 设置方块渲染类型,如果设定的不是 SOLID,同时还会调用 |
|
| 滑度 |
|
| 方块会收到随机刻 |
|
| 方块无掉落,CoT 还是会自动生成这个方块的默认战利品表,但是会被游戏忽略 |
|
| 设置方块不会被活塞推动,同时还会调用 |
|
| 将方块设置为其他特殊类型的方块,可进行进一步的参数设置,这个方法调用后前面的方法将不可用 |
注册方块
当你所有参数都设置完了,可以调用 build(name as string)
方法来注册方块,参数为这个方块的注册名,只允许包含阿拉伯数字、小写字母和下划线 _
。
lang key
lang key 为 block.contenttweaker.方块名
例子
最后更新于