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
- Using the
definition
ZenGetter on an IBlock object.
Calling an IBlockDefinition List
- Using
game.blocks
to get a list of all block definition in the game.
ZenGetters/ZenSetters
ZenGetter | ZenSetter | What does it do | Type |
---|---|---|---|
ZenGetter canSpawnInBlock | ZenSetter | What does it do Returns true if an entity can spawn in this block | Type bool |
ZenGetter creativeTab | ZenSetter creativeTab | What does it do | Type ICreativeTab |
ZenGetter defaultState | ZenSetter | What does it do | Type IBlockState |
ZenGetter | ZenSetter defaultSlipperiness | What does it do | Type float |
ZenGetter id | ZenSetter | What does it do Returns the block ID | Type string |
ZenGetter displayName | ZenSetter | What does it do Returns the block’s DisplayName | Type string |
ZenGetter hardness | ZenSetter hardness | What does it do | Type int |
ZenGetter harvestLevel | ZenSetter | What does it do Returns the block’s harvest level | Type int |
ZenGetter harvestTool | ZenSetter | What does it do Returns the block’s harvest tool | Type string |
ZenGetter lightOpacity | ZenSetter lightOpacity | What does it do | Type int |
ZenGetter lightLevel | ZenSetter lightLevel | What does it do | Type int |
ZenGetter resistance | ZenSetter resistance | What does it do | Type int |
ZenGetter unlocalizedName | ZenSetter | What does it do Returns the block’s unlocalized Name | Type string |
ZenGetter tickRandomly | ZenSetter tickRandomly | What does it do | Type bool |
ZenMethods
Set Block unbreakable
Uses no paramaeters.
Returns nothing.
Does the same as hardness = -1;
Get tickrate in a specific world
Uses an IWorld object.
Returns an int.
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.
Get the block’s slipperiness
Uses an IBlockState, an IBlockAccess object, an IBlockPos and an optional IEntity object.
Returns a float.
Set the block’s harvest level
Uses a string, an int and an optional IBlockState.
if the IBlockState argument is ignored, it will set harvest level to all block states in the block definition.
Returns void (nothing).
Get harvest level of block state
returns an int.
Get harvest tool of block state
returns a string.
Get light opacity of block state
returns a float.
Get light level of block state
returns a float.
Get explosion resistance of block position and explosion
returns a float.
Get a block state by metadata
Uses an int.
Returns an IBlockState.
Block effective for the tool
Uses a string and an IBlockState.
Returns a bool.