MCBlockState #MC方块状态

Link to mcblockstate-mc方块状态

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.MCBlockState;
结果类型是否隐藏
结果类型
MCBlock #MC方块
是否隐藏
true
结果类型
string
是否隐藏
false

Link to canBeReplacedByLeaves

Name: canBeReplacedByLeaves

Checks if this BlockState can be replaced by leaves in tree growth.

Return Type: boolean

ZenScript
Copy
// MCBlockState.canBeReplacedByLeaves(world as MCWorld, pos as BlockPos) as boolean

<blockstate:minecraft:grass>.canBeReplacedByLeaves(world, new BlockPos(1, 2, 3));
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState

Link to canBeReplacedByLogs

Name: canBeReplacedByLogs

Checks if this BlockState can be replaced by logs in tree growth.

Return Type: boolean

ZenScript
Copy
// MCBlockState.canBeReplacedByLogs(world as MCWorld, pos as BlockPos) as boolean

<blockstate:minecraft:grass>.canBeReplacedByLogs(world, new BlockPos(1, 2, 3));
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState

Link to canConnectRedstone

Name: canConnectRedstone

Determines if Redstone can connect to this BlockState at the given position and (optional) side.

Returns: True if Redstone can connect to this BlockState. False otherwise.
Return Type: boolean

ZenScript
Copy
MCBlockState.canConnectRedstone(world as MCWorld, pos as BlockPos, side as Direction) as boolean
参数类型描述可选DefaultValue
参数
world
类型
MCWorld
描述
A world object.
可选
false
DefaultValue
参数
类型
BlockPos
描述
The position of the BlockState.
可选
false
DefaultValue
参数
side
类型
Direction
描述
The side to check for.
可选
true
DefaultValue

Link to canCreatureSpawn

Name: canCreatureSpawn

Checks if a specific entity type can spawn on this BlockState at the position in the world.

Returns: True if the entity type can spawn. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.canCreatureSpawn(world as MCWorld, pos as BlockPos, type as PlacementType, entityType as MCEntityType) as boolean

<blockstate:minecraft:grass>.canCreatureSpawn(world, new BlockPos(1, 2, 3), PlacementType.IN_WATER, <entitytype:minecraft:pig>);
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position in the world.
参数
类型
类型
PlacementType
描述
The PlaceMentType to check for.
参数
entityType
类型
MCEntityType #MC实体类型
描述
The EntityType to check for.

Link to canDropFromExplosion

Name: canDropFromExplosion

Checks if the BlockState will drop from the given explosion at the given position.

Returns: True if this BlockState will drop. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.canDropFromExplosion(world as MCWorld, pos as BlockPos, explosion as Explosion) as boolean

<blockstate:minecraft:grass>.canDropFromExplosion(world, new BlockPos(1, 2, 3), Explosiotn.create(world, 1, 2, 3, 5, true, ExplosionMode.BREAK));
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState.
参数
explosion
类型
Explosion
描述
The Explosion to check against.

Link to canEntityDestroy

Name: canEntityDestroy

Determines if this BlockState can be destroyed by the Entity at the specific position.

Returns: True if the entity can destroy the BlockState. False otherwise.
Return Type: boolean

ZenScript
Copy
MCBlockState.canEntityDestroy(world as MCWorld, pos as BlockPos, entity as MCEntity) as boolean
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState.
参数
entity
类型
MCEntity
描述
The Entity that is trying to destroy the BlockState.

Name: canHarvestBlock

Checks whether the player can harvest the BlockState.

Returns: True if the player can harvest the block. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.canHarvestBlock(world as MCWorld, pos as BlockPos, player as MCPlayerEntity) as boolean

<blockstate:minecraft:grass>.canHarvestBlock(world, new BlockPos(1, 2, 3), player);
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position to check at.
参数
player
类型
MCPlayerEntity #MC玩家实体
描述
The player that is trying to harvest the block.

Name: canProvidePower

Checks whether this BlockState can provide Redstone Power

Returns: True if this BlockState can provide Redstone Power. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.canProvidePower() as boolean

<blockstate:minecraft:grass>.canProvidePower();

Name: canStickTo

