ItemBuilder

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. También puedes usar mods.contenttweaker.item.ItemBuilder#withType para cambiar a un constructor más especializado, si existe ninguno.

Para decirle a CoT que quieres que el elemento aparezca en el juego, necesitas llamar a mods.contenttweaker.item.ItemBuilder#build(String) y especificar una ruta de ubicación de recurso válida.

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.

Importing the class

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.

mods.contenttweaker.item.ItemBuilder

Implemented Interfaces

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

Constructors

Creates a new ItemBuilder. Recuerda que esto no creará un nuevo bloque en el juego, necesitas llamar a mods.contenttweaker.item.ItemBuilder#build(String) para eso.

nuevo mods.contenttweaker.item.ItemBuilder();

Methods

build

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

new ItemBuilder().build(resourceLocation as String);
new ItemBuilder().build("my_awesome_block");
ParameterTypeDescription
resourceLocationStringThe resource path to give this block

withItemGroup

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

Tipo de retorno: mods.contenttweaker.item.ItemBuilder

new ItemBuilder().withItemGroup(itemGroup as mods.contenttweaker.item.MCItemGroup);
new ItemBuilder().withItemGroup(<itemgroup:misc>);
ParameterTypeDescription
itemGroupmods.contenttweaker.item.MCItemGroupThe item group this item should appear in

withMaxDamage

Te permite establecer el daño máximo para este objeto.
Tenga en cuenta que esto no se puede usar en combinación con mods. ontenttweaker.item.ItemBuilder#withMaxStackSize!

Returns: This builder, used for method chaining

Tipo de retorno: mods.contenttweaker.item.ItemBuilder

new ItemBuilder().withMaxDamage(maxDamage as int);
new ItemBuilder().withMaxDamage(250);
ParameterTypeDescription
maxDamageintThe maximum stack size

withMaxStackSize

Le permite establecer el tamaño máximo de la pila para este elemento.
Tenga en cuenta que esto no se puede usar en combinación con mods. ontenttweaker.item.ItemBuilder#withMaxDamage!

Returns: This builder, used for method chaining

Tipo de retorno: mods.contenttweaker.item.ItemBuilder

new ItemBuilder().withMaxStackSize(maxStackSize as int);
new ItemBuilder().withMaxStackSize(16);
ParameterTypeDescription
maxStackSizeintThe maximum stack size

withNoRepair

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

Tipo de retorno: mods.contenttweaker.item.ItemBuilder

new ItemBuilder().withNoRepair();

withRarity

Allows you to set the item's rarity

Returns: This builder, used for method chaining

Tipo de retorno: mods.contenttweaker.item.ItemBuilder

new ItemBuilder().withRarity(rarity as String);
new ItemBuilder().withRarity("EPIC");
ParameterTypeDescription
rarityStringThe rarity

withType

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

new ItemBuilder().withType<T>();
new ItemBuilder().withType<mods.contenttweaker.item.tool.ItemBuilderTool>();