A special builder that allows you to create items that can be used as tools. You should have set the item's max damage before changing to this builder.

Has special methods that allow you to set the mining level for several tool types as well as the attack damage.

This class was added by a mod with mod-id contenttweaker. 因此,如果要使用此功能,则需要安装此mod。

如果遇到任何问题(例如强制转换数组),则可能需要导入软件包,因此,最好的方式就是导入包支持。

ZenScript
Copy
contenttweeper.item.tool.ItemBuilder工具

已实现的接口

Link to 已实现的接口

ItemBuilderTool implements the following interfaces. 这意味着对这个接口可用的任何方法也可以在此类上使用。

Instructs CoT to actually build whatever this builder is supposed to be building.

ZenScript
Copy
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().build(resourceLocation as String);
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().build("my_awesome_block");
参数类型描述
参数
resourceLocation
类型
字符串[string]
描述
The resource path to give this block

withAttackDamage

Link to withattackdamage

Allows you to set the attack damage bonus that you get when holding this item

Returns: This builder, used for method chaining

返回类型: mods.contenttweiner.item.tool.ItemBuilderTool

ZenScript
Copy
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withAttackDamage(attackDamage as float);
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withAttackDamage(2.0f);
参数类型描述
参数
attackDamage
类型
float
描述
The additional attack damage

Allows you to set the attack speed bonus that you get when holding this item.

Returns: This builder, used for method chaining.

返回类型: mods.contenttweiner.item.tool.ItemBuilderTool

ZenScript
Copy
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withAttackSpeed(attackSpeed as double);
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withAttackSpeed(2.0d);
参数类型描述
参数
attackSpeed
类型
double
描述
The attack speed

withDurabilityCostAttack

Link to withdurabilitycostattack

Allows you to set the amount of damage that this item will receive when hitting enemies. By default this is 0

Returns: This builder, used for method chaining

返回类型: mods.contenttweiner.item.tool.ItemBuilderTool

ZenScript
Copy
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withDurabilityCostAttack(durabilityCostAttack as int);
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withDurabilityCostAttack(5);
参数类型描述
参数
durabilityCostAttack
类型
int
描述
The damage points this item will receive

withDurabilityCostMining

Link to withdurabilitycostmining

Allows you to set the amount of damage that this item will receive when mining blocks. By default this is 0

Returns: This builder, used for method chaining

返回类型: mods.contenttweiner.item.tool.ItemBuilderTool

ZenScript
Copy
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withDurabilityCostMining(durabilityCostMining as int);
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withDurabilityCostMining(1);
参数类型描述
参数
durabilityCostMining
类型
int
描述
The damage points this item will receive

Allows you to add a tool type to this tool. You can specify the type, the mining level and optionally the mining speed when this type is hit as well.

Returns: This builder, used for method chaining

返回类型: mods.contenttweiner.item.tool.ItemBuilderTool

ZenScript
Copy
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withToolType(toolType as mods.contenttweaker.item.MCToolType, miningLevel as int, miningSpeed as float);
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withToolType(<tooltype:shovel>, 3);
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withToolType(<tooltype:shovel>, 3, 2.0f);
参数类型描述可选的默认值
参数
toolType
类型
mods.contenttweaker.item.MCToolType
描述
The type of the tool
可选的
false
默认值
null
参数
miningLevel
类型
int
描述
The mining level for this tool type
可选的
false
默认值
null
参数
miningSpeed
类型
float
描述
How fast this tool can mine blocks of the given type
可选的
true
默认值
1.0