Checks if this BlockState can stick to the other BlockState when pushed by a piston.

Returns: True if the BlockStatess stick when pushed by a piston. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.canStickTo(other as MCBlockState) as boolean

<blockstate:minecraft:grass>.canStickTo(<blockstate:minecraft:grass>);
参数类型描述
参数
other
类型
MCBlockState #MC方块状态
描述
The BlockState check if it will stick against.

Link to getAllowedValuesForProperty

Name: getAllowedValuesForProperty

Gets a list of allowed values for a given property.

Returns: a List of allowed values.
Return Type: stdlib.List<string>

ZenScript
Copy
// MCBlockState.getAllowedValuesForProperty(name as string) as stdlib.List<string>

<blockstate:minecraft:grass>.getAllowedValuesForProperty("snowy");
参数类型描述
参数
name(名称)
类型
string
描述
The name of the property to find the allowed values for.

Name: getBedDirection

Gets the direction of the bed. This can be called on any BlockState that has the HORIZONTAL_FACING property, not just beds.

The game WILL crash if you call this on a blockstate that doesn't have the property, so make sure you check it before calling it!

Return Type: void

ZenScript
Copy
// MCBlockState.getBedDirection(world as MCWorld, pos as BlockPos) as void

<blockstate:minecraft:grass>.getBedDirection(world, new BlockPos(1, 2, 3));
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState

Link to getCommandString

Name: getCommandString

Gets the blockstate bracket handler syntax for this BlockState.

E.G. blockstate:minecraft:grass:snowy=true

Returns: The blockstate bracket handler syntax for this BlockState.
Return Type: string

ZenScript
Copy
// MCBlockState.getCommandString() as string

<blockstate:minecraft:grass>.getCommandString();

Name: getExpDrop

Returns how much Experience this BlockState will drop when broken.

Returns: The amount of Experience that will drop when this BlockState is broken.
Return Type: int

ZenScript
Copy
// MCBlockState.getExpDrop(world as MCWorld, pos as BlockPos, fortune as int, silktouch as int) as int

<blockstate:minecraft:grass>.getExpDrop(world, new BlockPos(1, 2, 3), 1, 0);
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState.
参数
fortune
类型
int
描述
The fortune level of the tool being used to break the block.
参数
silktouch
类型
int
描述
The silktouch level of the tool being used to break the block. This will most likely either be 0 or 1.

Link to getExplosionResistance

Name: getExplosionResistance

Gets the explosion resistance of the BlockState in the world for the given Explosion

Returns: The amount of the explosion that is absorbed.
Return Type: float

ZenScript
Copy
// MCBlockState.getExplosionResistance(world as MCWorld, pos as BlockPos, explosion as Explosion) as float

<blockstate:minecraft:grass>.getExplosionResistance(world, new BlockPos(1, 2, 3), Explosiotn.create(world, 1, 2, 3, 5, true, ExplosionMode.BREAK));
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState
参数
explosion
类型
Explosion
描述
The explosion object to check against.

Link to getFireSpreadSpeed

Name: getFireSpreadSpeed

Determines how fast fire spreads from this block. The higher the number the faster that fire will spread around the BlockState.

Returns: The spread speed of the BlockState.
Return Type: int

ZenScript
Copy
MCBlockState.getFireSpreadSpeed(world as MCWorld, pos as BlockPos, face as Direction) as int
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState.
参数
face
类型
Direction
描述
The face that the fire is coming from.

Name: getFlammability

Gets the chance that fire will spread and consume this BlockState.

Values range from 0 - 300.

A value of 300 is a 100% chance, and 0 is a 0% chance.

Returns: A number between 0 and 300 dictating how flammable this BlockState is.
Return Type: int

ZenScript
Copy
// MCBlockState.getFlammability(world as MCWorld, pos as BlockPos, face as Direction) as int

<blockstate:minecraft:grass>.getFlammability(world, new BlockPos(1, 2, 3), Direction.south);
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState.
参数
face
类型
Direction
描述
The face that the fire is coming from.

Name: getHardness

Gets the hardness of this BlockState.

Returns: The hardness of this BlockState.
Return Type: float

ZenScript
Copy
// MCBlockState.getHardness() as float

