Zentutorial
  • 首页
  • Zenscript
  • 简单运用
    • 局部变量
    • 尖括号调用
    • 工作台合成
      • 添加配方
      • 移除配方
      • Metadata
      • NBT
    • 熔炉配方
    • 矿物词典(Ore Dictionaries)
    • 物品名称修改
    • tooltips
      • 样式代码
    • 物品条件
    • 物品转换器
    • 掉落物
      • 打草掉落物
      • 生物掉落物
      • Dropt - 导言
        • Dropt - 方法速查
        • Dropt - 使用示例
    • 战利品表 : 导论
      • 战利品表修改(LootTableTweaker)
      • 战利品表修改(LootTweaker-基础)
    • 循环语句(foreach循环) / 普通数组
  • 高级运用
    • 概论
      • 基本类
      • ZenGetter
      • ZenSetter
      • ZenMethod(方法)
    • 常见错误
    • 基本运算
    • 数组与集合
    • 循环与遍历
    • 全局函数
    • Math包
    • if
    • in/has 操作符
    • 战利品表修改(LootTweaker-进阶)
    • 三元操作符
    • 预处理器
    • 全局和静态变量
    • 跨脚本引用
    • 关联数组(映射)
    • IItemStack类型的重新认识
    • IIngredient接口
    • IItemDefinition & IBlockDefinition
    • IData 类型
      • DataMap
    • 穷举与遍历
    • 自定义函数
    • 配方函数与配方事件
      • 配方函数
      • 配方事件
    • 事件概论
      • 一些忠告
    • ZenClass
  • ContentTweaker
    • ContentTweaker
    • 指令
    • 原版加工厂
      • 概论
      • 物品
      • 方块
      • 流体
      • 创造标签
      • 食物
    • 材料系统
      • 基础用法
        • 材料
        • 部件
        • 注册材料部件
        • 材料部件信息
      • 高级运用
        • 自定义部件类型
        • 注册自定义部件
        • 自定义材料部件信息
    • 高级运用
    • 更多鸡联动
    • 匠魂联动
      • 材料引导
        • 材料
        • 构建材料
      • 特性引导
        • 特性
        • 构建特性
        • 特性数据
      • 高级运用
  • 实战
    • 配方
      • 数据驱动合成修改
    • 事件
      • 修改方块掉落物
      • 禁止开创造
由 GitBook 提供支持
在本页
  • 导包
  • 构建器
  • 可设置参数
  • 方法
  • 材料特性
  • 增删特性至部件的方法
  • CoT 自带的部件类型
  • 怎么知道我想要的特性的 identifier ?
  • 部件属性
  • 如果未调用对应部件的 add 方法则该部件不会出现在游戏内
  • 参数解析
  • 注册材料
  • 本地化key
  • 实例

这有帮助吗?

  1. ContentTweaker
  2. 匠魂联动
  3. 材料引导

构建材料

导包

import mods.contenttweaker.tconstruct.MaterialBuilder;

构建器

记得导包!

var myMat as MaterialBuilder = MaterialBuilder.create(identifier as string);

可设置参数

字段

设定值类型

描述

identifier

string

材料名称

color

int

材料颜色

hidden

bool

是否隐藏材料

liquid

设置流体

craftable

bool (默认false)

部件加工台是否可制作此材料

castable

bool (默认false)

冶炼炉是否可制作此材料

representativeItem

在匠魂宝典里显示的物品

representativeOre

同上, 但为矿物辞典内物品循环显示

shard

代替部件加工台的碎片

localizedName

string

本地化描述

方法

方法

描述

使 ingredient 可以在部件加工台制作此材料对应的模板的部件, amountNeeded 为需求数量, amountMatched 为匹配数量, 后两个参数选填, 默认为 1

使 itemStack 不能制作此材料

材料特性

可以向材料对应的部件添加一个或一些特性

增删特性至部件的方法

//第一个参数可以填 Trait 对象, TraitBuilder 对象, String 类型的 identifier(特性名)
//第二个参数都为部件类型
//不填部件类型会把这个特性附加到材料可添加的部件上
myMat.addMaterialTrait("fiery", "bowstring");
//第一个参数只能为 String 类型的 identifier(特性名) 
myMat.removeMaterialTrait("fiery", "bowstring");

CoT 自带的部件类型

ContentTweaker 自带的部件类型有以下几种

