scafall 的主要目标是提供一种轻量级的包装方案,用于创建跨平台 API。
次要目标是为各平台最常用的部分提供工具,例如任务与调度,或为 Adventure 等库提供 Kotlin 特定的便捷工具。
注意:Scafall 是一个开发库,并非供玩家使用或提供游戏功能。其他插件/模组可能将其作为依赖项。
代理接口
Scafall 通过提供简单的包装器接口来避免包装每一个平台/Minecraft 特性,这些接口仅作为一种代理使用。
- API(由插件/模组开发者创建)在函数中接受包装器作为参数(例如
ScafallItemStack)。 - 这些函数的实现会将包装器参数
unwrap()解包为原生 Minecraft 对象,使用这些对象进行操作(例如ItemStack),并将任何返回值wrap()包装起来。 - 其他模组/插件会将其平台特定的对象(例如
org.bukkit.inventory.ItemStack)wrap()包装,然后传入 API。
这些接口非常轻量,仅提供对包装对象极少属性的访问。 其理念是纯粹将它们用作模组/插件、API 和实现之间的传输层,从而便于在不同平台间共享通用代码。
Scafall 以 Minecraft 为基准真理,因此代理始终包装原生的 Minecraft 类型。
当包装其他平台类型时,这些类型首先会被转换为原生的 MC 类型。
(Spigot/Paper 对象通常是包装器本身,在这种情况下,它直接使用那个被包装的值)
限制与内存问题
包装器与其所对应的原生类型面临相同的限制。这意味着永远不应该尝试将包装器存储在列表或映射中,否则会导致内存泄漏。 它们仅应被用作 API 调用的参数或返回值。
开发中
这仍然是一个处于开发中的项目,因此不要期望一切都能无缝运行。 目前尚未保证 API 兼容性,但最终会提供支持。 当前的 API 仍不稳定,随时可能在未通知的情况下更改!
附加模块/库
本项目的主要目的是真正提供基本的脚手架并协助开发过程。
附加模块/库可能会使用 scafall 来提供更细分的 API 和工具。
- viewportl - 基于 Compose Runtime 的 Minecraft UI 框架,用于构建强大、响应式且高效的 UI。
(使用 scafall 使其能够创建跨平台 UI)
The main goal of scafall is to provide a lightweight wrapping solution for creating cross-platform APIs.
A secondary goal is to provide utils for the most used parts of each platform, such as Tasks & Scheduling or Kotlin-specific convenience utils for libraries like Adventure.
Note: Scafall is a development library not meant to be used by players or provide gameplay features. Other plugins/mods may require it as a dependency.
Proxy Interfaces
Scafall avoids wrapping every Platform/Minecraft feature by providing simple wrapper interfaces, that are only used as a kind of proxy.
- The API (created by the plugin/mod dev) accepts wrappers as arguments (e.g.
ScafallItemStack) in functions. - The implementations of those functions
unwrap()the wrapper arguments to the native Minecraft object, work with those (e.g.,ItemStack), andwrap()any return value. - Other Mods/Plugins
wrap()their platform-specific objects (e.g.,org.bukkit.inventory.ItemStack) and pass those into the API.
These interfaces are lightweight and provide access to very few properties of the wrapped object. The idea is to purely use them as a transfer between Mods/Plugins, API, and Implementation, allowing for easier sharing of common code between platforms.
Scafall uses Minecraft as the ground truth, so proxies always wrap the native Minecraft types.
When wrapping other platform types, those are first converted into the native MC types.
(Spigot/Paper objects are usually wrappers themselves, in which case it just uses that wrapped value)
Limitations & Memory Concerns
The same limitation applies to wrappers as they do to native types. That means one should never attempt to store a wrapper in a list or map, as that would lead to memory leaks. They are intended to be used only as parameters or return values to/from API calls.
Work in Progress
This is still a work-in-progress project, so don't expect anything to work seamlessly. There is no guarantee of API compatibility yet, but it will be provided eventually. The current API is still unstable and likely to change at anytime without notice!
Additional Modules/Libraries
The goal of this project is to really just provide the basic scaffolding and assist in the development process.
Additional Modules/Libraries may use scafall to provide more niche APIs and Utils.
- viewportl - Minecraft UI Framework based on Compose Runtime, for powerful, reactive and efficient UIs.
(Uses scafall to make it possible to create cross-platform UIs)
下载 scafall
下载 scafall
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 scafall
下载 scafall
下载 scafall
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 scafall
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 scafall
下载 scafall
下载 scafall
下载 scafall
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
核心
- 重构:移除 ModIdentifier 并使 Scafall 成为 TaskOwner
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
AE2:一款流行的自动化与存储模组
评论 0
登录后参与评分
还没有评论,来抢沙发吧