IBlockDefinition

The IBlockDefinition objects provide additional information on blocks.

Importing the package

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.
import crafttweaker.block.IBlockDefinition;

Calling an IBlockDefinition object

Calling an IBlockDefinition List

ZenGetters/ZenSetters

ZenGetter ZenSetter What does it do Type
canSpawnInBlock Returns if an entity can spawn in this block bool
creativeTab creativeTab ICreativeTab
defaultState IBlockState
defaultSlipperiness float
id Returns the block ID string
displayName Returns the block’s DisplayName string
hardness int
harvestLevel Returns the block’s harvest level int
harvestTool Returns the block’s harvest tool string
lightOpacy int
lightLevel int
resistance int
unlocalizedName Returns the block’s unlocalized Name string
tickRandomly tickRandomly bool

ZenMethods

Set Block unbreakable

Uses no paramaeters.
Returns nothing.
Does the same as hardness = -1;

defObj.setUnbreakable();

Get tickrate in a specific world

Uses an IWorld object.
Returns an int.

defObj.getTickRate(IWorld world);

Check if the block can be placed on another block

Uses an IWorld object, an IBlockPos object and, depending on the method used, also an IFacing object.
Returns a bool.

defObj.canPlaceBlockOnSide(IWorld world, IBlockPos pos, IFacing facing);
defObj.canPlaceBlockAt(IWorld world, IBlockPos pos);

Get the block’s slipperiness

Uses an IBlockState, an IBlockAccess object, an IBlockPos and an optional IEntity object.
Returns a float.

defObj.getSlipperiness(IBlockState state, IBlockAccess access, IBlockPos pos, @Optional IEntity entity);

Set the block’s harvest level

Uses a string and an int.
Returns void (nothing).

defObj.setHarvestLevel(string toolclass, int level);