# 属性

# 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")

# GetLoadBlocks

服务端

method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer

  • 描述

    获取已经加载的方块id

  • 参数

  • 返回值

    数据类型
    说明
    List 方块id列表
  • 示例

import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
suc = comp.GetLoadBlocks()

# 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}})

# SetChestLootTable

服务端

method in mod.server.component.blockInfoCompServer.BlockInfoComponentServer

  • 描述

    设置箱子战利品表

  • 参数

    参数名
    数据类型
    说明
    blockPos tuple(int,int,int) 方块的坐标
    dimensionId int 方块所在的维度
    lootTable str 战利品表位置字符串,如"loot_tables/entities/zombie.json"
    isIgnoreSpilt bool 是否屏蔽随机分堆,默认为False
  • 返回值

    数据类型
    说明
    bool 是否设置成功
  • 备注

    • 仅支持未打开过的箱子,若箱子已经打开过,则设置失败
    • 维度需要已经加载。如有玩家在相应维度上,则算维度已加载,若完全没玩家在对应维度上,则维度未加载
    • 末影箱仍是箱子的一种,但是末影箱本身并不直接存储物品。因此虽然设置战利品表返回成功,实际在打开末影箱时,并不会用到战利品表!
  • 示例

import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)
suc = comp.SetChestLootTable(blockPos, dimensionId, lootTable)

GetBlockBasicInfo

GetLoadBlocks

SetBlockBasicInfo

SetChestLootTable