An IBlock Object consists of a IBlockDefinition, a metadata and a TileData.
It refers to a block in the game.

Importing the package

Link to 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.IBlock;

Calling an IBlock Object

Link to calling-an-iblock-object

There are multiple ways thet return an IBlock object:

  • Casting a IItemStack as IBlock (using the AS keyword, or the asBlock() method)
  • Using the getBlock(x,y,z) on an IWorld.
  • Using getBlock() on ContentTweaker's ICTBlockState

Attention : Seule la seconde méthode est possible pour données ZenGetter de retourner un IData nonnull !

GetterWhat does it doReturn Type
Getter
definition
What does it do
Returns the Block's definition
Return Type
IBlockDefinition
Getter
meta
What does it do
Returns the Block's metadata
Return Type
int
Getter
data
What does it do
Returns the Block's tileData
Return Type
IData
Getter
fluid
What does it do
Returns the Block's fluid
Return Type
ILiquidDefinition

Les IBlocks étendent objets IBlockPattern. Cela signifie que toutes les fonctions disponibles pour les objets IBlockPattern peuvent également être utilisées pour les objets IBlock :

  • Use the blocks ZenGetter
  • OR'ing
  • Matching using the in keyword
  • Use the displayName ZenGetter