Rogue Loot(原名 Lootable Blocks)
引入了一种类似 Roguelike 的战利品选择系统,允许玩家从多个选项中挑选奖励。
奖励选项可以包含多种不同类型,例如物品、状态效果、进度等。
玩家可以重新掷骰以刷新选项,禁止特定奖励再次出现,或将奖励保留以便在重新掷骰后再次出现。
整个系统是数据驱动的,所有内容均通过数据包/资源包进行配置。
所有数据驱动功能的示例可在 GitHub 上的测试模组文件中找到:
如何生成 Rogue Loot 战利品表
Rogue Loot 战利品表可以通过多种方式提供给玩家。
方块交互
Rogue Loot Vault Block(Rogue Loot 宝箱块)
该方块外观与原版 Vault Block(宝库方块)相似,行为也几乎完全一致。主要区别在于,它不会在世界中生成奖励,而是为交互的玩家生成一个 Rogue Loot Table(Rogue Loot 战利品表)。
方块配置是数据驱动的,类似于原版 Vault Block。
结构如下:
- "loot_table_identifier":可选的标识符字段,默认为空。提供的 Rogue Loot Table 的标识符。
- "loot_table_mode":可选的字符串字段,默认为 "rogue_loot"。Rogue Loot 宝箱的模式。目前 "rogue_loot" 是唯一有效的选项,此选项的存在是为了与其他模组的集成。
- "rolls":必需的整数字段,默认为 3。
- "min_choices":必需的整数字段,默认为 1。
- "max_choices":必需的整数字段,默认为 1。必须 >= "min_choices"。
- "activation_range":必需的双精度浮点数字段,默认为 4.0。
- "deactivation_range":必需的双精度浮点数字段,默认为 4.5。必须 >= "activation_range"。
- "key_item":必需的 ItemStack 字段,默认为 {"id": "minecraft:trial_key","count": 1}。
- "display_loot_table_identifier":可选的标识符字段,默认为空。显示用战利品表的标识符。
/give 命令示例:
/give @s rogueloot:rogue_loot_vault_block[block_state={ominous:"false"},block_entity_data={id:"rogueloot:rogue_loot_vault_block",config_identifier:"rogueloot_test:test"}]
Interactive Rogue Loot Block(交互式 Rogue Loot 方块)
这是一个专为地图制作者和服务器管理员设计的方块,位于创造模式下的“操作员物品”标签页中。
与其交互会打开配置界面(当玩家处于创造模式且拥有游戏管理员权限级别时),可以在其中设置多项配置选项。
在生存模式或冒险模式下与其交互时,该方块会根据其设置提供 rogue/vanilla 战利品表。
物品交互
当使用带有 "rogueloot:supply_rogue_loot_on_use" 数据组件的物品时,系统会向玩家提供一个 Rogue Loot 战利品表。具体规格由该组件设定。
/give 命令示例:
/give @s minecraft:stick[rogueloot:supply_rogue_loot_on_use={"rogue_loot_table_identifier":"rogueloot_test:test","saving_token":"test","rolls":5,"min_choices":1,"max_choices":2,"consume":true}]
命令
"/rogue_loot" 命令允许(除其他功能外)向玩家提供 Rogue Loot 战利品表。
示例:
/rogue_loot roll_rogue_loot_table @s rogueloot_test:test saving_token 3 1 1 show_success_message
可选功能
禁止 (Banishing)
如果 Rogue Loot Table 启用了此功能,则条目可以被禁止。被禁止的条目将不再出现在任何包含该条目的新生成的 Rogue Loot Table 中。已经被禁止的条目无法在已经生成的 Rogue Loot Table 选项中被选中。根据客户端配置选项,被禁止的条目要么隐藏,要么可见但不可交互。条目也可以定义为不可禁止。
禁止机制对每个玩家独立生效。
如果启用了禁止功能,UI 中会出现一个新按钮,用于切换“禁止模式”。在此模式下,点击某个条目将禁止该条目并退出禁止模式。再次点击该按钮也会退出禁止模式。
禁止功能可以选择性地消耗物品。在这种情况下,当条目被禁止时,成本会从背包中扣除。按钮上会显示当前可用的禁止次数。
"/rogue_loot" 命令允许(取消)禁止条目。使用命令不需要消耗物品,但需要游戏管理员权限级别。
示例:
/rogue_loot banish_entry @s rogueloot_test:test
/rogue_loot reset @s banished_entries rogueloot_test:test
重掷 (Rerolling)
如果 Rogue Loot Table 启用了此功能,则可以重掷。如果启用,UI 中会出现一个新按钮。重掷时会考虑当前所有已被禁止和已保留的条目。
重掷机制对每个玩家独立生效。
重掷功能可以选择性地消耗物品。在这种情况下,当 Rogue Loot Table 被重掷时,成本会从背包中扣除。按钮上会显示当前可用的重掷次数。
当生成 Rogue Loot Table 时,条目会被保存,以防止玩家仅通过退出 Rogue Loot 屏幕来阻止重掷。
由方块提供的 Rogue Loot Table 由方块本身保存。
由物品或命令提供的 Rogue Loot Table 作为玩家数据存储。可以使用命令重置这些数据。
数据组件和用于生成 Rogue Loot Table 的命令都提供了一个 "saving_token"(保存令牌)。这是一个简单的字符串,用于与 Rogue Loot Table 标识符一起识别已生成的 Rogue Loot Table。这允许多个物品提供相同的 Rogue Loot Table 而互不影响。
重置命令也使用此保存令牌。
示例:
/rogue_loot reset @s generated_entries rogueloot_test:test saving_token
保留 (Reserving)
如果由 Rogue Loot Table 启用,Table Entries(表格条目)可以被预留。它们现在保证会出现在任何包含此条目的新生成的 Rogue Loot Table 中。已预留的条目不再能在已经生成过的 Rogue Loot Table 选项中被选择。根据客户端配置选项,预留的 Table Entries 要么被隐藏,要么可见但不可交互。当预留的 Table Entries 出现在新生成的 Rogue Loot Table 中时,它将不再处于预留状态。可以定义某些 Table Entries 为不可预留。
预留机制对每个玩家独立生效。
如果启用了预留功能,UI 中会出现一个新按钮,用于切换“预留模式”。在此模式下,点击某个 Table Entry 即可预留该条目并退出预留模式。再次点击该按钮也会退出预留模式。
预留可选地具有物品消耗。在这种情况下,当预留一个 Table Entry 时,会从库存中扣除相应的消耗品。按钮上会显示当前可用的预留次数。
/rogue_loot 命令允许(取消)预留 Table Entries。使用命令不会消耗任何物品,但需要游戏管理员权限级别。
示例:
/rogue_loot reserve_entry @s rogueloot_test:test
/rogue_loot reset @s reserved_entries rogueloot_test:test
使用次数限制
Table Entries 可以定义使用次数限制。当它们被选中时,其使用计数器增加 1。如果使用次数达到上限,则该条目将不再出现在新生成的 Rogue Loot Tables 中。已达到使用次数上限的条目,在已经生成的 Rogue Loot Table 选项中也不再能被选择。
每个玩家对于每个条目都有各自的使用计数器。
具有使用次数限制的条目会在其工具提示中显示剩余可用次数。
/rogue_loot 命令允许增加/减少 Table Entries 的使用次数。这需要游戏管理员权限级别。
示例:
/rogue_loot use_entry @s rogueloot_test:test
/rogue_loot reset @s entry_uses rogueloot_test:test
永久条目
Table Entries 可以是永久的。这些条目将始终出现在包含它们的任何 Rogue Loot Tables 中。然而,这仅在以下条件下成立:条目根据其解锁谓词(unlock predicate)已解锁、未达到其使用次数上限且未被放逐。
完全重置
还有一个命令可以重置所有内容。这基本上只是一个快捷方式,使用上述各个命令可以实现相同的效果。
/rogue_loot reset @s everything
如何创建 Rogue Loot Tables?
Rogue Loot Tables 是数据驱动的,这意味着它们使用数据包进行定义。
Rogue Loot Table 的某些部分本身也是数据驱动的。
Rogue Loot Table
每次生成 Rogue Loot Table 时,会根据权重随机选择 n 个 Table Entries(生成数量由 Rogue Loot Table 供应商决定)。权重较高的条目更有可能被选中。条目的默认权重为 1。在一次生成过程中,每个条目只能被选择一次。
然后玩家必须选择一些条目(最少和最多选择数量由 Rogue Loot Table 供应商决定)。
关闭屏幕并从同一来源重新打开不会重新生成选项。
路径:
data/<your_namespace>/rogue_loot/table/<your_rogue_loot_table>.json
结构:
Rogue Loot Table Interaction
这是一个仅由 Rogue Loot Tables 使用的子数据结构。当存在时,它会在 Rogue Loot 屏幕上启用可选机制。它还可以可选地为这些机制定义物品消耗。
结构:
- "cost",一个可选的物品堆栈字段,默认为空。定义为了使用由此交互启用的机制而必须支付的物品堆栈。
GUI Settings
GUI Settings 由 Rogue Loot Tables 引用。它们定义了几种外观特性,完全是可选的。
路径:
data/<your_namespace>/rogue_loot/gui_settings/<your_table_gui_settings>.json
结构:
"background_texture_path",一个可选的字符串字段,默认为 ""。该字符串描述了 Rogue Loot Screen 背景纹理的路径。
"entries_asset_path_addition",一个可选的字符串字段,默认为 ""。该字符串会被添加到 Table Entry 按钮的背景纹理路径中。
"reroll_requirements_not_met",一个可选的 Label Settings 字段,默认为空。当玩家无法支付重掷成本时,修改 “Reroll” 按钮的标签文本。
"reroll_requirements_met",一个可选的 Label Settings 字段,默认为空。当玩家可以支付重掷成本时,修改 “Reroll” 按钮的标签文本。
"enable_banishing_requirements_not_met",一个可选的 Label Settings 字段,默认为空。当驱逐功能当前未激活且玩家无法支付驱逐成本时,修改 “Banish” 按钮的标签文本。
"enable_banishing_requirements_met",一个可选的 Label Settings 字段,默认为空。当驱逐功能当前未激活且玩家可以支付驱逐成本时,修改 “Banish” 按钮的标签文本。
"disable_banishing",一个可选的 Label Settings 字段,默认为空。当驱逐功能当前已激活时,修改 “Banish” 按钮的标签文本。
"enable_reserving_requirements_not_met",一个可选的 Label Settings 字段,默认为空。当预留功能当前未激活且玩家无法支付预留成本时,修改 “Reserve” 按钮的标签文本。
"enable_reserving_requirements_met",一个可选的 Label Settings 字段,默认为空。当预留功能当前未激活且玩家可以支付预留成本时,修改 “Reserve” 按钮的标签文本。
"disable_reserving",一个可选的 Label Settings 字段,默认为空。当预留功能当前已激活时,修改 “Reserve” 按钮的标签文本。
"confirmation_requirements_not_met",一个可选的 Label Settings 字段,默认为空。当选中的条目数量不足时,修改 “Confirm Choices” 按钮的标签文本。
"confirmation_requirements_met",一个可选的 Label Settings 字段,默认为空。当选中的条目数量足够时,修改 “Confirm Choices” 按钮的标签文本。
Table Entry
Table Entry 由 Rogue Loot Tables 引用。它们定义了单独的奖励选项。
在 Rogue Loot Screen 上,每个 Table Entry 都由一个按钮表示。该按钮允许玩家选择对应的条目。具体的交互方式如上所述。
每种不同的按钮状态都对应不同的按钮纹理。默认情况下,这些纹理位于此处(请参阅 GitHub 上的源代码):
assets/rogueloot/textures/gui/sprites/widgets/loot_option_button/<specific_texture_name>.png
然而,Rogue Loot Table 的 GUI 设置以及条目的稀有度可能会影响纹理路径,从而允许基于 GUI 设置和/或稀有度使用自定义纹理。
如果 GUI 设置和 Entry Rarity 都设置了相应的字段,则纹理路径如下所示:
assets/rogueloot/textures/gui/sprites/widgets/loot_option_button/<entries_asset_path_addition>/<asset_path_addition>/<specific_texture_name>.png
"entries_asset_path_addition" 是 GUI 设置中的字段,而 "asset_path_addition" 是 Entry Rarity 中的字段。如果其中一个字段缺失或为空,则会被忽略。
请注意,“/” 不是这些字段的一部分。不允许在这些字符串的开头或结尾使用 “/”。允许在中间放置 “/”,这将对应文件路径中的一个额外文件夹。
路径:
data/<your_namespace>/rogue_loot/table_entry/<your_table_entry>.json
结构:
"unlock_predicate",一个可选的 Context Aware Predicate 字段,默认为空。检查该条目是否已解锁。
"component",一个必需的 Entry Component 字段。定义此条目提供的奖励。
"display",一个可选的 Entry Display 字段,默认为空。
"tooltip",一个可选的 Entry Tooltip 字段,默认为空。
"rarity_identifier",一个可选的标识符字段,默认为空。定义此 Table Entry 使用的 Entry Rarity。
"use_limit",一个可选的 int 字段,默认为 0。定义在选择该条目使其变为不可用之前,可以选择的次数。
"allow_banishing",一个可选的 boolean 字段,默认为 true。定义该条目是否可以被驱逐。
"allow_reserving",一个可选的 boolean 字段,默认为 true。定义该条目是否可以被预留。
"is_permanent",一个可选的 boolean 字段,默认为 false。定义该条目是否为永久性的。
Entry Display
这是一个仅由 Table Entries 使用的子数据结构。它定义了表示此 Table Entry 的按钮上显示的内容。
结构:
"display_stack",一个可选的 Item Stack 字段,默认为空。与 "icon_texture_identifier" 字段不兼容。
"icon_texture_identifier",一个可选的 Identifier 字段,默认为空。与 "display_stack" 字段不兼容。
"label_text",一个可选的字符串字段,默认为 ""。定义此 Table Entry 使用的 Entry Rarity。(注:原文此处描述可能有误,通常 label_text 应定义标签文本,但根据指令需忠实翻译原文内容)
Entry Tooltip
这是一个仅由 Table Entries 使用的子数据结构。它定义了表示此 Table Entry 的按钮上显示的内容。(注:原文标题为 Tooltip,但描述文字重复了 Entry Display 的部分,按原文翻译)
结构:
"display_stack",一个可选的 Item Stack 字段,默认为空。与 "icon_texture_identifier" 字段不兼容。
"tooltip_label_lines",一个可选的字符串列表,默认为空。定义此 Table Entry 使用的 Entry Rarity。(注:原文此处描述可能有误,通常 tooltip_label_lines 应定义提示框的行文,但根据指令需忠实翻译原文内容)
Entry Rarity
每个 Table Entry 都可以引用一个 Entry Rarity。这些主要用于外观装饰,但它们还根据权重系统定义 Table Entry 呈现给玩家的频率。
路径:
data/<your_namespace>/rogue_loot/entry_rarity/<your_entry_rarity>.json
结构:
- "asset_path_addition",可选字符串字段,默认为空字符串。此字符串会被添加到“表条目”按钮的背景纹理路径中。
- "weight",可选整数字段,默认为 1。覆盖该“表条目”的权重。
- "weight_modifier",可选 受属性影响的整数修饰符 字段,默认为空。用于修改权重值。
- "banished_label",可选 标签设置 字段,默认为空。当条目被放逐时,修改该条目的文本标签。
- "default_label",可选 标签设置 字段,默认为空。当其他情况均不成立时,修改该条目的文本标签。
- "reserved_label",可选 标签设置 字段,默认为空。当条目被预留时,修改该条目的文本标签。
- "selected_label",可选 标签设置 字段,默认为空。当条目被选中时,修改该条目的文本标签。
- "tooltip_style",可选标识符字段,默认为空。定义提示框样式(背景纹理 + 边框)。
条目组件
一个“表条目”定义了一项奖励,当玩家选择该条目时,该项奖励将发放给玩家。这些奖励被称为“条目组件”,它们有多种可能的类型。这些类型在 Java 代码中定义,但可以通过数据驱动字段进行进一步自定义。
组件类型:
- "rogueloot:add_experience_level",增加指定数量的经验等级
- "rogueloot:add_experience_point",增加指定数量的经验值
- "rogueloot:advancement_criterion",授予指定进度指定的标准
- "rogueloot:banish_rogue_loot_table_entries",放逐指定的“表条目”(标签)
- "rogueloot:deal_damage",以指定的伤害类型对玩家造成指定数量的伤害
- "rogueloot:heal_to_x_percent",将玩家的生命值设置为指定百分比
- "rogueloot:heal_x_amount",为玩家恢复指定数量的生命值
- "rogueloot:item_stack",将指定的物品堆加入玩家的背包(若无空间则掉落至地面)
- "rogueloot:list",授予所有指定的“条目组件”
- "rogueloot:mob_effect_instance",应用指定的生物效果实例,并尊重指定的叠加模式
- 如果未指定叠加模式,则调用原版功能(例如 onEffectUpdated())
- 叠加模式可以是以下之一:
- "none",移除现有的效果实例(如果存在),然后应用新的效果实例
- "amplifier",移除现有的效果实例(如果存在),然后应用新的效果实例,但将现有实例的放大器级别相加
- "duration",移除现有的效果实例(如果存在),然后应用新的效果实例,但将现有实例的持续时间相加
- "both",移除现有的效果实例(如果存在),然后应用新的效果实例,但将现有实例的放大器级别和持续时间相加
- "rogueloot:modify_equipment",将指定的战利品物品函数列表应用于指定装备槽位中的所有物品(可按条件筛选)
- "rogueloot:play_sound",在玩家位置播放指定的声音
- "rogueloot:random_components",从一组“条目组件”列表中随机发放一项奖励,每个组件都有各自的权重。
- "rogueloot:reserve_rogue_loot_table_entries",预留指定的“表条目”(标签)
- "rogueloot:set_experience_level",将玩家的 experience level 设置为指定数量
- "rogueloot:set_experience_point",将玩家的 experience points 设置为指定数量
- "rogueloot:unbanish_rogue_loot_table_entries",取消放逐指定的“表条目”(标签)
- "rogueloot:unreserve_rogue_loot_table_entries",取消预留指定的“表条目”(标签)
- "rogueloot:unuse_rogue_loot_table_entries",移除指定“表条目”(标签)的一次使用次数(可选择移除所有使用次数)
- "rogueloot:use_rogue_loot_table_entries",为指定的“表条目”(标签)增加一次使用次数
- "rogueloot:vanilla_loot_table",掷骰指定的原版战利品表,并将物品加入玩家的背包(若无空间则掉落至地面)
第三方模组可以轻松地添加组件类型。Rogue Loot 还添加了几个依赖于第三方模组的组件类型。
Mana Attributes(法力属性):
- "rogueloot:compat/manaattributes/add_mana",增加指定数量的法力
- "rogueloot:compat/manaattributes/set_mana",将玩家的法力设置为指定百分比
Pufferfish 的技能:
- "rogueloot:compat/puffish_skills/add_experience_level",向指定类别增加指定数量的经验等级
- "rogueloot:compat/puffish_skills/add_experience",向指定类别增加指定数量的经验值
- "rogueloot:compat/puffish_skills/add_points",将指定点来源的指定数量技能点添加到指定类别中,可选择是否显示公告
- "rogueloot:compat/puffish_skills/lock_category",锁定指定类别
- "rogueloot:compat/puffish_skills/lock_skill",锁定指定类别中的指定技能
- "rogueloot:compat/puffish_skills/set_experience_level",将玩家在指定类别中的经验等级设置为指定数值
- "rogueloot:compat/puffish_skills/set_experience",将玩家在指定类别中的经验值设置为指定数值
- "rogueloot:compat/puffish_skills/set_points",将玩家在指定类别中来自指定点来源的技能点设置为指定数值,可选择是否显示公告
- "rogueloot:compat/puffish_skills/unlock_category",解锁指定类别
- "rogueloot:compat/puffish_skills/unlock_skill",解锁指定类别中的指定技能
耐力属性:
- "rogueloot:compat/staminaattributes/add_stamina",增加指定数量的耐力值
- "rogueloot:compat/staminaattributes/set_stamina",将玩家的耐力设置为指定百分比
通用数据结构
上述数据文件中的多个文件使用了这些结构。
标签设置
文本标签(例如按钮上的文字)可以进行自定义。“聊天格式化”用于描述此类自定义。标签设置可以定义一个格式列表,这些格式随后将应用于相应的文本。
可用的格式如下:
- "black"(黑色)
- "dark_blue"(深蓝色)
- "dark_green"(深绿色)
- "dark_aqua"(深青色)
- "dark_red"(深红色)
- "dark_purple"(深紫色)
- "gold"(金色)
- "gray"(灰色)
- "dark_gray"(暗灰色)
- "blue"(蓝色)
- "green"(绿色)
- "aqua"(青色)
- "red"(红色)
- "light_purple"(淡紫色)
- "yellow"(黄色)
- "white"(白色)
- "obfuscated"(混淆)
- "bold"(加粗)
- "strikethrough"(删除线)
- "underline"(下划线)
- "italic"(斜体)
此外,还可以禁用文本阴影。
示例:
{
"formatting": [
"gray",
"bold"
],
"has_shadow": true
}
受属性影响的整数修饰符
Rogue Loot 中各种机制使用的一些值可以选择性地根据实体属性的值进行修改。
指定实体属性的当前值乘以定义的系数后,加到给定的默认值上。
修改后的值将根据给定的 min_value(最小值)和 max_value(最大值)进行限制。
示例:
{
"min_value": -50,
"max_value": 50,
"influencing_attribute_identifier": "minecraft:luck",
"influence_multiplier": 2.0,
}
Rogue Loot (formerly known as Lootable Blocks)
Introduces a rogue-like loot choice system, which allows players to choose rewards out of several options.
Reward options can consist out of a variety of different types, e.g. items, status effects, advancements, etc.
Players can reroll their options, banish specific rewards from appearing again or reserve rewards to appear again after a reroll.
The entire system is data-driven, everything is configured with data/resource packs.
Examples for all data-driven features are available in the test mod files on GitHub:
How to roll a Rogue Loot Table
A Rogue Loot Table can be supplied to players in various ways.
Block Interactions
Rogue Loot Vault Block
This block looks like the vanilla Vault Block and behaves almost exactly like it. The main difference is that instead of spawning the reward in the world, a Rogue Loot Table is rolled for the interacting player.
The block configuration is data-driven, similar to the vanilla Vault Block.
Structure:
- "loot_table_identifier", an optional identifier field, empty by default. The identifier of the supplied Rogue Loot Table.
- "loot_table_mode", an optional String field, "rogue_loot" by default. The mode of the rogue loot vault. "rogue_loot" is currently the only valid option, this option exists for integration with other mods.
- "rolls", a required int field, 3 by default.
- "min_choices", a required int field, 1 by default.
- "max_choices", a required int field, 1 by default. Must be >= "min_choices".
- "activation_range", a required double field, 4.0 by default.
- "deactivation_range", a required double field, 4.5 by default. Must be >= "activation_range".
- "key_item", a required item stack field, {"id": "minecraft:trial_key","count": 1} by default.
- "display_loot_table_identifier", an optional identifier field, empty by default. The identifier of the display loot table.
Example /give command:
/give @s rogueloot:rogue_loot_vault_block[block_state={ominous:"false"},block_entity_data={id:"rogueloot:rogue_loot_vault_block",config_identifier:"rogueloot_test:test"}]
Interactive Rogue Loot Block
This block is a block intended for map-makers and server admins, and it's available in the operator items creative tab.
Interacting with it opens a config screen (when player is in creative mode and has permission level of game master), where several config options can be set.
When interacted with in survival or adventure mode the block supplies a rogue/vanilla loot table, according to its settings.
Item Interactions
When using items with the "rogueloot:supply_rogue_loot_on_use" data component, a rogue loot table is supplied to the player. The exact specifications are set in the component.
Example /give command:
/give @s minecraft:stick[rogueloot:supply_rogue_loot_on_use={"rogue_loot_table_identifier":"rogueloot_test:test","saving_token":"test","rolls":5,"min_choices":1,"max_choices":2,"consume":true}]
Commands
The "/rogue_loot" command allows (among other things) to supply a rogue loot table to players.
Examples:
/rogue_loot roll_rogue_loot_table @s rogueloot_test:test saving_token 3 1 1 show_success_message
Optional Functionality
Banishing
If enabled by the Rogue Loot Table, Table Entries can be banished. They will no longer appear in any newly rolled Rogue Loot Table that contains this entry. Banished entries can no longer be selected in Rogue Loot Table choices that have already been rolled. Depending on a client config option, banished Table Entries are either hidden or visible, but not interactable. Table Entries can be defined to be unbanishable.
The banishing mechanic works for each player individually.
If banishing is enabled, a new button appears in the UI, which toggles "banishing mode". While in this mode, clicking on a Table Entry banishes that entry and exits banishing mode. Clicking on the button again also exits banishing mode.
Banishing optionally has an item cost. In that case, the cost is removed from the inventory when a Table Entry is banished. The currently available amount of banishments is displayed on the button.
The "/rogue_loot" command allows (un)banishing Table Entries. Using the command does not cost any items, but requires the Game Master permission level.
Examples:
/rogue_loot banish_entry @s rogueloot_test:test
/rogue_loot reset @s banished_entries rogueloot_test:test
Rerolling
If enabled by the Rogue Loot Table, they can be rerolled. If enabled, a new button appears in the UI. Rerolling takes into account all currently banished and reserved Table Entries.
The rerolling mechanic works for each player individually.
Rerolling optionally has an item cost. In that case, the cost is removed from the inventory when a Rogue Loot Table is rerolled. The currently available amount of rerolls is displayed on the button.
When a Rogue Loot Table is rolled, the entries are saved to prevent rerolling by simply exiting the Rogue Loot Screen.
Rogue Loot Tables supplied by blocks are saved by the block itself.
Rogue Loot Tables supplied by items or commands are saved as player data. This data can be reset using a command.
Both the data component and the command for rolling a Rogue Loot Table provide a "saving_token". This is a simple string used to identify the rolled Rogue Loot Table together with the Rogue Loot Table identifier. This allows multiple items to supply the same Rogue Loot Table without affecting each other.
The reset command also uses this saving token.
Example:
/rogue_loot reset @s generated_entries rogueloot_test:test saving_token
Reserving
If enabled by the Rogue Loot Table, Table Entries can be reserved. They are now guaranteed to appear in any newly rolled Rogue Loot Table that contains this entry. Reserved entries can no longer be selected in Rogue Loot Table choices that have already been rolled. Depending on a client config option, reserved Table Entries are either hidden or visible, but not interactable. When a reserved Table Entries appears in a newly rolled Rogue Loot Table, it will no longer be reserved. Table Entries can be defined to be unreservable.
The reserving mechanic works for each player individually.
If reserving is enabled, a new button appears in the UI, which toggles "reserving mode". While in this mode, clicking on a Table Entry reserves that entry and exits reserving mode. Clicking on the button again also exits reserving mode.
Reserving optionally has an item cost. In that case, the cost is removed from the inventory when a Table Entry is reserved. The currently available amount of reservings is displayed on the button.
The "/rogue_loot" command allows (un)reserving Table Entries. Using the command does not cost any items, but requires the Game Master permission level.
Example:
/rogue_loot reserve_entry @s rogueloot_test:test
/rogue_loot reset @s reserved_entries rogueloot_test:test
Use Limit
Table Entries can define a use limit. When they are chosen, their use counter increases by 1. If the use limit is reached, then the entry will no longer appear in newly rolled Rogue Loot Tables. Entries which reached their use limit can no longer be selected in Rogue Loot Table choices that have already been rolled.
Each player has their own use counters for each entry.
Entries with a use limit show their remaining uses in their tooltip.
The "/rogue_loot" command allows increasing/decreasing the uses of Table Entries. This requires the Game Master permission level.
Example:
/rogue_loot use_entry @s rogueloot_test:test
/rogue_loot reset @s entry_uses rogueloot_test:test
Permanent Entries
Table Entries can be permanent. These entries will always appear in any Rogue Loot Tables that contains it. However, this is only true if the entry is unlocked according to their unlock predicate, if it has not reached its use limit and if it's not banished.
Complete Reset
There is also a command that resets everything. This is basically just a shortcut, the same effect can be achieved using the individual commands described above.
/rogue_loot reset @s everything
How to create rogue loot tables?
Rogue Loot Tables are data-driven, which means they are defined using a data pack.
Some parts of the Rogue Loot Table are data-driven on their own.
Rogue Loot Table
Each time a Rogue Loot Table is rolled, n amount (roll amount is determined by the Rogue Loot Table supplier) of Table Entries are randomly chosen based on their weight. Entries with higher weight are more likely to be chosen. Entries have a weight of 1 by default. Entries can only be chosen once during a roll.
The player then has to choose some entries (minimum and maximum amount of choices is determined by the Rogue Loot Table supplier).
Closing the screen and reopening it from the same source will not reroll the choices.
Path:
data/<your_namespace>/rogue_loot/table/<your_rogue_loot_table>.json
Structure:
- "rogue_loot_table_entries", a list of Table Entry identifiers and/or tags, empty by default.
- "rarity_overrides", an optional map of Entry Rarity identifiers to Entry Rarity identifiers, empty by default. Entry Rarities of Table Entries in "rogue_loot_table_entries" are overridden, according to this map.
- "gui_settings_identifier", an optional identifier field, empty by default. Defines the GUI Settings used by this Rogue Loot Table.
- "roll_amount_modifier", an optional Attribute Influenced Integer Modifier field, empty by default. Modifies the rolls value coming from the Rogue Loot Table Supplier.
- "min_choices_modifier", an optional Attribute Influenced Integer Modifier field, empty by default. Modifies the min_choices value coming from the Rogue Loot Table Supplier.
- "max_choices_modifier", an optional Attribute Influenced Integer Modifier field, empty by default. Modifies the max_choices value coming from the Rogue Loot Table Supplier.
- "rerolling", an optional Rogue Loot Table Interaction field, empty by default. When this field is present, rerolling is enabled.
- "banishing", an optional Rogue Loot Table Interaction field, empty by default. When this field is present, banishing is enabled.
- "reserving", an optional Rogue Loot Table Interaction field, empty by default. When this field is present, reserving is enabled.
- "random_sequence", an optional identifier field, empty by default. Is used to create deterministic randomization.
Rogue Loot Table Interaction
This is a sub-data structure used only by Rogue Loot Tables. When present, it enables optional mechanics on the Rogue Loot Screen. It also can optionally define an item cost for these mechanics.
Structure:
- "cost", an optional item stack field, empty by default. Defines the item stack that has to be paid in order to use the mechanic enabled by this interaction.
GUI Settings
Gui Settings are referenced by Rogue Loot Tables. They define several cosmetic features and are entirely optional.
Path:
data/<your_namespace>/rogue_loot/gui_settings/<your_table_gui_settings>.json
Structure:
- "background_texture_path", an optional string field, "" by default. This string describes the texture path of the background texture for the Rogue Loot Screen.
- "entries_asset_path_addition", an optional string field, "" by default. This string is added to the background texture paths of Table Entry buttons.
- "reroll_requirements_not_met", an optional Label Settings field, empty by default. Modifies the "Reroll" button's label when the player can't afford the rerolling cost.
- "reroll_requirements_met", an optional Label Settings field, empty by default. Modifies the "Reroll" button's label when the player can afford the rerolling cost.
- "enable_banishing_requirements_not_met", an optional Label Settings field, empty by default. Modifies the "Banish" button's label when banishing is currently inactive and the player can't afford the banishing cost.
- "enable_banishing_requirements_met", an optional Label Settings field, empty by default. Modifies the "Banish" button's label when banishing is currently inactive and the player can afford the banishing cost.
- "disable_banishing", an optional Label Settings field, empty by default. Modifies the "Banish" button's label when banishing is currently active.
- "enable_reserving_requirements_not_met", an optional Label Settings field, empty by default. Modifies the "Reserve" button's label when reserving is currently inactive and the player can't afford the reserving cost.
- "enable_reserving_requirements_met", an optional Label Settings field, empty by default. Modifies the "Reserve" button's label when reserving is currently inactive and the player can afford the reserving cost.
- "disable_reserving", an optional Label Settings field, empty by default. Modifies the "Reserve" button's label when reserving is currently active.
- "confirmation_requirements_not_met", an optional Label Settings field, empty by default. Modifies the "Confirm Choices" button's label when not enough entries are selected.
- "confirmation_requirements_met", an optional Label Settings field, empty by default. Modifies the "Confirm Choices" button's label when enough entries are selected.
Table Entry
Table Entries are referenced by Rogue Loot Tables. They define the individual reward choices.
On the Rogue Loot Screen, each Table Entry is represented by a button. This button allows the player to select the entry. The specific interactions are described above.
Each different button state is reflected by a different button texture. By default, these textures are found here (please refer to the sources on GitHub):
assets/rogueloot/textures/gui/sprites/widgets/loot_option_button/<specific_texture_name>.png
However, the GUI Settings of the Rogue Loot Table and the entry's rarity can influence the texture path, allowing for custom textures based on GUI Settings and/or rarity.
If both GUI Settings and Entry Rarity have the corresponding fields set, the texture path looks like this:
assets/rogueloot/textures/gui/sprites/widgets/loot_option_button/<entries_asset_path_addition>/<asset_path_addition>/<specific_texture_name>.png
"entries_asset_path_addition" is the field in GUI Settings and "asset_path_addition" is the field in Entry Rarity. If one of these fields is missing/empty, they are ignored.
Note that the "/" are not part of these fields. "/" at the start or end of these strings are not allowed. Putting a "/" somewhere in the middle is allowed and will correspond to an additional folder in the file path.
Path:
data/<your_namespace>/rogue_loot/table_entry/<your_table_entry>.json
Structure:
- "unlock_predicate", an optional Context Aware Predicate field, empty by default. Checks whether the entry is unlocked.
- "component", a required Entry Component field. Defines the reward granted by this entry.
- "display", an optional Entry Display field, empty by default.
- "tooltip", an optional Entry Tooltip field, empty by default.
- "rarity_identifier", an optional identifier field, empty by default. Defines the Entry Rarity used by this Table Entry.
- "use_limit", an optional int field, 0 by default. Defines the amount of times this entry can be chosen, before becoming unavailable.
- "allow_banishing", an optional boolean field, true by default. Defines whether the entry can be banished.
- "allow_reserving", an optional boolean field, true by default. Defines whether the entry can be reserved.
- "is_permanent", an optional boolean field, false by default. Defines whether the entry is permanent.
Entry Display
This is a sub-data structure used only by Table Entries. It defines what is displayed on the button representing this Table Entry.
Structure:
- "display_stack", an optional Item Stack field, empty by default. Is not compatible with the "icon_texture_identifier" field.
- "icon_texture_identifier", an optional Identifier field, empty by default. Is not compatible with the "display_stack" field.
- "label_text", an optional string field, "" by default. Defines the Entry Rarity used by this Table Entry.
Entry Tooltip
This is a sub-data structure used only by Table Entries. It defines what is displayed on the button representing this Table Entry.
Structure:
- "display_stack", an optional Item Stack field, empty by default. Is not compatible with the "icon_texture_identifier" field.
- "tooltip_label_lines", an optional list of strings, empty by default. Defines the Entry Rarity used by this Table Entry.
Entry Rarity
Each Table Entry can reference an Entry Rarity. These are mostly cosmetic, but they also define how often a Table Entry is presented to a player, based on a weight system.
Path:
data/<your_namespace>/rogue_loot/entry_rarity/<your_entry_rarity>.json
Structure:
- "asset_path_addition", an optional string field, "" by default. This string is added to the background texture paths of Table Entry buttons.
- "weight", an optional int field, 1 by default. Overwrites the weight of the Table Entry.
- "weight_modifier", an optional Attribute Influenced Integer Modifier field, empty by default. Modifies the weight value
- "banished_label", an optional Label Settings field, empty by default. Modifies the entry's text label when the entry is banished.
- "default_label", an optional Label Settings field, empty by default. Modifies the entry's text label when none of the other cases are true.
- "reserved_label", an optional Label Settings field, empty by default. Modifies the entry's text label when the entry is reserved.
- "selected_label", an optional Label Settings field, empty by default. Modifies the entry's text label when the entry is selected.
- "tooltip_style", an optional identifier field, empty by default. Defines the tooltip style (background texture + frame).
Entry Component
A Table Entry defines a reward, which is granted to the player when the entry is chosen. Rewards are called Entry Components, and they have a variety of possible types. These types are defined in Java code, but can have data-driven fields for further customization.
Component Types:
- "rogueloot:add_experience_level", adds the specified amount of experience levels
- "rogueloot:add_experience_point", adds the specified amount of experience points
- "rogueloot:advancement_criterion", grants the specified criterion of the specified advancement
- "rogueloot:banish_rogue_loot_table_entries", banishes the specified Table Entry (tag)
- "rogueloot:deal_damage", deals the specified amount of damage with the specified damage type to the player
- "rogueloot:heal_to_x_percent", sets the player's health to the specified percentage
- "rogueloot:heal_x_amount", heals the player by the specified amount
- "rogueloot:item_stack", adds the specified item stack to the player's inventory (or drops it on the ground when no space is left)
- "rogueloot:list", grants all specified Entry Components
- "rogueloot:mob_effect_instance", applies the specified mob effect instance, respecting the specified stacking mode
- if no stacking mode is specified, the vanilla functionality (e.g. onEffectUpdated()) is called
- the stacking mode can be one of:
- "none", an existing effect instance is removed (if one is present) and the new is applied
- "amplifier", an existing effect instance is removed (if one is present) and the new is applied, but the amplifier of the existing instance is added
- "duration", an existing effect instance is removed (if one is present) and the new is applied, but the duration of the existing instance is added
- "both", an existing effect instance is removed (if one is present) and the new is applied, but both the amplifier and duration of the existing instance are added
- "rogueloot:modify_equipment", applies the specified list of loot item functions to all items in the specified equipment slots (optionally filtered by a condition)
- "rogueloot:play_sound", plays the specified sound at the player's location
- "rogueloot:random_components", grants a random reward out of a list of Entry Components, each having a weight.
- "rogueloot:reserve_rogue_loot_table_entries", reserves the specified Table Entry (tag)
- "rogueloot:set_experience_level", sets the player's experience level To the specified amount
- "rogueloot:set_experience_point", sets the player's experience points To the specified amount
- "rogueloot:unbanish_rogue_loot_table_entries", unbanishes the specified Table Entry (tag)
- "rogueloot:unreserve_rogue_loot_table_entries", unreserves the specified Table Entry (tag)
- "rogueloot:unuse_rogue_loot_table_entries", removes one use (optionally all uses) of the specified Table Entry (tag)
- "rogueloot:use_rogue_loot_table_entries", adds one use to the specified Table Entry (tag)
- "rogueloot:vanilla_loot_table", rolls the specified vanilla loot table and adds the items to the player's inventory (or drops them on the ground when no space is left)
Component Types can easily be added by third-party mods. Rogue Loot also adds several component types that depend on third-party mods.
Mana Attributes:
- "rogueloot:compat/manaattributes/add_mana", adds the specified amount of mana
- "rogueloot:compat/manaattributes/set_mana", sets the player's mana to the specified percentage
Pufferfish's Skills:
- "rogueloot:compat/puffish_skills/add_experience_level", adds the specified amount of experience levels to the specified category
- "rogueloot:compat/puffish_skills/add_experience", adds the specified amount of experience to the specified category
- "rogueloot:compat/puffish_skills/add_points", adds the specified amount of skill points from the specified point source to the specified category, either with or without announcement
- "rogueloot:compat/puffish_skills/lock_category", locks the specified category
- "rogueloot:compat/puffish_skills/lock_skill", locks the specified skill in the specified category
- "rogueloot:compat/puffish_skills/set_experience_level", sets the player's experience level in the specified category to the specified amount
- "rogueloot:compat/puffish_skills/set_experience", sets the player's experience in the specified category to the specified amount
- "rogueloot:compat/puffish_skills/set_points", sets the player's skill points from the specified point source in the specified category to the specified amount, either with or without announcement
- "rogueloot:compat/puffish_skills/unlock_category", unlocks the specified category
- "rogueloot:compat/puffish_skills/unlock_skill", unlocks the specified skill in the specified category
Stamina Attributes:
- "rogueloot:compat/staminaattributes/add_stamina", adds the specified amount of stamina
- "rogueloot:compat/staminaattributes/set_stamina", sets the player's stamina to the specified percentage
Common Data Structures
These structures are used by several of the data files described above.
Label Settings
Text labels (e.g. on buttons) can be customized. A "Chat Formatting" is used to describe such a customization. Label Settings can define a list of these formattings, which will then be applied to the text in question.
These formattings exist:
- "black"
- "dark_blue"
- "dark_green"
- "dark_aqua"
- "dark_red"
- "dark_purple"
- "gold"
- "gray"
- "dark_gray"
- "blue"
- "green"
- "aqua"
- "red"
- "light_purple"
- "yellow"
- "white"
- "obfuscated"
- "bold"
- "strikethrough"
- "underline"
- "italic"
Additionally, the text shadow can be disabled.
Example:
{
"formatting": [
"gray",
"bold"
],
"has_shadow": true
}
Attribute Influenced Integer Modifier
Some values used by various mechanics in Rogue Loot can optionally be modified by the value of an entity attribute.
The current value of the specified entity attribute is multiplied by a defined value and added to the given default value.
The modified value is clamped by the given min_value and max_value.
Example:
{
"min_value": -50,
"max_value": 50,
"influencing_attribute_identifier": "minecraft:luck",
"influence_multiplier": 2.0,
}
评论 0
登录后参与评分
还没有评论,来抢沙发吧