<blockstate:minecraft:grass>.getHardness();

Name: getHarvestLevel

Gets the harvest level of this BlockState.

Returns: The harvest level of this BlockState.
Return Type: int

ZenScript
Copy
// MCBlockState.getHarvestLevel() as int

<blockstate:minecraft:grass>.getHarvestLevel();

Name: getHarvestTool

Gets the ToolType of this BlockState.

Returns: The ToolType of this BlockState.
Return Type: ToolType?

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

<blockstate:minecraft:grass>.getHarvestTool();

Name: getLightLevel

Gets the light level of this BlockState

Returns: The light level of this BlockState.
Return Type: int

ZenScript
Copy
// MCBlockState.getLightLevel() as int

<blockstate:minecraft:grass>.getLightLevel();

Name: getLightValue

Gets the light value of the BlockState at the given position.

Returns: The light value of the BlockState at the position.
Return Type: int

ZenScript
Copy
// MCBlockState.getLightValue(world as MCWorld, pos as BlockPos) as int

<blockstate:minecraft:grass>.getLightValue(world, new BlockPos(1, 2, 3));
参数类型描述
参数
world
类型
MCWorld
描述
A world Object.
参数
类型
BlockPos
描述
The position to check the light value of.

Name: getProperties

Gets the properties of this BlockState.

Returns: a Map of the properties on this BlockState.
Return Type: string[string]

ZenScript
Copy
// MCBlockState.getProperties() as string[string]

<blockstate:minecraft:grass>.getProperties();

Link to getPropertyNames

Name: getPropertyNames

Gets the names of the properties of this BlockState.

Returns: the List of the names of the BlockStates's properties.
Return Type: stdlib.List<string>

ZenScript
Copy
// MCBlockState.getPropertyNames() as stdlib.List<string>

<blockstate:minecraft:grass>.getPropertyNames();

Link to getPropertyValue

Name: getPropertyValue

Gets the value of the given property.

Returns: The value of the property on this BlockState.
Return Type: string

ZenScript
Copy
MCBlockState.getPropertyValue(name as string) as string
参数类型描述
参数
name(名称)
类型
string
描述
"snowy"

Name: getSlipperiness

Gets the slipperiness of the BlockState at the given location for the given entity (if one is given)

Returns: The slipperiness of the BlockState at the given BlockPos for the Entity.
Return Type: float

ZenScript
Copy
// MCBlockState.getSlipperiness(world as MCWorld, pos as BlockPos, entity as MCEntity) as float

<blockstate:minecraft:grass>.getSlipperiness(world, new Blockpos(0,0,0);, entity);
参数类型描述可选DefaultValue
参数
world
类型
MCWorld
描述
A world object.
可选
false
DefaultValue
参数
类型
BlockPos
描述
The position to check at.
可选
false
DefaultValue
参数
entity
类型
MCEntity
描述
The entity to work with.
可选
true
DefaultValue

Name: hasProperty

Checks whether this BlockState has the given property.

Returns: True if this BlockState has the property. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.hasProperty(name as string) as boolean

<blockstate:minecraft:grass>.hasProperty("snowy");
参数类型描述
参数
name(名称)
类型
string
描述
the name of the property to check.

Name: hasTileEntity

Checks whether this BlockState has a MCTileEntity.

Returns: True if this BlockState has a MCTileEntity. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.hasTileEntity() as boolean

<blockstate:minecraft:grass>.hasTileEntity();

Name: isBed

Determines if the block can be used to sleep.

Returns: True if the block allows sleeping.
Return Type: boolean

ZenScript
Copy
// MCBlockState.isBed(world as MCWorld, pos as BlockPos, sleeper as MCLivingEntity) as boolean

<blockstate:minecraft:grass>.isBed(world, new BlockPos(1, 2, 3), entity);
参数类型描述可选DefaultValue
参数
world
类型
MCWorld
描述
A world object.
可选
false
DefaultValue
参数
类型
BlockPos
描述
The position to check at.
可选
false
DefaultValue
参数
sleeper
类型
MCLivingEntity
描述
The Living Entity that is trying to sleep.
可选
true
DefaultValue

Name: isBurning

Checks if the BlockState is burning at the given position.

