背包物品内容显示

背包物品内容显示

一个用于显示背包、抽屉或任何类似容器内物品的模组

工具

背包显示

为你的背包、潜影盒或其他容器物品添加工具提示,显示其中内容。
可配置如何获取容器物品的内容。
该模组开箱即用地支持原版潜影盒、储物抽屉模组的抽屉以及林业模组的背包。你可以通过在模组配置中编写自定义规则,为更多物品添加支持。

可配置选项(请参阅模组配置):

  • 模组工具提示应显示的物品
  • 工具提示的位置和颜色
  • 可选:按住或松开某个按键来显示工具提示

配置格式

displayRules 是模组的主要配置项。它允许你添加新的容器物品来显示背包工具提示,格式如下:
格式:<模组ID>:<物品ID>[:元数据]#<规则类型>#<规则定义>

元数据为逗号分隔的数值列表,用于匹配物品元数据。
例如,1,2,5-8 允许工具提示显示在元数据为 1、2、5、6、7、8 的物品上。
若元数据缺失,则忽略物品元数据显示工具提示。

规则定义根据选定的规则类型而定。

路径

路径在规则中常用,格式类似于 path.to.the.item
例如,在下方 NBT 结构中:

{"list":[{"key1":"value"},{"key2":"item"}]}

路径 list.1.key2 将从其中获取标签 "item"。

列表规则

规则类型:list

在此规则中,物品都位于一个 NBTTagList 或 NBTTagCompound 之下。

规则定义:path.to.the.list[;path.to.the.itemstack[;path.to.the.counts]]
后两个路径相对于列表中的物品标签。
若 counts 缺失,则使用物品堆叠中的数量。

示例:悬停紫潜影盒时显示内容

minecraft:purple_shulker_box#list#BlockEntityTag.Items

单项规则

规则类型:single

在此规则中,物品位于固定路径下,并附带一个可选的外部数量值。

规则定义:path.to.the.itemstack[;path.to.the.counts[;counts 的计算方式]]
若 counts 缺失,则使用物品堆叠中的数量。

示例:为储物抽屉模组中的每种基础抽屉显示内容

storagedrawers:basicdrawers:0#single#BlockEntityTag.Drawers.0.Item;BlockEntityTag.Drawers.0.Count
storagedrawers:basicdrawers:1,3#single#BlockEntityTag.Drawers.0.Item;BlockEntityTag.Drawers.0.Count
storagedrawers:basicdrawers:1,3#single#BlockEntityTag.Drawers.1.Item;BlockEntityTag.Drawers.1.Count
storagedrawers:basicdrawers:2,4#single#BlockEntityTag.Drawers.0.Item;BlockEntityTag.Drawers.0.Count
storagedrawers:basicdrawers:2,4#single#BlockEntityTag.Drawers.1.Item;BlockEntityTag.Drawers.1.Count
storagedrawers:basicdrawers:2,4#single#BlockEntityTag.Drawers.2.Item;BlockEntityTag.Drawers.2.Count
storagedrawers:basicdrawers:2,4#single#BlockEntityTag.Drawers.3.Item;BlockEntityTag.Drawers.3.Count

若物品的真实数量不能直接从标签中获取,但可通过标签中的数值计算得出,此规则支持进一步的计算。
计算方式为以 +-*/^% 中的运算符开头、后接路径的字符串。计算顺序类似于不能输入表达式的基础计算器。
所有计算均以整数完成。

示例:为储物抽屉模组中的压缩抽屉显示内容

storagedrawers:compdrawers#single#BlockEntityTag.Drawers.Items.0.Item;BlockEntityTag.Drawers.Count;/BlockEntityTag.Drawers.Items.0.Conv
storagedrawers:compdrawers#single#BlockEntityTag.Drawers.Items.1.Item;BlockEntityTag.Drawers.Count;/BlockEntityTag.Drawers.Items.1.Conv
storagedrawers:compdrawers#single#BlockEntityTag.Drawers.Items.2.Item;BlockEntityTag.Drawers.Count;/BlockEntityTag.Drawers.Items.2.Conv