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). Per dire a CoT che vuoi che il blocco appaia ingame devi chiamare mods.contenttweaker.block.BlockBuilder#build(String) e specificare un percorso di localizzazione delle risorse valido.

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

Interfacce Implementate

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

Constructors

Creates a new BlockBuilder. Ricorda che questo non creerà un nuovo blocco nel gioco, è necessario chiamare mods.contenttweaker.block.BlockBuilder#build(String) per questo.

new mods.contenttweaker.block.BlockBuilder(material as crafttweaker.api.block.material.MCMaterial);
new mods.contenttweaker.block.BlockBuilder();
new mods.contenttweaker.block.BlockBuilder(<blockmaterial:earth>);
ParameterTypeDescriptionIsOptionalDefault Value
materialcrafttweaker.api.block.material.MCMaterialThe material this block will havetrue<blockmaterial:iron>

Methods

build

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

myBlockBuilder.build(resourceLocation as String);
myBlockBuilder.build("my_awesome_block");
ParameterTypeDescription
resourceLocationStringIl percorso della risorsa per dare questo blocco

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

Tipo di restituzione: mods.contenttweaker.block.BlockBuilder

myBlockBuilder.withHardnessAndResistance(hardnessAndResistance as float);
myBlockBuilder.withHardnessAndResistance(0.5f);
ParameterTypeDescription
hardnessAndResistancefloatThe 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

Tipo di restituzione: mods.contenttweaker.block.BlockBuilder

myBlockBuilder.withHardnessAndResistance(hardnessIn as float, resistanceIn as float);
myBlockBuilder.withHardnessAndResistance(0.5f, 0.5f);
ParameterTypeDescription
hardnessInfloatThe value to set for hardness
resistanceInfloatThe value to set for resistance.

withHarvestLevel

Sets the mining level required to mine this block

Returns: This builder, used for method chaining

Tipo di restituzione: mods.contenttweaker.block.BlockBuilder

myBlockBuilder.withHarvestLevel(harvestLevel as int);
myBlockBuilder.withHarvestLevel(3);
ParameterTypeDescription
harvestLevelintThe harvest level requried

withHarvestTool

Sets the tool required to harvest this block

Returns: This builder, used for method chaining

Tipo di restituzione: mods.contenttweaker.block.BlockBuilder

myBlockBuilder.withHarvestTool(harvestTool as mods.contenttweaker.item.MCToolType);
myBlockBuilder.withHarvestTool(<tooltype:shovel>);
ParameterTypeDescription
harvestToolmods.contenttweaker.item.MCToolTypeThe tool type

withItemGroup

Sets the item group in which this block will appear

Returns: This builder, used for method chaining

Tipo di restituzione: mods.contenttweaker.block.BlockBuilder

myBlockBuilder.withItemGroup(group as mods.contenttweaker.item.MCItemGroup);
myBlockBuilder.withItemGroup(<itemgroup:building_blocks>);
ParameterTypeDescription
groupmods.contenttweaker.item.MCItemGroupThe group to set

withLightValue

Sets the block's light value.

Returns: This builder, used for method chaining

Tipo di restituzione: mods.contenttweaker.block.BlockBuilder

myBlockBuilder.withLightValue(lightValueIn as int);
myBlockBuilder.withLightValue(15);
ParameterTypeDescription
lightValueInintThe light level to set

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

Tipo di restituzione: mods.contenttweaker.block.BlockBuilder

myBlockBuilder.withLootFrom(blockIn as crafttweaker.api.block.MCBlock);
myBlockBuilder.withLootFrom(<block:minecraft:diamond>);
ParameterTypeDescription
blockIncrafttweaker.api.block.MCBlockThe block whose loot table should be applied

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

Tipo di restituzione: mods.contenttweaker.block.BlockBuilder

myBlockBuilder.withMaxStackSize(size as int);
myBlockBuilder.withMaxStackSize(16);
ParameterTypeDescription
sizeintThe size to set.

withRarity

Allows you to set the rarity of this block.

Returns: This builder, used for method chaining

Tipo di restituzione: mods.contenttweaker.block.BlockBuilder

myBlockBuilder.withRarity(rarity as String);
myBlockBuilder.withRarity("UNCOMMON");
ParameterTypeDescription
rarityStringThe rarity

withSlipperiness

Sets the slipperiness.

Returns: This builder, used for method chaining

Tipo di restituzione: mods.contenttweaker.block.BlockBuilder

myBlockBuilder.withSlipperiness(slipperinessIn as float);
myBlockBuilder.withSlipperiness(0.5f);
ParameterTypeDescription
slipperinessInfloatThe value to set

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

myBlockBuilder.withType<T>();
myBlockBuilder.withType<mods.contenttweaker.block.pillar.BlockBuilderPillarRotatable>();

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

Tipo di restituzione: mods.contenttweaker.block.BlockBuilder

myBlockBuilder.withoutDrops();

withoutMovementBlocking

Instructs CoT that this block will does not block movement.

Returns: This builder, used for chaining

Tipo di restituzione: mods.contenttweaker.block.BlockBuilder

myBlockBuilder.withoutMovementBlocking();