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. Du kannst auch mods.contenttweaker.item.ItemBuilder#withType verwenden, um zu einem spezialisierteren Builder zu wechseln, falls vorhanden ist.

Um CoT mitzuteilen, dass das Element ingame erscheinen soll, müssen Sie mods.contenttweaker.item.ItemBuilder#build(String) aufrufen und einen gültigen Ressourcenstandort angeben.

This class was added by a mod with mod-id contenttweaker. So you need to have this mod installed if you want to use this feature.

Diese Klasse importieren

Link to diese-klasse-importieren

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import.

ZenScript
Copy
mods.contenttweaker.item.ItemBuilder

Implemented Interfaces

Link to implemented-interfaces

ItemBuilder implements the following interfaces. That means any method available to them can also be used on this class.

Creates a new ItemBuilder. Merke, dass hier kein neues Item dem Spiel hinzugefügt wird, du musst mods.contenttweaker.item.ItemBuilder#build(String) dafür ausführen.

ZenScript
Copy
neue mods.contenttweaker.item.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");
ParameterTypeBeschreibung
Parameter
resourceLocation
Type
String
Beschreibung
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

Rückgabetyp: mods.contenttweaker.item.ItemBuilder

ZenScript
Copy
new ItemBuilder().withItemGroup(itemGroup as mods.contenttweaker.item.MCItemGroup);
new ItemBuilder().withItemGroup(<itemgroup:misc>);
ParameterTypeBeschreibung
Parameter
itemGroup
Type
mods.contenttweaker.item.MCItemGroup
Beschreibung
The item group this item should appear in

Erlaubt dir, den maximalen Schaden für dieses Item zu setzen.
Seien Sie gewarnt, dass dies nicht in Kombination mit Mods verwendet werden kann. ontenttweaker.item.ItemBuilder#withMaxStackGröße!

Returns: This builder, used for method chaining

Rückgabetyp: mods.contenttweaker.item.ItemBuilder

ZenScript
Copy
new ItemBuilder().withMaxDamage(maxDamage as int);
new ItemBuilder().withMaxDamage(250);
ParameterTypeBeschreibung
Parameter
maxDamage
Type
int
Beschreibung
The maximum stack size

withMaxStackSize

Link to withmaxstacksize

Erlaubt Ihnen, die maximale Stapelgröße für dieses Item festzulegen.
Seien Sie gewarnt, dass dies nicht in Kombination mit Mods verwendet werden kann. ontenttweaker.item.ItemBuilder#withMaxDamage!

Returns: This builder, used for method chaining

Rückgabetyp: mods.contenttweaker.item.ItemBuilder

ZenScript
Copy
new ItemBuilder().withMaxStackSize(maxStackSize as int);
new ItemBuilder().withMaxStackSize(16);
ParameterTypeBeschreibung
Parameter
maxStackSize
Type
int
Beschreibung
The maximum stack size

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

Rückgabetyp: mods.contenttweaker.item.ItemBuilder

ZenScript
Copy
new ItemBuilder().withNoRepair();

Allows you to set the item's rarity

Returns: This builder, used for method chaining

Rückgabetyp: mods.contenttweaker.item.ItemBuilder

ZenScript
Copy
new ItemBuilder().withRarity(rarity as String);
new ItemBuilder().withRarity("EPIC");
ParameterTypeBeschreibung
Parameter
rarity
Type
String
Beschreibung
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
neues ItemBuilder().withType<T>();
new ItemBuilder().withType<mods.contenttweaker.item.tool.ItemBuilderTool>();
ParameterNameBounds
ParameterName
T
Bounds
mods.contenttweaker.item.ItemTypeBuilder