

Collective 是一个共享库模组,包含所有 Serilum 模组的通用代码。
它将数据和功能集中在一处。Collective 极大地帮助维护了适用于 Fabric、Forge 和 NeoForge 加载器的各个版本。
访问该库的代码环境,为当前和未来项目的功能带来了更多可能性。当某个对多个模组都相关的函数得到改进时,更新过程也变得更加轻松。例如,这意味着只需更新一个项目,而不是六个。这节省了时间,也让我更开心一些。
特性:
- 用于提高与其他项目兼容性的变量。
- 大量有用的函数,防止代码重复。¹
- 用于替换和重新供应实体的事件。
- 包含访问转换器/宽化器(access transformers/wideners),以便使用私有字段。²
- 通过 Common 源集发送数据包的联网代码。
- 针对主要版本变更的集中式向后兼容性支持。
对于每个依赖模组:
- 管理其配置文件和游戏内配置菜单。³
- 允许切换其功能,即使它被包含在整合包中也可操作。⁴
- 提供
/collective config 命令以查看和更改其配置。
- 当模组需要时,将服务器端的配置值同步给玩家。
- 管理其翻译文件。
- 可选的异步更新检查器,会在控制台中打印信息。
- 当模组请求时,记住玩家放置的特定方块。
- 允许其为“创建世界”屏幕添加自己的选项。
- 以及更多!⁵


所有可用的配置选项:
显示剧透
disabledSerilumMods 默认 ""
已安装的 Serilum 模组中被禁用的那些。模组的独立“启用”设置会受此列表影响,反之亦然。重启后生效。
enableUpdateChecker 默认 true
如果依赖模组有可用更新,Collective 是否应在控制台中显示消息。更新检查是可选且异步的。
transferItemsBetweenReplacedEntities 默认 true
启用后,从由任何依赖于 Collective 的实体生成模组所替换的实体之间,转移持有物品和盔甲。
findABlockCheckAroundEntitiesDelayMs 默认 30000,最小值 0,最大值 3600000
围绕实体进行“周围是否有方块”检查的延迟时间(毫秒)。用于那些依赖世界中特定方块状态的模组。如有需要,增加此数值可以提高 TPS。
enablePatronPets 默认 true
为赞助者启用宠物。将在未来的版本中添加。
commandsAskForConfirmation 默认 true
Serilum 模组的命令如果在一次操作中覆盖或更改大量内容,是否先要求你点击 [确认]。
downloadNonEnglishTranslations 默认 true
当客户端语言设置为非英语时,Collective 是否应尝试下载翻译文件。使用来自 的文件,通过 下载。由 CloudFlare Pages 托管。
pushTranslationResourcePack 默认 false
在服务器上,向未安装 Collective 的连接玩家发送一个资源包,以便他们能以自己的语言看到来自服务端 Serilum 模组的自定义物品名称。默认关闭;若未开启,他们将显示服务器语言(参见 serverLanguage)。
requireTranslationResourcePack 默认 true
将该资源包标记为必需项,这样意外拒绝只会踢出玩家并在下次加入时再次询问,而不是永久记住该选择。关闭后使其变为可选。
serverLanguage 默认 en_us
对于未收到资源包的、未安装 Collective 的玩家,Serilum 模组文本显示的语言。使用类似 en_us 或 de_de 的区域设置代码。
itemNameTranslationMode 默认 auto
当资源包关闭时,未安装 Collective 的玩家如何查看自定义物品名称。'auto' 会复制第一个加入玩家的设置并记住它;'server' 始终使用服务器语言;'client' 使用每位玩家自己的语言,但未安装 Collective 的玩家将看到原始键名。
configScreenGuiScale 默认 0,最小值 0,最大值 10
Serilum 模组配置界面的 GUI 缩放比例,也可通过这些界面中 ? 旁边的按钮进行设置。0 表示使用游戏自身的 GUI 缩放比例。
updateMinecraftWindowTitleInDevMode 默认 false
用于我的本地开发流程。在生产环境中无效,仅在从安装了 Collective 的 IDE 运行时生效。

The Collective 的配置命令适用于所有使用配置文件的 Serilum 依赖模组。编辑这些配置需要作弊权限。
/collective - 显示命令用法。
/collective config - 列出拥有配置文件的模组。
/collective config <modid> - 显示某模组的所有设置及其值。
/collective config <modid> get <setting> - 显示某设置的值、描述和默认值。
/collective config <modid> set <setting> <value> - 更改某设置。
/collective config <modid> reset <setting> - 将某设置重置为默认值。
/collective config <modid> add <setting> <id> - 向列表型设置中添加方块、物品、实体、生物群系或其他 ID。
/collective config <modid> add <setting> <id> <amount> - 向需要使用数量或权重的列表型设置中添加带数量或权重的 ID。
/collective config <modid> remove <setting> <id> - 从列表型设置中移除方块、物品、实体、生物群系或其他 ID。
/collective config <modid> reload - 重新加载对模组配置文件的手动更改。
/collective reset headcache - 重置缓存的玩家头颅数据,例如用于更新皮肤。

1 | 多年来,我为 Collective 添加了许多实用的代码。能够使用这些功能让更新依赖模组的工作轻松许多:
< Collective 的 函数 >

2 | 访问转换器/宽化器用于设置和使用 Mojang 设为私有的字段。将这些内容保留在 Collective 中可以使一切井然有序:
< Fabric 的 collective.accesswidener >

3 | 由于我使用 Multiloader 模板来开发所有模组,因此无法在通用代码(Common code)中使用内置配置。Collective 包含一套供所有依赖模组使用的配置代码。这会添加一个游戏内配置菜单,并在 '.minecraft/config/serilum/' 中生成文件。
< Collective 的 Config Code >


