BlockState
Link to blockstate
导入类
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 Copyimport crafttweaker.api.block.BlockState;
Casters
Link to casters
Result Type | 是否隐藏 |
---|---|
Result Type Block | 是否隐藏 true |
Result Type BlockIngredient | 是否隐藏 true |
Result Type string | 是否隐藏 false |
使用方式
Link to 使用方式
Name: asString
Return Type: string
ZenScript Copy// BlockState.asString() as string
<blockstate:minecraft:grass>.asString();
Name: canOcclude
Checks whether this BlockState is solid.
Returns: True if this BlockState is solid. False otherwise.
Return Type: boolean
ZenScript Copy// BlockState.canOcclude() as boolean
<blockstate:minecraft:grass>.canOcclude();
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// BlockState.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: 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// BlockState.getCommandString() as string
<blockstate:minecraft:grass>.getCommandString();
Name: getDestroySpeed
Gets the hardness of this BlockState.
Returns: The hardness of this BlockState.
Return Type: float
ZenScript Copy// BlockState.getDestroySpeed() as float
<blockstate:minecraft:grass>.getDestroySpeed();
Name: getLightEmission
Gets the light level of this BlockState
Returns: The light level of this BlockState.
Return Type: int
ZenScript Copy// BlockState.getLightEmission() as int
<blockstate:minecraft:grass>.getLightEmission();
Name: getProperties
Gets the properties of this BlockState.
Returns: a Map of the properties on this BlockState.
Return Type: string[string]
ZenScript Copy// BlockState.getProperties() as string[string]
<blockstate:minecraft:grass>.getProperties();
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// BlockState.getPropertyNames() as stdlib.List<string>
<blockstate:minecraft:grass>.getPropertyNames();
Name: getPropertyValue
Gets the value of the given property.
Returns: The value of the property on this BlockState.
Return Type: string
ZenScript CopyBlockState.getPropertyValue(name as string) as string
参数 | 类型 | 描述 |
---|---|---|
参数 name(名称) | 类型 string | 描述 "snowy" |
Name: getSoundType
Return Type: SoundType
ZenScript Copy// BlockState.getSoundType() as SoundType
<blockstate:minecraft:grass>.getSoundType();
Name: hasBlockEntity
Checks whether this BlockState has a BlockEntity.
Returns: True if this BlockState has a BlockEntity. False otherwise.
Return Type: boolean
ZenScript Copy// BlockState.hasBlockEntity() as boolean
<blockstate:minecraft:grass>.hasBlockEntity();
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// BlockState.hasProperty(name as string) as boolean
<blockstate:minecraft:grass>.hasProperty("snowy");
参数 | 类型 | 描述 |
---|---|---|
参数 name(名称) | 类型 string | 描述 the name of the property to check. |
Name: isRandomlyTicking
Checks whether this BlockState ticks randomly.
Returns: True if this BlockState ticks randomly. False otherwise.
Return Type: boolean
ZenScript Copy// BlockState.isRandomlyTicking() as boolean
<blockstate:minecraft:grass>.isRandomlyTicking();
Name: isSignalSource
Checks whether this BlockState can provide Redstone Power
Returns: True if this BlockState can provide Redstone Power. False otherwise.
Return Type: boolean
ZenScript Copy// BlockState.isSignalSource() as boolean
<blockstate:minecraft:grass>.isSignalSource();
Name: rotate
Return Type: BlockState
ZenScript CopyBlockState.rotate(rotation as Rotation) as BlockState
参数 | 类型 |
---|---|
参数 rotation | 类型 Rotation |
Name: setDestroySpeed
Sets the destroy speed of this BlockState.
ZenScript Copy// BlockState.setDestroySpeed(destroySpeed as float)
<blockstate:minecraft:grass>.setDestroySpeed(2.4f);
参数 | 类型 | 描述 |
---|---|---|
参数 destroySpeed | 类型 float | 描述 the new destroy speed of this BlockState |
Name: withProperty
Sets a block property based on it's name.
Returns: This BlockState with the new property value.
Return Type: BlockState
ZenScript Copy// BlockState.withProperty(name as string, value as string) as BlockState
<blockstate:minecraft:grass>.withProperty("snowy", "true");
参数 | 类型 | 描述 |
---|---|---|
参数 name(名称) | 类型 string | 描述 The name of the property to set. |
参数 value | 类型 string | 描述 The new value of the property. |
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 block #方块 | 类型 Block | 可获得 true | 可设置 false | 描述 Gets the base Block of this BlockState. The Block will not contain any of the properties of this BlockState. |
名称 canOcclude | 类型 布尔值 | 可获得 true | 可设置 false | 描述 Checks whether this BlockState is solid. |
名称 commandString #命令字符串 | 类型 string | 可获得 true | 可设置 false | 描述 Gets the blockstate bracket handler syntax for this BlockState. E.G. <blockstate:minecraft:grass:snowy=true> |
名称 destroySpeed | 类型 float | 可获得 true | 可设置 true | 描述 Gets the hardness of this BlockState. |
名称 hasBlockEntity | 类型 布尔值 | 可获得 true | 可设置 false | 描述 Checks whether this BlockState has a BlockEntity. |
名称 isRandomlyTicking | 类型 布尔值 | 可获得 true | 可设置 false | 描述 Checks whether this BlockState ticks randomly. |
名称 isSignalSource | 类型 布尔值 | 可获得 true | 可设置 false | 描述 Checks whether this BlockState can provide Redstone Power |
名称 lightEmission | 类型 int | 可获得 true | 可设置 false | 描述 Gets the light level of this BlockState |
名称 properties | 类型 string[string] | 可获得 true | 可设置 false | 描述 Gets the properties of this BlockState. |
名称 propertyNames | 类型 stdlib.List<string> | 可获得 true | 可设置 false | 描述 Gets the names of the properties of this BlockState. |
名称 soundType | 类型 SoundType | 可获得 true | 可设置 false | 描述 |