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.contenttweeper.block.BlockBuilder#build(String) 并指定一个有效的资源位置路径。

This class was added by a mod with mod-id contenttweaker. 因此,如果要使用此功能,则需要安装此mod。

如果遇到任何问题(例如强制转换数组),则可能需要导入软件包,因此,最好的方式就是导入包支持。

ZenScript
Copy
mods.contenttweeper.block.BlockBuilder

已实现的接口

Link to 已实现的接口

BlockBuilder implements the following interfaces. 这意味着对这个接口可用的任何方法也可以在此类上使用。

Constructor #构造函数

Link to constructor-构造函数

Creates a new BlockBuilder. 请记住,这将 不是 在游戏中创建一个新的块,为此你需要调用 mods.contenttweaker.block.BlockBuilder#build(String)

ZenScript
Copy
mods.contenttweeper.block.BlockBuilder(materials as craftmilever.api.block.material.MCMaterial);
new mods.contenttweeper.block.BlockBuilder();
new mods.contenttweeper.block.BlockBuilder(<blockmaterial:earth>);
参数类型描述可选的默认值
参数
material
类型
crafttweaker.api.block.material.MCMaterial #导入方式为 import crafttweaker.api.block.material.MCMaterial
描述
The material this block will have
可选的
true
默认值
<blockmaterial:iron>

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

ZenScript
Copy
myBlockBuilder.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.contenttweeper.block.BlockBuilder

ZenScript
Copy
myBlockBuilder.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.contenttweeper.block.BlockBuilder

ZenScript
Copy
myBlockBuilder.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.contenttweeper.block.BlockBuilder

ZenScript
Copy
myBlockBuilder.withHarvestLevel(harvestLevel as int);
myBlockBuilder.withHarvestLevel(3);
参数类型描述
参数
harvestLevel
类型
int
描述
The harvest level requried

Sets the tool required to harvest this block

Returns: This builder, used for method chaining

返回类型: mods.contenttweeper.block.BlockBuilder

ZenScript
Copy
myBlockBuilder.withHarvestTool(harvestTool as mods.contenttweaker.item.MCToolType);
myBlockBuilder.withHarvestTool(<tooltype:shovel>);
参数类型描述
参数
harvestTool
类型
mods.contenttweaker.item.MCToolType
描述
The tool type

Sets the item group in which this block will appear

Returns: This builder, used for method chaining

返回类型: mods.contenttweeper.block.BlockBuilder

ZenScript
Copy
myBlockBuilder.withItemGroup(group as mods.contenttweaker.item.MCItemGroup);
myBlockBuilder.withItemGroup(<itemgroup:building_blocks>);
参数类型描述
参数
group
类型
mods.contenttweaker.item.MCItemGroup
描述
The group to set

Sets the block's light value.

Returns: This builder, used for method chaining

返回类型: mods.contenttweeper.block.BlockBuilder

ZenScript
Copy
myBlockBuilder.withLightValue(lightValueIn as int);
myBlockBuilder.withLightValue(15);
参数类型描述
参数
lightValueIn
类型
int
描述
The light level to set

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.contenttweeper.block.BlockBuilder

ZenScript
Copy
myBlockBuilder.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.contenttweeper.block.BlockBuilder

ZenScript
Copy
myBlockBuilder.withMaxStackSize(size as int);
myBlockBuilder.withMaxStackSize(16);
参数类型描述
参数
size #大小
类型
int
描述
The size to set.

Allows you to set the rarity of this block.

Returns: This builder, used for method chaining

返回类型: mods.contenttweeper.block.BlockBuilder

ZenScript
Copy
myBlockBuilder.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.contenttweeper.block.BlockBuilder

ZenScript
Copy
myBlockBuilder.withSlipperiness(slipperinessIn as float);
myBlockBuilder.withSlipperiness(0.5f);
参数类型描述
参数
slipperinessIn
类型
float
描述
The value to set

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
Copy
myBlockBuilder.withType<T>();
myBlockBuilder.withType<mods.contenttweaker.block.pillar.BlockBuilderPillarRotatable>();
ParameterNameBounds
ParameterName
T
Bounds
mods.contenttweeper.block.BlockTypeBuilder

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.contenttweeper.block.BlockBuilder

ZenScript
Copy
myBlockBuilder.withoutDrops();

withoutMovementBlocking

Link to withoutmovementblocking

Instructs CoT that this block will does not block movement.

Returns: This builder, used for chaining

返回类型: mods.contenttweeper.block.BlockBuilder

ZenScript
Copy
myBlockBuilder.withoutMovementBlocking();