ItemBuilderTool

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.

Importing the class

Potrebbe essere necessario importare il pacchetto, se si incontrano dei problemi (come castare un vettore), quindi meglio essere sicuri e aggiungere la direttiva di importazione.

mods.contenttweaker.item.tool.ItemBuilderTool

Interfacce Implementate

ItemBuilderTool implements the following interfaces. Ciò significa che ogni metodo presente nell'interfaccia può essere usato anche per questa classe.

Methods

build

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

new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().build(resourceLocation as String);
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().build("my_awesome_block");
ParameterTypeDescription
resourceLocationStringIl percorso della risorsa per dare questo blocco

withAttackDamage

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

Returns: This builder, used for method chaining

Tipo restituito: mods.contenttweaker.item.tool.ItemBuilderTool

new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withAttackDamage(attackDamage as float);
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withAttackDamage(2.0f);
ParameterTypeDescription
attackDamagefloatThe additional attack damage

withAttackSpeed

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

Returns: This builder, used for method chaining.

Tipo restituito: mods.contenttweaker.item.tool.ItemBuilderTool

new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withAttackSpeed(attackSpeed as double);
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withAttackSpeed(2.0d);
ParameterTypeDescription
attackSpeeddoubleThe attack speed

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

Tipo restituito: mods.contenttweaker.item.tool.ItemBuilderTool

new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withDurabilityCostAttack(durabilityCostAttack as int);
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withDurabilityCostAttack(5);
ParameterTypeDescription
durabilityCostAttackintThe damage points this item will receive

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

Tipo restituito: mods.contenttweaker.item.tool.ItemBuilderTool

new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withDurabilityCostMining(durabilityCostMining as int);
new ItemBuilder().withMaxDamage(150).withType<ItemBuilderTool>().withDurabilityCostMining(1);
ParameterTypeDescription
durabilityCostMiningintThe damage points this item will receive

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

Tipo restituito: mods.contenttweaker.item.tool.ItemBuilderTool

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);
ParameterTypeDescriptionIsOptionalDefault Value
toolTypemods.contenttweaker.item.MCToolTypeThe type of the toolfalsenull
miningLevelintThe mining level for this tool typefalsenull
miningSpeedfloatHow fast this tool can mine blocks of the given typetrue1.0