The item builder is to... build items (surprise!)

It allows you to set various properties that will change how the item behaves and what it can do. 您也可以使用 mods.contenttweeper.itemBuilder#withType 切换到更专业化的构建器,如果存在任何构建器。

要告诉Cot, 你想要这个项目出现在新手中, 你需要调用 mods.contenttweeper.itemBuilder#build(String) 并指定一个有效的资源位置路径.

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

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

ZenScript
Copy
mods.contenttweeper.item.ItemBuilder

已实现的接口

Link to 已实现的接口

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

Constructor #构造函数

Link to constructor-构造函数

Creates a new ItemBuilder. 请记住,这将 不是 在游戏中创建一个新的块,为此你需要调用 mods.contenttweeper.itemBuilder#build(String)

ZenScript
Copy
mods.contenttweeper.itemBuilder();

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

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

Allows you to set the item group that this item will appear in. By default, items will land in misc

Returns: This builder, used for method chaining

返回类型: mods.contenttweiner.item.ItemBuilder

ZenScript
Copy
new ItemBuilder().withItemGroup(itemGroup as mods.contenttweaker.item.MCItemGroup);
new ItemBuilder().withItemGroup(<itemgroup:misc>);
参数类型描述
参数
itemGroup
类型
mods.contenttweaker.item.MCItemGroup
描述
The item group this item should appear in

允许您设置此物品的最大伤害。
请注意,此选项不能与 mod结合使用。 ontentinstruer.itemBuilder#withMaxStackSize

Returns: This builder, used for method chaining

返回类型: mods.contenttweiner.item.ItemBuilder

ZenScript
Copy
new ItemBuilder().withMaxDamage(maxDamage as int);
new ItemBuilder().withMaxDamage(250);
参数类型描述
参数
maxDamage
类型
int
描述
The maximum stack size

withMaxStackSize

Link to withmaxstacksize

允许您设置此项目的最大堆栈大小。
请注意,此选项不能与 mod结合使用。 ontentinstruer.item.ItemBuilder#withMaxDamage

Returns: This builder, used for method chaining

返回类型: mods.contenttweiner.item.ItemBuilder

ZenScript
Copy
new ItemBuilder().withMaxStackSize(maxStackSize as int);
new ItemBuilder().withMaxStackSize(16);
参数类型描述
参数
maxStackSize
类型
int
描述
The maximum stack size

Sets that this item may not be repaired in an anvil Returns: This builder, used for method chaining

返回类型: mods.contenttweiner.item.ItemBuilder

ZenScript
Copy
new ItemBuilder().withNoRepair();

Allows you to set the item's rarity

Returns: This builder, used for method chaining

返回类型: mods.contenttweiner.item.ItemBuilder

ZenScript
Copy
new ItemBuilder().withRarity(rarity as String);
new ItemBuilder().withRarity("EPIC");
参数类型描述
参数
rarity
类型
字符串[string]
描述
The rarity

Sets the specific type of this item. After this method is called the builder's context will switch to the more provided type builder. That means that the methods of this builder will no longer be available, so any properties you wish to set should be set before you call this method. Returns: A builder with the given item.

Return type: T

ZenScript
Copy
新 ItemBuilder().withType<T>();
new ItemBuilder().withType<mods.contenttweaker.item.tool.ItemBuilderTool> (); ;
ParameterNameBounds
ParameterName
T
Bounds
mods.contenttweeper.item.ItemTypeBuilder