ItemBuilderBasic implements the following interfaces.

Link to itembuilderbasic-implements-the-following-interfaces

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. Perciò, è necessario avere questa mod installata per poter utilizzare questa funzione.

Importare la Classe

Link to importare-la-classe

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 at the very top of the file.

ZenScript
Copy
import mods.contenttweaker.item.tool.ItemBuilderTool;

Extending ItemTypeBuilder

Link to extending-itemtypebuilder

ItemBuilderTool extends ItemTypeBuilder. That means all methods available in ItemTypeBuilder are also available in ItemBuilderTool

Name: build

Istruisce CoT per costruire realmente qualsiasi cosa il costruttore dovrebbe star costruendo.

Return Type: void

ZenScript
Copy
// ItemBuilderTool.build(resourceLocation as string) as void

new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().build("my_awesome_block");
ParametroTipoDescrizione
Parametro
resourceLocation
Tipo
string
Descrizione
Il percorso della risorsa per dare questo blocco

Link to withAttackDamage

Name: withAttackDamage

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

Returns: This builder, used for method chaining
Return Type: ItemBuilderTool

ZenScript
Copy
// ItemBuilderTool.withAttackDamage(attackDamage as float) as ItemBuilderTool

new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withAttackDamage(2.0f);
ParametroTipoDescrizione
Parametro
attackDamage
Tipo
float
Descrizione
The additional attack damage

Name: withAttackSpeed

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

Returns: This builder, used for method chaining.
Return Type: ItemBuilderTool

ZenScript
Copy
// ItemBuilderTool.withAttackSpeed(attackSpeed as double) as ItemBuilderTool

new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withAttackSpeed(2.0d);
ParametroTipoDescrizione
Parametro
attackSpeed
Tipo
double
Descrizione
The attack speed

Link to withDurabilityCostAttack

Name: 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
Return Type: ItemBuilderTool

ZenScript
Copy
// ItemBuilderTool.withDurabilityCostAttack(durabilityCostAttack as int) as ItemBuilderTool

new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withDurabilityCostAttack(5);
ParametroTipoDescrizione
Parametro
durabilityCostAttack
Tipo
int
Descrizione
The damage points this item will receive

Link to withDurabilityCostMining

Name: 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
Return Type: ItemBuilderTool

ZenScript
Copy
// ItemBuilderTool.withDurabilityCostMining(durabilityCostMining as int) as ItemBuilderTool

new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withDurabilityCostMining(1);
ParametroTipoDescrizione
Parametro
durabilityCostMining
Tipo
int
Descrizione
The damage points this item will receive

Name: withToolType

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
Return Type: ItemBuilderTool

ZenScript
Copy
// ItemBuilderTool.withToolType(toolType as ToolType, miningLevel as int, miningSpeed as float) as ItemBuilderTool

new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withToolType(<tooltype:shovel>, 3, 2.0f);
ParametroTipoDescrizioneOptionalDefaultValue
Parametro
toolType
Tipo
ToolType
Descrizione
The type of the tool
Optional
no
DefaultValue
Parametro
miningLevel
Tipo
int
Descrizione
The mining level for this tool type
Optional
no
DefaultValue
Parametro
miningSpeed
Tipo
float
Descrizione
How fast this tool can mine blocks of the given type
Optional
DefaultValue
1.0