ItemBuilder
Link to 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. Możesz również użyć mods.contenttweaker.item.ItemBuilder#withType , aby przełączyć się na bardziej wyspecjalizowanego budowlanego budowlanego jeśli istnieje jakiś jakiś element.
Aby powiedzieć CoT, że chcesz aby element pojawiał się w nazwie, musisz wywołać mods.contenttweaker.item.ItemBuilder#build(String) i określić prawidłową ścieżkę lokalizacji zasobów.
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
Link to 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.
ZenScriptCopyEdytor elementów
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.
Constructors
Link to constructors
Creates a new ItemBuilder. Pamiętaj, że to nie utworzy nowego bloku w grze, musisz wywołać mods.contenttweaker.item.ItemBuilder#build(String).
ZenScript Copynowe mods.contenttweaker.item.ItemBuilder();
Methods
Link to methods
build
Link to build
Instructs CoT to actually build whatever this builder is supposed to be building.
ZenScript Copynew ItemBuilder().build(resourceLocation as String);
new ItemBuilder().build("my_awesome_block");
Parameter | Type | Description |
---|---|---|
Parameter resourceLocation | Type String | Description The resource path to give this block |
withItemGroup
Link to 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
Typ zwrotu: mods.contenttweaker.item.ItemBuilder
ZenScript Copynew ItemBuilder().withItemGroup(itemGroup as mods.contenttweaker.item.MCItemGroup);
new ItemBuilder().withItemGroup(<itemgroup:misc>);
Parameter | Type | Description |
---|---|---|
Parameter itemGroup | Type mods.contenttweaker.item.MCItemGroup | Description The item group this item should appear in |
withMaxDamage
Link to withmaxdamage
Pozwala ustawić maksymalne obrażenia dla tego przedmiotu.
Należy ostrzec, że nie można tego użyć w połączeniu z modyfikacjami. ontenttweaker.item.ItemBuilder#withMaxStackSize!
Returns: This builder, used for method chaining
Typ zwrotu: mods.contenttweaker.item.ItemBuilder
ZenScript Copynew ItemBuilder().withMaxDamage(maxDamage as int);
new ItemBuilder().withMaxDamage(250);
Parameter | Type | Description |
---|---|---|
Parameter maxDamage | Type int | Description The maximum stack size |
withMaxStackSize
Link to withmaxstacksize
Pozwala ustawić maksymalny rozmiar stosu dla tego przedmiotu.
Należy ostrzec, że nie można tego użyć w połączeniu z modyfikacjami. ontenttweaker.item.ItemBuilder#withMaxDamage!
Returns: This builder, used for method chaining
Typ zwrotu: mods.contenttweaker.item.ItemBuilder
ZenScript Copynew ItemBuilder().withMaxStackSize(maxStackSize as int);
new ItemBuilder().withMaxStackSize(16);
Parameter | Type | Description |
---|---|---|
Parameter maxStackSize | Type int | Description The maximum stack size |
withNoRepair
Link to withnorepair
Sets that this item may not be repaired in an anvil Returns: This builder, used for method chaining
Typ zwrotu: mods.contenttweaker.item.ItemBuilder
ZenScript Copynew ItemBuilder().withNoRepair();
withRarity
Link to withrarity
Allows you to set the item's rarity
Returns: This builder, used for method chaining
Typ zwrotu: mods.contenttweaker.item.ItemBuilder
ZenScript Copynew ItemBuilder().withRarity(rarity as String);
new ItemBuilder().withRarity("EPIC");
Parameter | Type | Description |
---|---|---|
Parameter rarity | Type String | Description The rarity |
withType
Link to 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
ZenScript Copynowy ItemBuilder().withType<T>();
new ItemBuilder().withType<mods.contenttweaker.item.tool.ItemBuilderTool>();
ParameterName | Bounds |
---|---|
ParameterName T | Bounds [PLACEHOLDER] mods.contenttweaker.item.ItemTypeBuilder |