IBlockDefinition

Link to iblockdefinition

Объекты IBlockDefinition предоставляют дополнительную информацию о блоках.

Импорт пакета

Link to импорт-пакета

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;

Получение объекта IBlockDefinition

Link to получение-объекта-iblockdefinition

  • Воспользуйтесь геттером definition от объекта IBlock.

Получение списка объектов IBlockDefinition

Link to получение-списка-объектов-iblockdefinition

  • Воспользуйтесь геттером game.blocks, чтобы получить все определения блоков в игре.

Геттеры/сеттеры

Link to геттерысеттеры

ZenGetterZenSetterWhat does it doТип
ZenGetter
canSpawnInBlock
ZenSetter
What does it do
Returns true if an entity can spawn in this block
Тип
bool
ZenGetter
creativeTab
ZenSetter
creativeTab
What does it do
Тип
ICreativeTab
ZenGetter
defaultState
ZenSetter
What does it do
Тип
IBlockState
ZenGetter
ZenSetter
defaultSlipperiness
What does it do
Тип
float
ZenGetter
id
ZenSetter
What does it do
Возвращает ID блока
Тип
string
ZenGetter
displayName
ZenSetter
What does it do
Возвращает отображаемое имя блока
Тип
string
ZenGetter
hardness
ZenSetter
hardness
What does it do
Тип
int
ZenGetter
harvestLevel
ZenSetter
What does it do
Возвращает уровень добычи блока
Тип
int
ZenGetter
harvestTool
ZenSetter
What does it do
Возвращает инструмент для добычи этого блока
Тип
string
ZenGetter
lightOpacity
ZenSetter
lightOpacity
What does it do
Тип
int
ZenGetter
lightLevel
ZenSetter
lightLevel
What does it do
Тип
int
ZenGetter
resistance
ZenSetter
resistance
What does it do
Тип
int
ZenGetter
unlocalizedName
ZenSetter
What does it do
Возвращает нелокализованное имя блока
Тип
string
ZenGetter
tickRandomly
ZenSetter
tickRandomly
What does it do
Тип
bool

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

ZenScript
Copy
defObj.setUnbreakable();

Uses an IWorld object.
Returns an int.

ZenScript
Copy
defObj.getTickRate(IWorld world);

canPlaceBlockAt, canPlaceBlockOnSide

Link to canplaceblockat-canplaceblockonside

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

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

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

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

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).

ZenScript
Copy
defObj.setHarvestLevel(string toolclass, int level, @Optional IBlockState state);

Get harvest level of block state

Link to get-harvest-level-of-block-state

returns an int.

ZenScript
Copy
defObj.getHarvestLevel(IBlockState state);

Get harvest tool of block state

Link to get-harvest-tool-of-block-state

returns a string.

ZenScript
Copy
defObj.getHarvestTool(IBlockState state);

Get light opacity of block state

Link to get-light-opacity-of-block-state

returns a float.

ZenScript
Copy
defObj.getLightOpacity(IBlockState state);
defObj.getLightOpacity(IBlockState state, IWorld world, IBlockPos pos);

Get light level of block state

Link to get-light-level-of-block-state

returns a float.

ZenScript
Copy
defObj.getLightLevel(IBlockState state);
defObj.getLightLevel(IBlockState state, IWorld world, IBlockPos pos);

Get explosion resistance of block position and explosion

Link to get-explosion-resistance-of-block-position-and-explosion

returns a float.

ZenScript
Copy
defObj.getResistance(IWorld world, IBlockPos pos, IEntity entity, IExplosion explosion);

Get a block state by metadata

Link to get-a-block-state-by-metadata

Uses an int.
Returns an IBlockState.

ZenScript
Copy
defObj.getStateFromMeta(int meta);

Block effective for the tool

Link to block-effective-for-the-tool

Uses a string and an IBlockState.
Returns a bool.

ZenScript
Copy
defObj.isToolEffective(String type, IBlockState state);