CompactResources
CompactResources 为 Paper 服务器添加了堆叠数量规则和压缩资源物品
简介
CompactResources 通过增加配置物品的最大堆叠数量、添加可逆的压缩资源物品,并允许特定物品在必须保持原版或外部管理的堆叠数量时选择退出,来帮助玩家保持背包整洁。
压缩资源是自定义的 minecraft:heart_of_the_sea(深海之心)物品,可以通过资源包在视觉上呈现为方块模型的外观。为了正确显示它们,客户端需要 CompactResourcesPack,这是主要为此插件开发的配套资源包。当配置了 resource-pack.url 和 resource-pack.sha1 时,插件可以通过 Paper 的服务器资源包系统自动发送该资源包。
默认情况下,该插件针对那些通常有用但不适合批量存储的物品,如炖菜、药水、马鞍、船、带箱子的船和矿车。服务器管理员可以根据物品 ID、Minecraft 物品标签、正则表达式或针对所有物品的默认禁用后备规则来自定义堆叠数量规则。
玩家可以制作支持的材料以形成 x9、x81 和 x729 压缩等级,也可以通过制作将其解压,或者运行 /cr compact 来自动转换符合条件的库存内容。支持的压缩资源包括常见的存储密集型方块以及选定的物品,如箭、甜菜根、胡萝卜、岩浆膏、土豆和甘蔗。
编辑配置文件后,请使用 /cr reload 应用更改而无需重启服务器。
有关发行说明,请参阅 CHANGELOG.md。
相关项目:
- CompactResourcesPack 资源包:
配置
language: 'ko'
module:
compression:
enabled: true
max-stack-size:
# 除非有更具体的规则,否则应用于所有物品的默认最大堆叠数量。
# 警告:启用此项有风险,因为它会应用到具有耐久度的物品,导致整个堆叠共享伤害。
default:
enabled: false
size: 64
# 按 Minecraft 物品 ID 的最大堆叠数量。
# 可以省略 'minecraft:' 命名空间(例如,'suspicious_stew': 64)。
id:
'beetroot_soup': 64
'lingering_potion': 64
'mushroom_stew': 64
'potion': 64
'rabbit_stew': 64
'saddle': 64
'splash_potion': 64
'suspicious_stew': 64
# 与 Minecraft 物品 ID 匹配的正则表达式规则。
# 模式将针对完整的运行时物品 ID 进行匹配(例如,'minecraft:<id>')。
# 示例:'^.*minecart$' 匹配所有矿车类物品。
regex:
- pattern: '^.*minecart$'
size: 64
# 按 Minecraft 物品标签 ID 的最大堆叠数量。
# 可以省略 'minecraft:' 命名空间(例如,'boats': 64)。
tag:
'boats': 64
'chest_boats': 64
resource-pack:
enabled: true
force: true
sha1: '34465d867fff230b649080315e466e1d2cfd72d8'
url: 'https://cdn.modrinth.com/data/swhJ0PPM/versions/y5qpQDLi/compact-resources-pack.zip'
uuid: '9d54b89a-1738-4307-abd8-3f7f9d8613f5'
module.compression.enabled 控制压缩配方和物品处理。如果将其禁用,堆叠数量模块仍可运行,但不会注册压缩资源物品。
module.max-stack-size 规则按以下顺序解析:精确物品 ID、物品标签、正则表达式,然后是可选的默认规则。值被限制在支持的范围 1..99 内。无效的正则表达式规则在验证期间会被移除,而未知的物品 ID 则会保留并发出警告,以便未来的 Minecraft 版本仍可使用它们。
CompactResources 会跳过名称为 cr_ignore(不区分大小写)的物品的最大堆叠数量更改,这允许非 OP 玩家通过铁砧创建例外。持有物品时,拥有 compactresources.ignore 权限的玩家也可以运行 /cr ignore set;该权限默认授予所有玩家。对于命令生成的物品,请使用 Paper 兼容 PDC 的自定义数据格式:
/give @s minecraft:stone[custom_data={PublicBukkitValues:{"compactresources:ignore":1b}}]
当 CompactResources 应用最大堆叠数量时,它还会写入内部的 compactresources:managed_max_stack_size 标记。该标记对用户不可见;它仅允许插件移除或更新其拥有的值,同时保留由其他插件、数据包或命令创建的最大堆叠数量。
resource-pack.enabled 控制插件是否要求加入游戏的玩家加载配置的资源包。resource-pack.force 使此请求成为强制性的。如果 url 或 sha1 为空,或者 URL/哈希元数据无效,则跳过资源包分发,压缩资源在机械上仍将正常工作,但在没有 CompactResourcesPack 的客户端上将显示为深海之心物品。
命令
/cr compact: 压缩执行者玩家的物品栏。
/cr ignore get: 显示主手物品是否被 CompactResources 忽略并管理。
/cr ignore set: 将主手物品标记为最大堆叠数例外项。
/cr ignore unset: 移除主手物品的命令设置例外。
/cr ignore toggle: 切换主手物品的命令设置例外状态。
/cr reload: 从磁盘重新加载配置。
/cr config language [value]: 查看或更新当前活动语言。
/cr config max-stack-size default enabled [true|false]: 查看或更新默认堆叠数规则。
/cr config max-stack-size default size [1..99]: 查看或更新默认堆叠数量。
/cr config max-stack-size id <minecraft item id> [1..99]: 查看或更新特定物品 ID 的规则。
/cr config max-stack-size tag <minecraft tag id> [1..99]: 查看或更新特定物品标签的规则。
技术说明
压缩资源是自定义的 minecraft:heart_of_the_sea 物品。CompactResources 将基础材料和压缩层级存储在物品的持久数据容器(Persistent Data Container)中,然后分配如 compactresources:item/compressed/cobblestone_x9 这样的物品模型。
物品名称采用 Adventure 可翻译组件格式。一个压缩圆石物品的名称由 block.minecraft.cobblestone 加上 x9 组成,而压缩箭矢则使用 item.minecraft.arrow 加上 x9,这样每个客户端都能以其自己的语言显示基础材料的名称。
CompactResourcesPack 提供了压缩资源的物品模型定义。服务器管理员可以使用 Modrinth CDN 上的资源包 URL,并配置 resource-pack.url 和 resource-pack.sha1;Paper 会在玩家加入时将其发送给客户端。
在物品模型迁移期间,当玩家加入游戏或移动这些物品时,CompactResources 会升级那些仍携带旧版自定义模型数据(Custom Model Data)元数据的早期压缩资源物品。
权限:
compactresources.compact: 允许使用 /cr compact。
compactresources.config: 允许查看和编辑实时配置值。
compactresources.ignore: 允许管理主手物品的最大堆叠数例外。
compactresources.reload: 允许使用 /cr reload。
CompactResources
CompactResources adds stack-size rules and compressed resource items to Paper servers
Introduction
CompactResources helps players keep their inventories clean by increasing the maximum stack size of configured items, adding reversible compressed resource items, and letting specific items opt out when they must keep their vanilla or externally managed stack size.
Compressed resources are custom minecraft:heart_of_the_sea items that can visually appear as block-shaped models through the resource pack. For them to display correctly, clients need CompactResourcesPack, the companion resource pack developed primarily for this plugin. The plugin can send that pack automatically through Paper's server resource-pack system when resource-pack.url and resource-pack.sha1 are configured.
By default, the plugin targets items that are commonly useful but awkward to store in bulk, such as stews, potions, saddles, boats, chest boats, and minecarts. Server owners can customize stack-size rules by item ID, Minecraft item tag, regular expression, or a disabled-by-default fallback rule for every item.
Players can craft supported materials into x9, x81, and x729 compressed tiers, decompress them back through crafting, or run /cr compact to convert eligible inventory contents automatically. Supported compressed resources include common storage-heavy blocks plus selected items such as arrows, beetroot, carrots, magma cream, potatoes, and sugar cane.
Use /cr reload after editing the configuration to apply changes without restarting the server.
See CHANGELOG.md for release notes.
Related projects:
- CompactResourcesPack resource pack:
Configuration
language: 'ko'
module:
compression:
enabled: true
max-stack-size:
# The default max stack size applied to all items unless a more specific rule exists.
# WARNING: Enabling this is risky as it applies to items with durability, causing the entire stack to share damage.
default:
enabled: false
size: 64
# Max stack sizes by Minecraft item ID.
# The 'minecraft:' namespace can be omitted (e.g., 'suspicious_stew': 64).
id:
'beetroot_soup': 64
'lingering_potion': 64
'mushroom_stew': 64
'potion': 64
'rabbit_stew': 64
'saddle': 64
'splash_potion': 64
'suspicious_stew': 64
# Regular expression rules matched against Minecraft item IDs.
# Patterns are matched against the full runtime item ID (e.g., 'minecraft:<id>').
# Example: '^.*minecart$' matches all minecart items.
regex:
- pattern: '^.*minecart$'
size: 64
# Max stack sizes by Minecraft item tag ID.
# The 'minecraft:' namespace can be omitted (e.g., 'boats': 64).
tag:
'boats': 64
'chest_boats': 64
resource-pack:
enabled: true
force: true
sha1: '34465d867fff230b649080315e466e1d2cfd72d8'
url: 'https://cdn.modrinth.com/data/swhJ0PPM/versions/y5qpQDLi/compact-resources-pack.zip'
uuid: '9d54b89a-1738-4307-abd8-3f7f9d8613f5'
module.compression.enabled controls compression recipes and item handling. If it is disabled, the stack-size module can still run, but compressed resource items are not registered.
module.max-stack-size rules are resolved in this order: exact item ID, item tag, regex, then the optional default rule. Values are clamped to the supported range 1..99. Invalid regex rules are removed during validation, while unknown item IDs are kept with a warning so future Minecraft versions can still use them.
CompactResources skips max stack-size changes for items named cr_ignore case-insensitively, which lets non-op players create exceptions through anvils. Players with compactresources.ignore can also run /cr ignore set while holding an item; that permission is granted to all players by default. For command-generated items, use Paper's PDC-compatible custom data form:
/give @s minecraft:stone[custom_data={PublicBukkitValues:{"compactresources:ignore":1b}}]
When CompactResources applies a max stack size, it also writes the internal compactresources:managed_max_stack_size marker. That marker is not user-facing; it only lets the plugin remove or update values it owns while preserving max stack sizes created by other plugins, datapacks, or commands.
resource-pack.enabled controls whether the plugin asks joining players to load the configured pack. resource-pack.force makes the request required. If url or sha1 is blank, or if the URL/hash metadata is invalid, resource-pack delivery is skipped and compressed resources will still work mechanically but appear as Heart of the Sea items on clients without CompactResourcesPack.
Commands
/cr compact: Compacts the executing player's inventory.
/cr ignore get: Shows whether the main-hand item is ignored and managed by CompactResources.
/cr ignore set: Marks the main-hand item as a max stack-size exception.
/cr ignore unset: Removes the command-set exception from the main-hand item.
/cr ignore toggle: Toggles the command-set exception on the main-hand item.
/cr reload: Reloads configuration from disk.
/cr config language [value]: Views or updates the active language.
/cr config max-stack-size default enabled [true|false]: Views or updates the fallback stack-size rule.
/cr config max-stack-size default size [1..99]: Views or updates the fallback stack size.
/cr config max-stack-size id <minecraft item id> [1..99]: Views or updates an item ID rule.
/cr config max-stack-size tag <minecraft tag id> [1..99]: Views or updates an item tag rule.
Technical Notes
Compressed resources are custom minecraft:heart_of_the_sea items. CompactResources stores the base material and compression tier in the item's Persistent Data Container, then assigns an item model such as compactresources:item/compressed/cobblestone_x9.
Item names are Adventure translatable components. A compressed cobblestone item is named as block.minecraft.cobblestone plus x9, while a compressed arrow item uses item.minecraft.arrow plus x9, so each client sees the base material name in its own language.
CompactResourcesPack provides item model definitions for compressed resources. Server owners can use the URL of the resource pack on Modrinth CDN and configure resource-pack.url plus resource-pack.sha1; Paper then sends it to clients on join.
During the item model migration, CompactResources upgrades older compressed resource items that still carry legacy Custom Model Data metadata when players join or move those items.
Permissions:
compactresources.compact: Allows /cr compact.
compactresources.config: Allows viewing and editing live config values.
compactresources.ignore: Allows managing max stack-size exceptions on the main-hand item.
compactresources.reload: Allows /cr reload.
评论 0
登录后参与评分
还没有评论,来抢沙发吧