Импорт класса

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

ZenScript
Copy
import crafttweaker.api.blocks.MCBlock;
Тип результатаЯвляется неявным
Тип результата
MCItemDefinition
Является неявным
false
Тип результата
string
Является неявным
false

Name: asItem

Gets the Item representation of this Block.

NOTE: Not all Blocks have Items, for instance, a Lit Redstone Lamp does not have an Item.

Returns: The Item representation of this Block.
Return Type: MCItemDefinition

ZenScript
Copy
// MCBlock.asItem() as MCItemDefinition

<block:minecraft:grass_block>.asItem();

Name: canCollide

Checks if entities can collide with this Block.

Returns: True if entities will collide with this Block. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlock.canCollide() as boolean

<block:minecraft:grass_block>.canCollide();

Name: canSpawnInBlock

Checks if an entity can be spawned inside this Block.

This is used to find valid spawn locations for players.

Returns: True if an entity can be spawned in this Block. False Otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlock.canSpawnInBlock() as boolean

<block:minecraft:grass_block>.canSpawnInBlock();

Link to getBlastResistance

Name: getBlastResistance

Gets the blast resistance of this Block.

Returns: The blast resistance of this Block.
Return Type: float

ZenScript
Copy
// MCBlock.getBlastResistance() as float

<block:minecraft:grass_block>.getBlastResistance();

Link to getCommandString

Name: getCommandString

Gets the block bracket handler syntax for this Block.

E.G. block:minecraft:dirt

Returns: The block bracket handler syntax for this Block.
Return Type: string

ZenScript
Copy
// MCBlock.getCommandString() as string

<block:minecraft:grass_block>.getCommandString();

Name: getDefaultState

Gets the default MCBlockState of this Block.

Returns: The default MCBlockState of this Block.
Return Type: MCBlockState

ZenScript
Copy
// MCBlock.getDefaultState() as MCBlockState

<block:minecraft:grass_block>.getDefaultState();

Name: getHarvestLevel

Gets the harvest level for this Block.

NOTE: This will get the level for the default blockstate, you should use the BlockState specific method for a more accurate result!

Returns: The harvest tool for this Block.
Return Type: int

ZenScript
Copy
// MCBlock.getHarvestLevel() as int

<block:minecraft:grass_block>.getHarvestLevel();

Name: getHarvestTool

Gets the harvest tool for this Block.

NOTE: This will get the tool for the default blockstate, you should use the BlockState specific method for a more accurate result!

Returns: The harvest tool for this Block.
Return Type: ToolType?

ZenScript
Copy
// MCBlock.getHarvestTool() as ToolType?

<block:minecraft:grass_block>.getHarvestTool();

Name: getJumpFactor

Gets the jump factor of this Block.

Returns: The jump factor of this Block.
Return Type: float

ZenScript
Copy
// MCBlock.getJumpFactor() as float

<block:minecraft:grass_block>.getJumpFactor();

Name: getLootTable

Gets the loot table id for this Block.

Returns: The loot table id for this Block.
Return Type: string

ZenScript
Copy
// MCBlock.getLootTable() as string

<block:minecraft:grass_block>.getLootTable();

Name: getMaterial

Gets the material of this Block.

Returns: The material of this Block.
Return Type: MCMaterial

ZenScript
Copy
// MCBlock.getMaterial() as MCMaterial

<block:minecraft:grass_block>.getMaterial();

Name: getRegistryName

Gets the registry name of this block.

Returns: A ResourceLocation of the registry name of this block.
Return Type: MCResourceLocation

ZenScript
Copy
// MCBlock.getRegistryName() as MCResourceLocation

<block:minecraft:grass_block>.getRegistryName();

Name: getSlipperiness

Gets the slipperiness of this Block.

Returns: The Slipperiness of this Block.
Return Type: float

ZenScript
Copy
// MCBlock.getSlipperiness() as float

<block:minecraft:grass_block>.getSlipperiness();

Name: getSpeedFactor

Gets the speed factor of this Block.

Returns: The speed factor of this Block.
Return Type: float

ZenScript
Copy
// MCBlock.getSpeedFactor() as float

<block:minecraft:grass_block>.getSpeedFactor();

Name: getTags

Gets all the MCTag<T>s that contain this Block.

Returns: a List of MCTag<T>s that contain this Block.
Return Type: stdlib.List<MCTag<MCBlock>>

ZenScript
Copy
// MCBlock.getTags() as stdlib.List<MCTag<MCBlock>>

<block:minecraft:grass_block>.getTags();

Link to getTranslationKey

Name: getTranslationKey

Gets the translation key that is used to localize this Block.

Returns: The unlocalized name of this block.
Return Type: string

ZenScript
Copy
// MCBlock.getTranslationKey() as string

<block:minecraft:grass_block>.getTranslationKey();

Name: getValidStates

Gets a list of valid MCBlockStates for this Block.

Returns: A list of valid MCBlockStates for this Block.
Return Type: stdlib.List<MCBlockState>

ZenScript
Copy
// MCBlock.getValidStates() as stdlib.List<MCBlockState>

<block:minecraft:grass_block>.getValidStates();

Name: isInTag

Checks if this Block is in the given MCTag<T>.

Returns: True if this Block is in the MCTag<T>. False otherwise.
Return Type: boolean

ZenScript
Copy
MCBlock.isInTag(tag as MCTag<MCBlock>) as boolean
ПараметрТипОписание
Параметр
tag
Тип
MCTag<MCBlock>
Описание
The MCTag<T> to check against.

Link to isVariableOpacity

Name: isVariableOpacity

Checks if the opacity of this block is different in different areas of the Block.

Returns: True if this Block has variable opacity. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlock.isVariableOpacity() as boolean