4 | 我已发布了我所有模组的捆绑包,以便更方便地下载!
Collective 允许通过一些简洁的代码启用/禁用包含的模组!
< Fabric 的 Bundle 代码 >

5 | 在此查看完整源代码:

只要下载源仍托管在 CurseForge 或 Modrinth 生态系统中,您就可以在任何整合包中自由使用此模组。
Serilum.com 提供了所有可用模组的概览及更多信息。
如有问题、想法、建议或其他任何内容,请访问 GitHub 仓库。谢谢!


Collective is a shared library mod with common code for all of Serilum's mods.
It contains data and functions centralized in one place. Collective helps a great deal in maintaining all the Fabric, Forge and NeoForge mod loader versions.
Having access to the library's code environment, creates possibilities for current and future project features. The updating process is also made easier when there's an improvement for a function that is relevant to many others. For example this means having to update one project, instead of six. This saves time and makes me a little happier.
Features:
- Variables for increased compatibility with other projects.
- Lots of useful functions to prevent code duplication. ¹
- An event to replace and resupply entities.
- Contains the access transformers/wideners to use private fields. ²
- Networking code to send packets via the Common source set.
- Centralized backwards compatibility for major version changes.
For every dependent mod:
- Manages its config file and in-game config menu. ³
- Allows toggling its functionality, also when it's included in a bundle. ⁴
- The
/collective config command to view and change its config.
- Syncs its config values from the server to players, when the mod needs it.
- Manages its translation files.
- An optional async update checker that prints to the console.
- Remembers specific blocks players have placed, when the mod requests it.
- Allows it to add its own options to the Create World screen.
- And much more! ⁵


All available config options:
Show Spoiler
disabledSerilumMods default ""
The Serilum mods that are turned off, picked from the ones installed. A mod's own 'Enable' setting follows this list, and the other way round. Takes effect after a restart.
enableUpdateChecker default true
Whether Collective should show a message in the console if a dependent mod has an update available. Update checks are optional and async.
transferItemsBetweenReplacedEntities default true
When enabled, transfer the held items and armour from replaced entities by any of the Entity Spawn mods which depend on Collective.
findABlockCheckAroundEntitiesDelayMs default 30000, min 0, max 3600000
The delay of the is-there-a-block-around-check around entities in ms. Used in mods which depends on a specific blockstate in the world. Increasing this number can increase TPS if needed.
enablePatronPets default true
Enables pets for Patrons. Will be added in a future release.
commandsAskForConfirmation default true
Whether commands of Serilum's mods that overwrite or change a lot at once first ask you to click [Confirm].
downloadNonEnglishTranslations default true
Whether Collective should attempt to download translations if the client language is set to something other than English. Uses files from , downloaded via . Hosted via CloudFlare Pages.
pushTranslationResourcePack default false
On a server, sends connecting players without Collective a resource pack so custom item names from server-side Serilum mods show up in their own language. Off by default; without it they see the server language instead (see serverLanguage).
requireTranslationResourcePack default true
Marks the resource pack as required, so an accidental decline only kicks the player and asks again next join instead of being remembered for good. Turn off to make it optional.
serverLanguage default en_us
The language Serilum mod text shows in for players without Collective who aren't sent the resource pack. Uses locale codes like en_us or de_de.
itemNameTranslationMode default auto
How custom item names show for players without Collective when the resource pack is off. 'auto' copies the first player to join and remembers it; 'server' always uses the server language; 'client' uses each player's own language, but those without Collective then see raw keys.
configScreenGuiScale default 0, min 0, max 10
The GUI scale of the config screens of Serilum's mods, also set with the button next to the ? on those screens. 0 uses the game's own GUI scale.
updateMinecraftWindowTitleInDevMode default false
Used in my local development flow. Has no effect in production, only when ran from an IDE with Collective installed.

The Collective config commands work for all of Serilum's dependent mods that use configs. Editing these requires cheat-access.
/collective - Shows the usage of commands.
/collective config - Lists the mods with a config.
/collective config <modid> - Shows all settings of a mod and their values.
/collective config <modid> get <setting> - Shows a setting's value, description and default.
/collective config <modid> set <setting> <value> - Changes a setting.
/collective config <modid> reset <setting> - Resets a setting to its default.
/collective config <modid> add <setting> <id> - Adds a block, item, entity, biome or other id to a list setting.
/collective config <modid> add <setting> <id> <amount> - Adds an id with an amount or weight, for list settings that use them.
/collective config <modid> remove <setting> <id> - Removes a block, item, entity, biome or other id from a list setting.
/collective config <modid> reload - Reloads all manual changes to the mod's config file.
/collective reset headcache - Resets the cached player head data, for example to update skins.

1 | Over the years, I've added lots of useful code to Collective. Being able to use these makes my life of updating dependent mods a lot easier:
< Common's Functions >

2 | Access transformers/wideners are used to set and use fields Mojang has made private. Having these in Collective keeps everything organised:
< Fabric's collective.accesswidener >

3 | Because I use the Multiloader template for all of my mods, there is no built-in config I can use from within the Common code. Collective contains a suite of config code that all dependent mods use. This adds an in-game config menu and generates files in '.minecraft/config/serilum/'.
< Common's Config Code >


4 | I've released bundles of my mods for easier downloading!
Collective allows enabling/disabling the included mods via some neat code!
< Fabric's Bundle Code >

5 | See the full source code here:

You may freely use this mod in any modpack, as long as the download remains hosted within the CurseForge or Modrinth ecosystem.
Serilum.com contains an overview and more information on all mods available.
For issues, ideas, suggestions or anything else there is the Github repo. Thanks!
评论 0
登录后参与评分
还没有评论,来抢沙发吧