
? 简介:
Framework 是一个旨在辅助开发跨平台模组的库,包含用于注册、网络消息等功能的系统。此外,Framework 还包含额外的功能,以进一步释放模组开发的潜力,具体内容如下。
? 开放模型格式(Open Model Format)
开放模型格式是对原版 JSON 方块模型格式的扩展。它移除了设计方块模型时施加的任意限制,这意味着你现在可以将元素旋转至任意角度,而不再局限于 22.5 度的增量。它还允许元素的位置和尺寸超过最大边界 [-16,-16, -16] 到 [32, 32, 32]。下方展示了一个用于载具模组的直升机模型示例。
? 同步数据键(Synced Data Keys)
同步数据键是 Minecraft 实体数据访问器系统的改进版。它允许你将附加数据绑定到任何实体上,而无需编写复杂的 Capability。使用 Framework 的同步数据键的好处在于其提供的强大功能。正如其名所示,数据可以自动同步到客户端;这意味着你无需处理数据包。数据可以保存到实体中,从而在世界重载或服务器重启后依然保留记忆。与 Minecraft 的原生系统不同,Framework 提供了一个选项,允许你的数据在死亡后继续保留,而不是重置为默认值。仍不相信?查看下方的示例,了解这个系统如何既简单又强大。
一个追踪玩家击中鸡的次数的小例子。
// 创建同步数据键
private static final SyncedDataKey<Chicken, Boolean> HIT_COUNT = SyncedDataKey.builder(SyncedClassKey.CHICKEN, Serializers.INTEGER)
.id(new ResourceLocation("your_mod_id", "hit_count"))
.defaultValueSupplier(() -> 0)
.saveToFile()
.syncMode(SyncMode.TRACKING_ONLY)
.build();
// 在你的通用设置中调用此方法
FrameworkAPI.registerSyncedDataKey(HIT_COUNT);
// Forge 事件:当玩家攻击实体时触发
void onHitEntity(AttackEntityEvent event) {
if(event.getTarget() instanceof Chicken chicken) {
int newCount = HIT_COUNT.getValue(chicken) + 1;
HIT_COUNT.setValue(chicken, newCount);
}
}
? 简易登录数据包
Forge 允许开发者创建登录数据包,但实现它需要大量的代码。Framework 将所需的代码简化为一个简单的注册方法,并负责将你的数据发送到客户端。

? 开发者:
通过阅读其功能介绍,了解 Framework 如何为你的开发带来益处。

?♀️ 需要支持?加入官方 Discord 服务器:
评论区不适合提供技术支持,请加入官方 Discord 服务器。你可以获得安装和配置模组、解决崩溃等问题的帮助!此外,你还将第一时间获取模组更新和开发相关的新闻(早于其他任何地方)。

? About:
Framework is a library designed to aid in the development of multi-platform mods, containing systems for registration, network messages, and more. In addition, Framework contains additional features to further unlock the potential of modding, which can be read below.
? Open Model Format
Open Model Format is an extension to Vanilla's JSON Block Model format. It removes the arbitrary restrictions placed on designing block models, this means you can now rotate an element to any angle instead of 22.5 increments. It also allows elements to be positioned and sized larger than the maximum bounds [-16,-16, -16] to [32, 32, 32]. Below is an example of a helicopter model used in a vehicle mod.
? Synced Data Keys
Synced Data Keys are an improvement of Minecraft's entity data accessor system. It allows you to attach additonal data to any entity without the need of writing a complex capability. The benefit of using Framework's Synced Data Keys is the powerful features it provides. As mentioned by in the name, the data can be automatically synced to clients; this means you don't have to deal with packets. The data can be saved to the entity so it's remembered across world reloads or server restarts. Unlike Minecraft's system, Framework adds an option to allow your data to persist across deaths instead of being reset back to it's default value. Not convinced yet? Check out the example below to see how simple but powerful this system is.
An example of keeping track of how many times a chicken has been hit by players.
// Creating a synced data key
private static final SyncedDataKey<Chicken, Boolean> HIT_COUNT = SyncedDataKey.builder(SyncedClassKey.CHICKEN, Serializers.INTEGER)
.id(new ResourceLocation("your_mod_id", "hit_count"))
.defaultValueSupplier(() -> 0)
.saveToFile()
.syncMode(SyncMode.TRACKING_ONLY)
.build();
// Call this in your common setup
FrameworkAPI.registerSyncedDataKey(HIT_COUNT);
// Forge event for when a player attacks an entity
void onHitEntity(AttackEntityEvent event) {
if(event.getTarget() instanceof Chicken chicken) {
int newCount = HIT_COUNT.getValue(chicken) + 1;
HIT_COUNT.setValue(chicken, newCount);
}
}
? Easy Login Packets
Forge has the ability to allow developers to create login packets, however implementing it requires a significant amount of code. Framework condenses the required code into a simple registration method and will handle sending your data to clients.

? Developers:
Discover how Framework can be beneficial to your development by reading about it's features here.

?♀️ Need Support? Join the Official Discord Server:
The comment section isn't great for support, join the official discord server. You can get help installing and configuring mods, resolving crashes and more! Plus you'll also get access to news about mod updates and development (before anywhere else).
下载 Framework
下载 Framework
下载 Framework
下载 Framework
下载 Framework
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Framework
下载 Framework
下载 Framework
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Framework
下载 Framework
✨ 更新至 Minecraft 26.3
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
适用于 MC 1.18+ 的 Effekseer 加载器
模组
添加区块认领和玩家组队功能,并与 Xaero's Minimap 和 World Map 集成
评论 0
登录后参与评分
还没有评论,来抢沙发吧