BlockLimiter 配置

基本信息

属性 值
实现类 com.github.namikon.blocklimiter.config.BlockLimiterConfig
基类 eu.usrv.yamcore.config.ConfigManager
配置目录 config/GTNewHorizons/blocklimiter/(MODID=blocklimiter、COLLECTIONNAME=GTNewHorizons)

字段列表

BlockList (String[])

  • 默认值:{}(空)
  • 段:[Main]
  • 描述:定义需要限制放置的方块。
  • 语法:[modID]:[BlockID];[DimID];...
    • 仅 [modID]:[BlockID] 表示所有维度都禁止。
    • ;[DimID] 后追加维度号,仅在该维度禁止。
  • 解析:每条通过 BlockInfo(pBlockConfig) 构造时按 ; 分割,得到 [modID]:[BlockName] 与维度号列表。

ItemList (String[])

  • 默认值:{}(空)
  • 段:[Main]
  • 描述:定义需要限制使用的物品。
  • 语法:[modID]:[ItemID];[DimID];...(同 BlockList)
  • 解析:通过 ItemInfo(pItemConfig) 解析;ItemDescriptor.fromString(spec, true) 必须返回非 null,否则忽略。

RejectMessages (String[])

  • 默认值(5 条):

    "You can't place that here"
    "You are too jelly to place this"
    "The block doesn't want to be here"
    "YOU SHALL NOT PLACE (this Block)"
    "*poof*"
    
  • 段:[Main]

  • 描述:方块放置被拒绝时随机发送给玩家的消息。

ItemRejectMessages (String[])

  • 默认值(4 条):

    "You can't use that here"
    "You are too jelly to use this"
    "The item seems to be broken..."
    "YOU SHALL NOT USE (this Item)"
    
  • 段:[Main]

  • 描述:物品使用被拒绝时随机发送给玩家的消息。

PlaySFXOnBlockDeny (String)

  • 默认值:minecraft:ambient.weather.thunder
  • 段:[main]
  • 描述:拒绝放置时播放的音效;留空表示静音;语法 [modID]:[soundeffectID]。

PlaySFXOnItemDeny (String)

  • 默认值:minecraft:ambient.weather.thunder
  • 段:[main]
  • 描述:拒绝使用物品时播放的音效;语法同 PlaySFXOnBlockDeny。

DenyCreativeMode (boolean)

  • 默认值:false
  • 段:[main]
  • 描述:设为 true 时,连创造模式玩家也会被拦截;默认仅限制生存/冒险模式玩家。

配置加载流程

preInit → PreInit() 初始化默认值 + 空列表
load   → Init()    读取配置项
postInit → PostInit() → InitDefinedBlocks() + InitDefinedItems()
reload  → Reload() → load() → Init() → InitDefinedBlocks() + InitDefinedItems()

InitDefinedBlocks / InitDefinedItems 在解析单条出错(如方块在 GameRegistry 不存在、ItemDescriptor.fromString 失败)时会跳过该条目并继续,整体返回 false 让上层报告重载失败,但已成功解析的条目仍然会替换列表。

解析失败行为

失败类型 行为
BlockInfo 解析时方块不在 GameRegistry 警告日志 can't be found in the Gameregistry and will be ignored
BlockInfo 语法错误(少于 mod:block 字段) 警告日志 is invalid and will be ignored
ItemInfo 解析时 ItemDescriptor.fromString 返回 null 警告日志 ItemDefinition … is invalid and will be ignored
任意解析异常 错误日志 An error occoured while parsing line X and therfor it will be ignored + 栈跟踪

相关条目