BlockBuilder
Link to blockbuilder
The blockbuilder is used to... build blocks (you totally didn't see that one coming, right... right?).
Once you created it you can set various properties which will be outlined by the separate methods.
You can also change the block's type to create a more specialized form of block (e.g. stairs or Blocks that can be rotated in the same way logs can). Чтобы сообщить CoT, что блок появится в игре, вам нужно вызвать mods.contenttweaker.block.BlockBuilder#build(String) и указать правильный путь доступа к ресурсу.
This class was added by a mod with mod-id contenttweaker
. Так что если вы хотите использовать эту функцию, вам нужно установить этот мод.
Импорт класса
Link to импорт-класса
Вам может потребоваться импортировать пакет, если вы столкнетесь с какими-либо проблемами (например, с заливкой массива), так что лучше быть в безопасности, чем извиняться и добавлять импорт.
ZenScript Copymods.contenttweaker.block.BlockBuilder
Implemented Interfaces
Link to implemented-interfaces
BlockBuilder 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 BlockBuilder. Помните, что это не создаст новый блок в игре, вам нужно вызвать mods.contenttweaker.block.BlockBuilder#build(String) для этого.
ZenScript Copynew mods.contenttweaker.block.BlockBuilder(material as crafttweaker.api.block.material.MCMaterial);
new mods.contenttweaker.block.BlockBuilder();
new mods.contenttweaker.block.BlockBuilder(<blockmaterial:earth>);
Параметр | Тип | Описание | IsOptional | Default Value |
---|---|---|---|---|
Параметр material | Тип crafttweaker.api.block.material.MCMaterial | Описание The material this block will have | IsOptional true | Default Value <blockmaterial:iron> |
Методы
Link to методы
build
Link to build
Instructs CoT to actually build whatever this builder is supposed to be building.
ZenScript CopymyBlockBuilder.build(resourceLocation as String);
myBlockBuilder.build("my_awesome_block");
Параметр | Тип | Описание |
---|---|---|
Параметр resourceLocation | Тип String | Описание The resource path to give this block |
withHardnessAndResistance
Link to withhardnessandresistance
Sets the block's hardness and resistance levels. Unlike the other method, this one only accepts one parameter and will use that value for both properties.
Returns: This builder, used for method chaining
Тип возврата: mods.contenttweaker.block.BlockBuilder
ZenScript CopymyBlockBuilder.withHardnessAndResistance(hardnessAndResistance as float);
myBlockBuilder.withHardnessAndResistance(0.5f);
Параметр | Тип | Описание |
---|---|---|
Параметр hardnessAndResistance | Тип float | Описание The value to set for hardness and for resistance. |
Sets the block's hardness and resistance levels. Unlike the other method, this one allows you to set each property one to a separate value.
Returns: This builder, used for method chaining
Тип возврата: mods.contenttweaker.block.BlockBuilder
ZenScript CopymyBlockBuilder.withHardnessAndResistance(hardnessIn as float, resistanceIn as float);
myBlockBuilder.withHardnessAndResistance(0.5f, 0.5f);
Параметр | Тип | Описание |
---|---|---|
Параметр hardnessIn | Тип float | Описание The value to set for hardness |
Параметр resistanceIn | Тип float | Описание The value to set for resistance. |
withHarvestLevel
Link to withharvestlevel
Sets the mining level required to mine this block
Returns: This builder, used for method chaining
Тип возврата: mods.contenttweaker.block.BlockBuilder
ZenScript CopymyBlockBuilder.withHarvestLevel(harvestLevel as int);
myBlockBuilder.withHarvestLevel(3);
Параметр | Тип | Описание |
---|---|---|
Параметр harvestLevel | Тип int | Описание The harvest level requried |
withHarvestTool
Link to withharvesttool
Sets the tool required to harvest this block
Returns: This builder, used for method chaining
Тип возврата: mods.contenttweaker.block.BlockBuilder
ZenScript CopymyBlockBuilder.withHarvestTool(harvestTool as mods.contenttweaker.item.MCToolType);
myBlockBuilder.withHarvestTool(<tooltype:shovel>);
Параметр | Тип | Описание |
---|---|---|
Параметр harvestTool | Тип mods.contenttweaker.item.MCToolType | Описание The tool type |
withItemGroup
Link to withitemgroup
Sets the item group in which this block will appear
Returns: This builder, used for method chaining
Тип возврата: mods.contenttweaker.block.BlockBuilder
ZenScript CopymyBlockBuilder.withItemGroup(group as mods.contenttweaker.item.MCItemGroup);
myBlockBuilder.withItemGroup(<itemgroup:building_blocks>);
Параметр | Тип | Описание |
---|---|---|
Параметр group | Тип mods.contenttweaker.item.MCItemGroup | Описание The group to set |
withLightValue
Link to withlightvalue
Sets the block's light value.
Returns: This builder, used for method chaining
Тип возврата: mods.contenttweaker.block.BlockBuilder
ZenScript CopymyBlockBuilder.withLightValue(lightValueIn as int);
myBlockBuilder.withLightValue(15);
Параметр | Тип | Описание |
---|---|---|
Параметр lightValueIn | Тип int | Описание The light level to set |
withLootFrom
Link to withlootfrom
Will instruct CoT to override this block's loot table with the one of the block Provided. Currently this will still create a loot table entry, though it will be ignored by the game.
Returns: This builder, used for method chaining
Тип возврата: mods.contenttweaker.block.BlockBuilder
ZenScript CopymyBlockBuilder.withLootFrom(blockIn as crafttweaker.api.block.MCBlock);
myBlockBuilder.withLootFrom(<block:minecraft:diamond>);
Параметр | Тип | Описание |
---|---|---|
Параметр blockIn | Тип crafttweaker.api.block.MCBlock | Описание The block whose loot table should be applied |
withMaxStackSize
Link to withmaxstacksize
Sets the maximum Stack size that this block can have when in your inventory. Will be 64 if unchanged.
Returns: This builder, used for chaining
Тип возврата: mods.contenttweaker.block.BlockBuilder
ZenScript CopymyBlockBuilder.withMaxStackSize(size as int);
myBlockBuilder.withMaxStackSize(16);
Параметр | Тип | Описание |
---|---|---|
Параметр size | Тип int | Описание The size to set. |
withRarity
Link to withrarity
Allows you to set the rarity of this block.
Returns: This builder, used for method chaining
Тип возврата: mods.contenttweaker.block.BlockBuilder
ZenScript CopymyBlockBuilder.withRarity(rarity as String);
myBlockBuilder.withRarity("UNCOMMON");
Параметр | Тип | Описание |
---|---|---|
Параметр rarity | Тип String | Описание The rarity |
withSlipperiness
Link to withslipperiness
Sets the slipperiness.
Returns: This builder, used for method chaining
Тип возврата: mods.contenttweaker.block.BlockBuilder
ZenScript CopymyBlockBuilder.withSlipperiness(slipperinessIn as float);
myBlockBuilder.withSlipperiness(0.5f);
Параметр | Тип | Описание |
---|---|---|
Параметр slipperinessIn | Тип float | Описание The value to set |
withType
Link to withtype
Sets the specific type of this block. 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 block.
Return type: T
ZenScript CopymyBlockBuilder.withType<T>();
myBlockBuilder.withType<mods.contenttweaker.block.pillar.BlockBuilderPillarRotatable>();
ParameterName | Bounds |
---|---|
ParameterName T | Bounds mods.contenttweaker.block.BlockTypeBuilder |
withoutDrops
Link to withoutdrops
Will instruct CoT that this block will not have any loot entries. Currently this will still create a loot table entry, though it will be ignored by the game.
Returns: This builder, used for method chaining
Тип возврата: mods.contenttweaker.block.BlockBuilder
ZenScript CopymyBlockBuilder.withoutDrops();
withoutMovementBlocking
Link to withoutmovementblocking
Instructs CoT that this block will does not block movement.
Returns: This builder, used for chaining
Тип возврата: mods.contenttweaker.block.BlockBuilder
ZenScript CopymyBlockBuilder.withoutMovementBlocking();