<block:minecraft:grass_block>.isVariableOpacity();

Name: matchesBlock

Checks whether this Block matches another Block.

Returns: True if this Block matches the other Block. False otherwise.
Return Type: boolean

ZenScript
Copy
MCBlock.matchesBlock(other as MCBlock) as boolean
ПараметрТипОписание
Параметр
other
Тип
MCBlock
Описание
The other Block to check if this Block matches.

Link to setBlastResistance

Name: setBlastResistance

Sets the blast resistance of this Block.

Return Type: void

ZenScript
Copy
// MCBlock.setBlastResistance(resistance as float) as void

<block:minecraft:grass_block>.setBlastResistance(2);
ПараметрТипОписание
Параметр
resistance
Тип
float
Описание
The new blast resistance of this Block.

Name: setCanCollide

Sets whether entities can collide with this Block.

Return Type: void

ZenScript
Copy
// MCBlock.setCanCollide(canCollide as boolean) as void

<block:minecraft:grass_block>.setCanCollide(true);
ПараметрТипОписание
Параметр
canCollide
Тип
boolean
Описание
Can entities collide with this Block.

Name: setHarvestLevel

Sets the harvest level for this Block.

Return Type: void

ZenScript
Copy
// MCBlock.setHarvestLevel(level as int) as void

<block:minecraft:grass_block>.setHarvestLevel(2);
ПараметрТипОписание
Параметр
level
Тип
int
Описание
the new harvest level.

Name: setHarvestTool

Sets the harvest tool for this Block.

Return Type: void

ZenScript
Copy
// MCBlock.setHarvestTool(type as ToolType?) as void

<block:minecraft:grass_block>.setHarvestTool(<tooltype:axe>);
ПараметрТипОписание
Параметр
type
Тип
ToolType?
Описание
The new tooltype.

Name: setJumpFactor

Sets the jump factor of this Block.

Return Type: void

ZenScript
Copy
// MCBlock.setJumpFactor(jumpFactor as float) as void

<block:minecraft:grass_block>.setJumpFactor(2);
ПараметрТипОписание
Параметр
jumpFactor
Тип
float
Описание
The new jump factor of this Block.

Name: setMaterial

Sets the material of this Block.

Return Type: void

ZenScript
Copy
// MCBlock.setMaterial(material as MCMaterial) as void

<block:minecraft:grass_block>.setMaterial(<blockmaterial:earth>);
ПараметрТипОписание
Параметр
material
Тип
MCMaterial
Описание
The new material of this Block.

Name: setSlipperiness

Sets the slipperiness of this Block.

Return Type: void

ZenScript
Copy
// MCBlock.setSlipperiness(slipperiness as float) as void

<block:minecraft:grass_block>.setSlipperiness(2);
ПараметрТипОписание
Параметр
slipperiness
Тип
float
Описание
The new slipperiness of this Block.

Name: setSpeedFactor

Sets the speed factor of this Block.

Return Type: void

ZenScript
Copy
// MCBlock.setSpeedFactor(speedFactor as float) as void

<block:minecraft:grass_block>.setSpeedFactor(2);
ПараметрТипОписание
Параметр
speedFactor
Тип
float
Описание
The new speed factor of this Block.

Свойства

Link to свойства

НазваниеТипИмеет GetterИмеет SetterОписание
Название
blastResistance
Тип
float
Имеет Getter
true
Имеет Setter
true
Описание
Gets the blast resistance of this Block.
Название
canCollide
Тип
boolean
Имеет Getter
true
Имеет Setter
true
Описание
Checks if entities can collide with this Block.
Название
commandString
Тип
string
Имеет Getter
true
Имеет Setter
false
Описание
Gets the block bracket handler syntax for this Block.

E.G.

block:minecraft:dirt
Название
defaultState
Тип
MCBlockState
Имеет Getter
true
Имеет Setter
false
Описание
Gets the default MCBlockState of this Block.
Название
harvestLevel
Тип
int
Имеет Getter
true
Имеет Setter
true
Описание
Gets the harvest level for this Block.

NOTE:
This will get the level for the default blockstate, you should use the BlockState specific method for a more accurate result!
Название
harvestTool
Тип
ToolType?
Имеет Getter
true
Имеет Setter
true
Описание
Gets the harvest tool for this Block.

NOTE:
This will get the tool for the default blockstate, you should use the BlockState specific method for a more accurate result!
Название
jumpFactor
Тип
float
Имеет Getter
true
Имеет Setter
true
Описание
Gets the jump factor of this Block.
Название
lootTable
Тип
string
Имеет Getter
true
Имеет Setter
false
Описание
Gets the loot table id for this Block.
Название
material
Тип
MCMaterial
Имеет Getter
true
Имеет Setter
true
Описание
Gets the material of this Block.
Название
registryName
Тип
Расположение MCResource-ресурсов
Имеет Getter
true
Имеет Setter
false
Описание
Gets the registry name of this block.
Название
slipperiness
Тип
float
Имеет Getter
true
Имеет Setter
true
Описание
Gets the slipperiness of this Block.
Название
speedFactor
Тип
float
Имеет Getter
true
Имеет Setter
true
Описание
Gets the speed factor of this Block.
Название
tags
Тип
stdlib.List<MCTag<MCBlock>>
Имеет Getter
true
Имеет Setter
false
Описание
Gets all the MCTag<T>s that contain this Block.
Название
translationKey
Тип
string
Имеет Getter
true
Имеет Setter
false
Описание
Gets the translation key that is used to localize this Block.
Название
validStates
Тип
stdlib.List<MCBlockState>
Имеет Getter
true
Имеет Setter
false
Описание
Gets a list of valid MCBlockStates for this Block.
Название
variableOpacity
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Checks if the opacity of this block is different in different areas of the Block.