Returns: True if the BlockState is burning a the given position.
Return Type: boolean

ZenScript
Copy
// MCBlockState.isBurning(world as MCWorld, pos as BlockPos) as boolean

<blockstate:minecraft:grass>.isBurning(world, new BlockPos(1, 2, 3));
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState.

Name: isConduitFrame

Determines if this BlockState can be used as the frame of a Conduit.

Returns: True if this BlockState can be used as a Conduit frame.
Return Type: boolean

ZenScript
Copy
// MCBlockState.isConduitFrame(world as MCWorld, pos as BlockPos, conduitPosition as BlockPos) as boolean

<blockstate:minecraft:grass>.isConduitFrame(world, new BlockPos(1, 2, 3), new BlockPos(1, 5, 3));
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState.
参数
conduitPosition
类型
BlockPos
描述
The Position of the Conduit.

Name: isFertile

Checks if the BlockState is "fertile" at the given position.

This will only ever return true if the BlockState is in the <tag:blocks:minecraft:farmland> tag and if it has the moisture state.

The game WILL crash if you call this on a blockstate that doesn't have the property, so make sure you check it before calling it!

Returns: True if the BlockState is Fertile. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.isFertile(world as MCWorld, pos as BlockPos) as boolean

<blockstate:minecraft:grass>.isFertile(world, new BlockPos(1, 2, 3));
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState

Name: isFireSource

Checks if this BlockState is a fire source at the given position with the fire coming from the given direciton.

Returns: True if this BlockState is a fire source. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.isFireSource(world as MCWorld, pos as BlockPos, side as Direction) as boolean

<blockstate:minecraft:grass>.isFireSource(world, new BlockPos(1, 2, 3), Direction.east);
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState.
参数
side
类型
Direction
描述
The face that the fire is coming form.

Name: isFlammable

Checks if this BlockState is flammable at the given position with the fire coming from the given direciton.

Returns: True if the BlockState if flammable. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.isFlammable(world as MCWorld, pos as BlockPos, face as Direction) as boolean

<blockstate:minecraft:grass>.isFlammable(world, new BlockPos(1, 2, 3), Direction.east);
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState.
参数
face
类型
Direction
描述
The face that the fire is coming from.

Name: isLadder

Checks if a Living Entity can use this block to climb like a ladder.

Returns: True if the entity can climb the block. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.isLadder(world as MCWorld, pos as BlockPos, entity as MCLivingEntity) as boolean

<blockstate:minecraft:grass>.isLadder(world, new BlockPos(1, 2, 3), entity);
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position to check at.
参数
entity
类型
MCLivingEntity
描述
The entity that wants to climb the block.

Name: isPortalFrame

Determins if this BlockState can be used as the frame of a Nether portal.

Returns: True if this BlockState can be used as a Nether portal frame. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.isPortalFrame(world as MCWorld, pos as BlockPos) as boolean

<blockstate:minecraft:grass>.isPortalFrame(world, new BlockPos(1, 2, 3));
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the Blockstate.

Name: isScaffolding

Checks if the entity should handle movement on this BlockState like it handles movement on scaffolding.

Returns: True if this BlockState should act like scaffolding. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.isScaffolding(entity as MCLivingEntity) as boolean

<blockstate:minecraft:grass>.isScaffolding(entity);
参数类型描述
参数
entity
类型
MCLivingEntity
描述
The entity that is being checked against.

Name: isSlime

Checks if this BlockState is a Slime Block.

Returns: True if this BlockState is Slime. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.isSlime() as boolean

<blockstate:minecraft:grass>.isSlime();

Name: isSolid

Checks whether this BlockState is solid.

Returns: True if this BlockState is solid. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.isSolid() as boolean

<blockstate:minecraft:grass>.isSolid();

Name: isSticky

Checks if this BlockState is sticky.

This is used to determine if the block should pull or push adjacent blocks when pushed / pulled by a piston. For example, Slime Blocks are sticky blocks.

Returns: True if this BlockState is Sticky. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.isSticky() as boolean

<blockstate:minecraft:grass>.isSticky();

Name: isToolEffective

Checks if the given ToolType is effective against this BlockState.

