2.3 KiB
2.3 KiB
sidebarDepth
| sidebarDepth |
|---|
| 1 |
属性
GetBlockBasicInfo
服务端
method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
-
描述
获取方块基本信息
-
参数
参数名 数据类型说明 blockName str 方块identifier -
返回值
数据类型说明 dict 方块基本信息字典 -
备注
- 基本信息字典中部分字段只在自定义方块时加上指定组件才会取到数据,具体见方块基本信息字典
-
示例
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
blockDict = comp.GetBlockBasicInfo("minecraft:stone")
SetBlockBasicInfo
服务端
method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer
-
描述
设置方块基本信息
-
参数
参数名 数据类型说明 blockName str 方块identifier infoDict dict 方块的方块基本信息字典 auxValue int 方块附加值,默认是0 -
返回值
数据类型说明 bool 设置是否成功 -
备注
- 目前本接口支持的属性有 destroyTime:硬度;explosionResistance:爆炸抗性;loot:掉落属性;tier:挖掘属性;solid:是否实心;当方块json配置里有对应的组件才能修改
-
示例
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
blockDict = comp.SetBlockBasicInfo("minecraft:stone", {"blockLightEmission":1,
"blockLightAbsorption":1,
"solid":False,
"tier":{"level":3}})