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

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.block.Block;
Result TypeЯвляется неявным
Result Type
BlockIngredient
Является неявным
true
Result Type
ItemDefinition
Является неявным
false
Result Type
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: ItemDefinition

ZenScript
Copy
// Block.asItem() as ItemDefinition

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

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
// Block.getCommandString() as string

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

Name: getDefaultState

Gets the default BlockState of this Block.

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

ZenScript
Copy
// Block.getDefaultState() as BlockState

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

Link to getDescriptionId

Name: getDescriptionId

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

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

ZenScript
Copy
// Block.getDescriptionId() as string

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

Link to getExplosionResistance

Name: getExplosionResistance

Gets the blast resistance of this Block.

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

ZenScript
Copy
// Block.getExplosionResistance() as float

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

Name: getFriction

Gets the friction of this Block.

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

ZenScript
Copy
// Block.getFriction() as float

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

Name: getJumpFactor

Gets the jump factor of this Block.

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

ZenScript
Copy
// Block.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
// Block.getLootTable() as string

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

Name: getMaterial

Gets the material of this Block.

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

ZenScript
Copy
// Block.getMaterial() as Material

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

Name: getName

Gets the name of this Block

Returns: The name of this block.
Return Type: MutableComponent

ZenScript
Copy
// Block.getName() as MutableComponent

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

Link to getPossibleStates

Name: getPossibleStates

Gets a list of valid BlockStates for this Block.

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

ZenScript
Copy
// Block.getPossibleStates() as stdlib.List<BlockState>

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

Name: getRegistryName

Gets the registry name of this block.

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

ZenScript
Copy
// Block.getRegistryName() as ResourceLocation

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

Name: getSpeedFactor

Gets the speed factor of this Block.

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

ZenScript
Copy
// Block.getSpeedFactor() as float

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

Name: hasCollision

Checks if entities can collide with this Block.

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

ZenScript
Copy
// Block.hasCollision() as boolean

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

Name: hasDynamicShape

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
// Block.hasDynamicShape() as boolean

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

Link to isPossibleToRespawnInThis

Name: isPossibleToRespawnInThis

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
// Block.isPossibleToRespawnInThis() as boolean

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

Name: matches

Checks whether this Block matches another Block.

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

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

Link to setExplosionResistance

Name: setExplosionResistance

Sets the blast resistance of this Block.

ZenScript
Copy
// Block.setExplosionResistance(resistance as float)

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

Name: setFriction

Sets the friction of this Block.

ZenScript
Copy
// Block.setFriction(friction as float)

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

Name: setHasCollision

Sets whether entities can collide with this Block.

ZenScript
Copy
// Block.setHasCollision(canCollide as boolean)

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

Name: setJumpFactor

Sets the jump factor of this Block.

ZenScript
Copy
// Block.setJumpFactor(jumpFactor as float)

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

Name: setMaterial

Sets the material of this Block.

ZenScript
Copy
// Block.setMaterial(material as Material)

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

Name: setSpeedFactor

Sets the speed factor of this Block.

ZenScript
Copy
// Block.setSpeedFactor(speedFactor as float)

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

Свойства

Link to свойства

НазваниеТипИмеет GetterИмеет SetterОписание
Название
commandString
Тип
string
Имеет Getter
true
Имеет Setter
false
Описание
Gets the block bracket handler syntax for this Block.

E.G.
<block:minecraft:dirt>
Название
defaultState
Тип
BlockState
Имеет Getter
true
Имеет Setter
false
Описание
Gets the default BlockState of this Block.
Название
descriptionId
Тип
string
Имеет Getter
true
Имеет Setter
false
Описание
Gets the translation key that is used to localize this Block.
Название
dynamicShape
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Checks if the opacity of this block is different in different areas of the Block.
Название
explosionResistance
Тип
float
Имеет Getter
true
Имеет Setter
true
Описание
Gets the blast resistance of this Block.
Название
friction
Тип
float
Имеет Getter
true
Имеет Setter
true
Описание
Gets the friction of this Block.
Название
hasCollision
Тип
boolean
Имеет Getter
true
Имеет Setter
true
Описание
Checks if entities can collide with this Block.
Название
isPossibleToRespawnInThis
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Checks if an entity can be spawned inside this Block.

This is used to find valid spawn locations for players.
Название
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
Тип
Material
Имеет Getter
true
Имеет Setter
true
Описание
Gets the material of this Block.
Название
name
Тип
MutableComponent
Имеет Getter
true
Имеет Setter
false
Описание
Gets the name of this Block
Название
possibleStates
Тип
stdlib.List<BlockState>
Имеет Getter
true
Имеет Setter
false
Описание
Gets a list of valid BlockStates for this Block.
Название
registryName
Тип
ResourceLocation
Имеет Getter
true
Имеет Setter
false
Описание
Gets the registry name of this block.
Название
speedFactor
Тип
float
Имеет Getter
true
Имеет Setter
true
Описание
Gets the speed factor of this Block.