Returns: True if the ToolType is effective. False otherwise.
Return Type: boolean

ZenScript
Copy
MCBlockState.isToolEffective(tool as ToolType) as boolean
参数类型描述
参数
tool
类型
ToolType
描述
The ToolType to check for.

Name: setBedOccupied

Marks the block as "occupied", this is only supported on blocks that have the "occupied" BlockState property.

The game WILL crash if you call this on a blockstate that doesn't have the property, so make sure you check it before calling it!

Return Type: void

ZenScript
Copy
// MCBlockState.setBedOccupied(world as MCWorld, pos as BlockPos, sleeper as MCLivingEntity, occupied as boolean) as void

<blockstate:minecraft:grass>.setBedOccupied(world, new BlockPos(1, 2, 3), livingEntity, true);
参数类型描述
参数
world
类型
MCWorld
描述
A world object.
参数
类型
BlockPos
描述
The position of the BlockState.
参数
sleeper
类型
MCLivingEntity
描述
The LivingEntity that is occupying the bed.
参数
occupied
类型
布尔值
描述
If the bed is occupied or not.

Name: setHardness

Sets the hardness of this BlockState.

Return Type: void

ZenScript
Copy
// MCBlockState.setHardness(hardness as float) as void

<blockstate:minecraft:grass>.setHardness(2.4f);
参数类型描述
参数
hardness
类型
float
描述
the new hardness of this BlockState

Name: ticksRandomly

Checks whether this BlockState ticks randomly.

Returns: True if this BlockState ticks randomly. False otherwise.
Return Type: boolean

ZenScript
Copy
// MCBlockState.ticksRandomly() as boolean

<blockstate:minecraft:grass>.ticksRandomly();

Name: withProperty

Sets a block property based on it's name.

Returns: This BlockState with the new property value.
Return Type: MCBlockState

ZenScript
Copy
// MCBlockState.withProperty(name as string, value as string) as MCBlockState

<blockstate:minecraft:grass>.withProperty("snowy", "true");
参数类型描述
参数
name(名称)
类型
string
描述
The name of the property to set.
参数
value
类型
string
描述
The new value of the property.
名称类型可获得可设置描述
名称
block #方块
类型
MCBlock #MC方块
可获得
true
可设置
false
描述
Gets the base MCBlock of this BlockState.

The MCBlock will not contain any of the properties of this BlockState.
名称
canProvidePower #可提供能量(应该是指红石之类的)
类型
布尔值
可获得
true
可设置
false
描述
Checks whether this BlockState can provide Redstone Power
名称
commandString #命令字符串
类型
string
可获得
true
可设置
false
描述
Gets the blockstate bracket handler syntax for this BlockState.

E.G.

blockstate:minecraft:grass:snowy=true
名称
hardness
类型
float
可获得
true
可设置
true
描述
Gets the hardness of this BlockState.
名称
harvestLevel
类型
int
可获得
true
可设置
false
描述
Gets the harvest level of this BlockState.
名称
harvestTool
类型
ToolType?
可获得
true
可设置
false
描述
Gets the ToolType of this BlockState.
名称
hasTileEntity #具有方块实体
类型
布尔值
可获得
true
可设置
false
描述
Checks whether this BlockState has a MCTileEntity.
名称
isSlime
类型
布尔值
可获得
true
可设置
false
描述
Checks if this BlockState is a Slime Block.
名称
isSolid #是否为固体
类型
布尔值
可获得
true
可设置
false
描述
Checks whether this BlockState is solid.
名称
isSticky #是否具有粘性
类型
布尔值
可获得
true
可设置
false
描述
Checks if this BlockState is sticky.

This is used to determine if the block should pull or push adjacent blocks when pushed / pulled by a piston.
For example, Slime Blocks are sticky blocks.
名称
lightLevel #光照级别
类型
int
可获得
true
可设置
false
描述
Gets the light level of this BlockState
名称
propertyNames
类型
stdlib.List<string>
可获得
true
可设置
false
描述
Gets the names of the properties of this BlockState.
名称
ticksRandomly #是否具有随机刻
类型
布尔值
可获得
true
可设置
false
描述
Checks whether this BlockState ticks randomly.