Nexus API
Nexus 是一个库类模组,其核心宗旨是在尽可能高效和优化的前提下简化开发流程,特别是在 Multiloader(多加载器)项目架构中。它引入了一套相当丰富的抽象层和其他便利工具,但并未强制开发者严格遵循更高层级的约定。简而言之,它为开发者提供了大量能够简化或消除冗余任务的工具,但又不会过度限制开发者的能力,让他们除了使用其提供的功能外无法进行其他操作。
特性
- 全面的平台无关注册系统:支持跨平台的对象注册。然而,与其他基于注册的库不同,Nexus API 的注册系统不仅提供简单的注册钩子,还为其他方面提供了广泛的功能。
- 实用的平台无关工具集:提供了获取不同加载器特定实现信息的方法。例如模组数据、环境侧(客户端/服务端)等。
- 直观的平台无关网络通信:抽象了不同的网络通信差异,使开发者能够专注于编写用于同步信息的数据包,而无需担心内部机制的差异。
- 统一的数据生成系统:在跨平台项目设置中,数据生成(Datagen)往往是一个被忽视的组件,通常是因为只需选择一种加载器(通常是 NeoForge/Forge)并将其生成的数据输出到公共源代码集即可。Nexus API 提供了与加载器无关的数据生成功能,在所有支持的加载器上都能确定性地工作,并拥有易于配置的系统,使这一通常繁琐的代码编写过程变得无缝且高效。
- 属性包装器(Property wrappers):一种将易用性与高效性相结合的详尽工具。属性包装器描述了 Nexus API 提供的一种系统,允许开发者正确地模板化并编写所有类型的对象及其任何共享/关联的属性。
- 全新、易用且强大的事件系统:Nexus API 添加了其自身非侵入式但功能强大的事件系统,该系统在所有加载器之间干净地接口连接,且不施加负面影响性能开销。
有关 Nexus API 所提供的所有功能的全面概述和详细描述,请参阅 Nexus API Wiki。
前置依赖
- Fabric API 0.96.2+1.20.1 或更高版本,适用于 1.20.1 版本的 Fabric。
常见问题
Q. Nexus API 面向哪些开发者?
A. Nexus API 主要面向经常使用 Multiloader(或多加载器类似)项目架构的开发者。此外,当开发者仅使用特定加载器时,尤其是在中型或大型项目中使用时,它也能提供显著的好处。
Q. 为什么要使用 Nexus API?为什么不选择 Architectury 等已有的平台?
A. Nexus API 提供了自己的功能集,旨在节省开发者编写那些可能在不同加载器间存在兼容性问题的样板代码的时间。与 Architectury 不同,Nexus API 并没有一个你为了最大化效率而倾向于使用的平台生态系统——它更像是一个一站式解决方案,适合那些希望快速、高效地完成开发,同时保持兼容性和质量的开发者。
Q. Nexus API 的性能开销大吗?
A. Nexus API 中大多数“性能消耗型”操作都在启动阶段完成。即便如此,对于标准整合包而言,Nexus API 本身仅增加微不足道的毫秒级启动时间(在 Forge 上使用内容较多的整合包时约为 4 - 10 秒,在 Fabric 上使用类似规模的整合包时在 Xeon e5 2620 v4 CPU 上测试约为 10 - 20 秒;测试涵盖了两个加载器下约 390 个模组,包括 Cataclysm 和 Cobblemon 等内容密集型模组。在现代硬件上,这些时间大致减半)。至于游戏内运行时的性能,Nexus API 经过高度优化,在各个层面几乎不会产生任何可察觉的性能影响。换句话说,它的优化程度足以让你(作为用户和/或最终开发者)无需担心其性能问题,无论是否安装了性能优化类模组。
Nexus API
Nexus is a library mod whose core purpose is to simplify the development process as much as possible while being efficient and optimized, particularly in Multiloader project setups. It introduces a fairly large collection of abstractions and other conveniences without forcing developers to adhere to conventions strictly present on a higher level. Simply put, it gives developers tools that largely simplify/eliminate redundant tasks without baby-ing them to the extent that they can't do anything besides work with what it has to offer.
Features
- Comprehensive platform-agnostic registrar system: Allows for object registration cross-platform. However, unlike other registrar-based libraries, Nexus API's registrar provides extensive functionality for other aspects beyond simple registry hooks.
- Practical platform-agnostic utilities: Provides methods to retrieve ample information of different loader-specific implementations. Think mod data, environment side, etc.
- Straightforward platform-agnostic networking: Abstracts different networking oddities, thus allowing developers to focus on writing packets to sync information without worrying about internal quirks.
- Overarching platform-agnostic data generation system: Datagen is an often-untouched component of modding on multi-platform project setups, mainly due to the fact that picking a single loader (usually Neo/Forge) and outputting its generated data to your common sourceset suffices. Nexus API offers loader-agnostic data generation that works deterministically across all supported loaders, with its own easily-configurable system to make a typically-tedious aspect of writing code seamless and efficient.
- Property wrappers: An exhaustive utility that blends ease-of-use with efficiency. Property wrappers describe a system offered by Nexus API that allows developers to properly template and write all types of objects and any shared/associated properties.
- Fresh, easy-to-use and powerful event system: Nexus API adds its own non-intrusive yet powerful event system that cleanly interfaces across all loaders and holds its own without imposing negative performance impacts.
Developers should refer to the Nexus API Wiki for a proper overview and detailed description of all features offered by Nexus API.
Requisites
- Fabric API 0.96.2+1.20.1 or above for Fabric on 1.20.1.
F.A.Q
Q. Who is Nexus API for?
A. Nexus API targets developers who often use a Multiloader (or similar) project setup. It additionally provides substantial benefits when used by developers working with 1 specific loader, particularly when used in medium-sized or larger projects.
Q. Why use Nexus API? Why not opt for an already-existing platform like Architectury?
A. Nexus API provides its own feature set to save developers time writing otherwise annoying boilerplate code that may have compatibility issues across different loaders. Unlike Architectury, Nexus API doesn't have a platform ecosystem that you'd prefer working with in order to maximize efficiency - it's more of a one-stop shop for devs that want to get things done quickly and efficiently while maintaining compatibility and quality.
Q. How heavy is Nexus API?
A. The majority of "performance-taxing" operations in Nexus API are done during startup. Even then, Nexus API itself only adds a negligible amount of ms to startup time for standard packs (between 4 - 10s in heavier packs with larger content mods on Forge, and 10 - 20s on Fabric with similarly-heavy packs on a Xeon e5 2620 v4 CPU - tested with ~390 mods across both loaders, including content-heavy mods such as Cataclysm and Cobblemon. Times are effectively halved on more modern hardware). As for in-game runtime performance, Nexus API is heavily optimized to make virtually no noticeable performance impact at all on all fronts. In other words, it's optimized enough to where you (as a user and/or end-developer) don't need to worry about it, with or without performance optimization mods.
下载 Nexus API
下载 Nexus API
下载 Nexus API
下载 Nexus API
下载 Nexus API
下载 Nexus API
下载 Nexus API
下载 Nexus API
下载 Nexus API
下载 Nexus API
Nexus API 更新日志 (Forge)
v1.1.7 (1.20.1)
内部更改
- 修复了
EntityTypePropertyWrapper#getLootTableDir方法未在末尾添加 "/" 的问题,该问题会导致实体战利品表失效。
新功能
- 新增了
TagPropertyWrapper#getAdditionalStoredTaggedObjects方法及其构建器方法和重载版本等,允许标记对象不必严格限定于相关 TPW 的确切泛型类型。主要用于动态注册表(详见 Javadoc 以获取更多信息)。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
适用于 MC 1.18+ 的 Effekseer 加载器
评论 0
登录后参与评分
还没有评论,来抢沙发吧