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). To tell CoT that you want the block to appear ingame you need to call this#build(String) and specify a valid resource location path.

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 at the very top of the file.

import mods.contenttweaker.block.BlockBuilder;

Implemented Interfaces

BlockBuilder implements the following interfaces. That means all methods defined in these interfaces are also available in BlockBuilder

Constructors

Creates a new BlockBuilder. Remember that this will not create a new block in the game, you need to call this#build(String) for that.

new BlockBuilder(material as MCMaterial) as BlockBuilder
new BlockBuilder(<blockmaterial:earth>);
ParameterTypeDescriptionOptionalDefaultValue
materialMCMaterialThe material this block will havetrueblockmaterial:iron

Methods

notSolid

Instructs CoT that this block is not solid.

This is required if your model is not a full block (16x16x16). It is also required if your model is see-through (like glass). Set this if your block creates some X-Ray effects when it's placed.

Return Type: BlockBuilder

BlockBuilder.notSolid() as BlockBuilder
myBlockBuilder.notSolid();

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.

Return Type: BlockBuilder

BlockBuilder.withHardnessAndResistance(hardnessAndResistance as float) as BlockBuilder
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.

Return Type: BlockBuilder

BlockBuilder.withHardnessAndResistance(hardnessIn as float, resistanceIn as float) as BlockBuilder
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

Return Type: BlockBuilder

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

withHarvestTool

Sets the tool required to harvest this block

Return Type: BlockBuilder

BlockBuilder.withHarvestTool(harvestTool as MCToolType) as BlockBuilder
myBlockBuilder.withHarvestTool(<tooltype:shovel>);
ParameterTypeDescription
harvestToolMCToolTypeThe tool type

withItemGroup

Sets the item group in which this block will appear

Return Type: BlockBuilder

BlockBuilder.withItemGroup(group as MCItemGroup) as BlockBuilder
myBlockBuilder.withItemGroup(<itemgroup:building_blocks>);
ParameterTypeDescription
groupMCItemGroupThe group to set

withLightValue

Sets the block's light value.

Return Type: BlockBuilder

BlockBuilder.withLightValue(lightValueIn as int) as BlockBuilder
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.

Return Type: BlockBuilder

BlockBuilder.withLootFrom(blockIn as MCBlock) as BlockBuilder
myBlockBuilder.withLootFrom(<block:minecraft:diamond>);
ParameterTypeDescription
blockInMCBlockThe 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.

Return Type: BlockBuilder

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

withRarity

Allows you to set the rarity of this block.

Return Type: BlockBuilder

BlockBuilder.withRarity(rarity as string) as BlockBuilder
myBlockBuilder.withRarity("UNCOMMON");
ParameterTypeDescription
raritystringThe rarity

withSlipperiness

Sets the slipperiness.

Return Type: BlockBuilder

BlockBuilder.withSlipperiness(slipperinessIn as float) as BlockBuilder
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.

Return Type: T

BlockBuilder.withType<T : BlockTypeBuilder>() as T
ParameterTypeDescription
TBlockTypeBuilderThe Type of block that this should become

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.

Return Type: BlockBuilder

BlockBuilder.withoutDrops() as BlockBuilder
myBlockBuilder.withoutDrops();

withoutMovementBlocking

Instructs CoT that this block will does not block movement. Will also set the block as this#notSolid()

Return Type: BlockBuilder

BlockBuilder.withoutMovementBlocking() as BlockBuilder
myBlockBuilder.withoutMovementBlocking();