MCBlock

Importing the class

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;

Casters

Result typeIs Implicit
MCItemDefinitionfalse
stringfalse

Methods

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.

Return Type: MCItemDefinition

ZenScript
Copy
// MCBlock.asItem() as MCItemDefinition

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

Checks if entities can collide with this Block.

Return Type: boolean

ZenScript
Copy
// MCBlock.canCollide() as boolean

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

Checks if an entity can be spawned inside this Block.

This is used to find valid spawn locations for players.

Return Type: boolean

ZenScript
Copy
// MCBlock.canSpawnInBlock() as boolean

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

Gets the blast resistance of this Block.

Return Type: float

ZenScript
Copy
// MCBlock.getBlastResistance() as float

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

Gets the block bracket handler syntax for this Block.

E.G. block:minecraft:dirt

Return Type: string

ZenScript
Copy
// MCBlock.getCommandString() as string

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

Gets the default MCBlockState of this Block.

Return Type: MCBlockState

ZenScript
Copy
// MCBlock.getDefaultState() as MCBlockState

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

Gets the jump factor of this Block.

Return Type: float

ZenScript
Copy
// MCBlock.getJumpFactor() as float

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

Gets the loot table id for this Block.

Return Type: string

ZenScript
Copy
// MCBlock.getLootTable() as string

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

Gets the material of this Block.

Return Type: MCMaterial

ZenScript
Copy
// MCBlock.getMaterial() as MCMaterial

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

Gets the registry name of this block.

Return Type: MCResourceLocation

ZenScript
Copy
// MCBlock.getRegistryName() as MCResourceLocation

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

Gets the slipperiness of this Block.

Return Type: float

ZenScript
Copy
// MCBlock.getSlipperiness() as float

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

Gets the speed factor of this Block.

Return Type: float

ZenScript
Copy
// MCBlock.getSpeedFactor() as float

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

Gets all the 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();
getTranslationKey

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

Return Type: string

ZenScript
Copy
// MCBlock.getTranslationKey() as string

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

Gets 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();
isInTag

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

Return Type: boolean

ZenScript
Copy
MCBlock.isInTag(tag as MCTag<MCBlock>) as boolean
ParameterTypeDescription
tagMCTag<MCBlock>The MCTag<T> to check against.
isVariableOpacity

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

Return Type: boolean

ZenScript
Copy
// MCBlock.isVariableOpacity() as boolean

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

Checks whether this Block matches another Block.

Return Type: boolean

ZenScript
Copy
MCBlock.matchesBlock(other as MCBlock) as boolean
ParameterTypeDescription
otherMCBlockThe other Block to check if this Block matches.
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);
ParameterTypeDescription
resistancefloatThe new blast resistance of this Block.
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);
ParameterTypeDescription
canCollidebooleanCan entities collide with this Block.
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);
ParameterTypeDescription
jumpFactorfloatThe new jump factor of this Block.
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>);
ParameterTypeDescription
materialMCMaterialThe new material of this Block.
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);
ParameterTypeDescription
slipperinessfloatThe new slipperiness of this Block.
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);
ParameterTypeDescription
speedFactorfloatThe new speed factor of this Block.

Properties

NameTypeHas GetterHas SetterDescription
blastResistancefloattruetrueGets the blast resistance of this Block.
canCollidebooleantruetrueChecks if entities can collide with this Block.
commandStringstringtruefalseGets the block bracket handler syntax for this Block.

E.G.

block:minecraft:dirt
defaultStateMCBlockStatetruefalseGets the default MCBlockState of this Block.
jumpFactorfloattruetrueGets the jump factor of this Block.
lootTablestringtruefalseGets the loot table id for this Block.
materialMCMaterialtruetrueGets the material of this Block.
registryNameMCResourceLocationtruefalseGets the registry name of this block.
slipperinessfloattruetrueGets the slipperiness of this Block.
speedFactorfloattruetrueGets the speed factor of this Block.
tagsstdlib.List<MCTag<MCBlock>>truefalseGets all the MCTag<T>s that contain this Block.
translationKeystringtruefalseGets the translation key that is used to localize this Block.
validStatesstdlib.List<MCBlockState>truefalseGets a list of valid MCBlockStates for this Block.
variableOpacitybooleantruefalseChecks if the opacity of this block is different in different areas of the Block.