(只有匠魂及其前置 Mod 的情况下)

  • "head"-镐头,斧刃,铲头,剑刃,宽剑刃,锤头,开掘铲头,园艺镰头,盘,牌板

  • "handle"-手柄, 坚韧手柄

  • "extra"-大板, 绑定节, 坚韧手柄, 坚韧绑定节, 护手, 宽护手, 十字柄

  • "bow"-弓箭

  • "bowstring"-弓弦

  • "projectile"-刀刃, 箭头

  • "shaft"-箭杆, 弩箭核心

  • "fletching"-箭羽

为什么没有碎片部件

答 : 你只要使用一次 addMaterialTrait 方法就会自动添加碎片部件

怎么知道我想要的特性的 identifier ?

1.手持具有该特性的物品, 输入 /ct nbt, 然后去 crafttweaker.log 找刚才输出的结果, 在结果找 "trait", trait 数组内的字符串即是特性名称

2.安装 Infini-TiC Mod, 进入游戏后输入 /infinitic traits 获取所有已注册的特性

部件属性

如果未调用对应部件的 add 方法则该部件不会出现在游戏内

有以下方法增删部件属性 (MaterialStats)

myMat.addHeadMaterialStats(durability as int, miningSpeed as float, attackDamage as float, harvestLevel as int);
myMat.removeHeadMaterialStats();

myMat.addHandleMaterialStats(modifier as float, durability as int);
myMat.removeHandleMaterialStats();

myMat.addExtraMaterialStats(extraDurability as int);
myMat.removeExtraMaterialStats();

myMat.addBowMaterialStats(drawSpeed as float, range as float, bonusDamage as float);
myMat.removeBowMaterialStats();

myMat.addBowStringMaterialStats(modifier as float);
myMat.removeBowStringMaterialStats();

myMat.addArrowShaftMaterialStats(modifier as float, bonusAmmo as int);
myMat.removeArrowShaftMaterialStats();

myMat.addFletchingMaterialStats(accuracy as float, modifier as float);
myMat.removeFletchingMaterialStats();

myMat.addProjectileMaterialStats();
myMat.removeProjectileMaterialStats();

参数解析

  • durability-耐久度

  • miningSpeed-挖掘速度

  • attackDamage-伤害

  • harvestLevel-挖掘等级

  • modifier-系数

  • extraDurability-耐久度

  • drawSpeed-蓄力时间

  • range-射程

  • bonusDamage-箭矢的附加伤害

  • bonusAmmo-额外弹药

  • accuracy-精准度

注册材料

最后记得调用一下 register 零参方法, 否则游戏内会无反应

本地化key

本地化 key 为 material.材料名.name

实例

#loader contenttweaker //一定要加这行
import mods.contenttweaker.tconstruct.MaterialBuilder; //导包

var testMat as MaterialBuilder = MaterialBuilder.create("kindlich_mat");
//testMat.identifier = "kindlich_mat"; //没必要写这行, 你调用 create 方法并传入一个字符串的时候就已经指定 identifier 了
testMat.color = 0x8e661b;
testMat.craftable = true;
testMat.castable = true;
testMat.liquid = <liquid:lava>;
testMat.localizedName = "Wicked";
testMat.representativeItem = <item:minecraft:red_flower:4>;
testMat.addItem(<item:minecraft:red_flower:4>);
testMat.addHeadMaterialStats(100, 1.5f, 5.5f, 5); //如果未写这行则游戏不会出现 "头部" 部件
testMat.addHandleMaterialStats(0.3, 500); //如果未写这行则游戏不会出现 "手柄" 部件
testMat.addBowStringMaterialStats(0.5f); //如果未写这行则游戏不会出现 "弓弦" 部件
testMat.addMaterialTrait("blasting", "bowstring");
testMat.addMaterialTrait("blasting", "head");
testMat.addMaterialTrait("dense");
//此函数将在高级运用讲解
testMat.itemLocalizer = function(thisMaterial, itemName) {
    return "Cool " + itemName;
};
testMat.register();
上一页材料下一页特性引导

最后更新于3年前

这有帮助吗?

addItem(ingredient as , amountNeeded as int, amountMatched as int)

removeItem(itemStack as )

3.使用 Mod 导出匠魂各类数据

Tinkers Exporter
ILiquidStack
IItemStack
IOreDictEntry
IItemStack
IIngredient
IItemStack