Scavenge 是一个模组,允许你为任意方块应用自定义的右键/左键行为。
在此基础上,你还可以向这些行为添加战利品池(LootPools),在满足条件时掉落物品。
这些内容从 JSON 文件加载,其工作方式类似于一种脚本语言。
此外,你还可以在这些方块的右键操作中增加某些独特的功能或条件。
例如:
- 玩家必须潜行;
- 玩家手中必须持有钻石;
- 方块是不可破坏的;
- 方块在使用 5 次后消失;
- 等等。
教程:
如果你想看一个关于如何编写 Scavenge 脚本的良好示例教程,
Xaikii 制作了一个,你可以在 这里 找到它
文档
文档现已成为模组的一部分。
通过在配置部分设置 "printExamples" 并启动游戏即可生成。
插件也应支持此功能。
生成的文档将位于游戏文件夹内的 "scavenge_doc" 文件夹中。
文档按 插件 -> 属性类型 -> 属性名称 进行分类整理。
这样做是为了简化查找文档的过程并保持其完整性。
导出脚本
Scavenge 支持导出游戏中加载的脚本。
可以通过将 "dumpScripts" 设置为 true 来实现。
这是为了便于调试,因为现在可以查看哪些脚本被加载以及哪些因源脚本中的错误而被丢弃。
脚本导出发生在 Scavenge 脚本重新加载之后立即进行。
(因此无需重启游戏)
数据包
如何添加 Scavenge 脚本:
Scavenge 现在与数据包配合使用。它会自动加载 "datapacks/DATAPACK_NAME/data/DOMAIN/scavenge_scripts" 文件夹中的所有文件。
并在资源包重新加载时自动重新加载它们。它们会自动同步到客户端,因此不再需要手动进行“服务器->客户端”同步。这一切都是自动完成的。
由于该工具拥有 JEI 插件,我不得不安装一个 JEI 补丁,以便在脚本重新加载后的第 1 刻重新加载 JEI,因为 JEI 不支持任何具有配方/数据自动同步功能的模组。(如果 JEI 不修复此问题,重新加载速度可能会迅速达到两位数甚至三位数)
自引入资源包机制以来,发生的变化包括:
- 效果现在仅在服务器上执行,而条件则在服务器和客户端上同时测试。因此,如果你存储未同步的数据,可能会出现不同步的情况。
- 数学运算/条件比以前更加严格,尽管代码量更大但提供了更多灵活性。
- 错误消息现在可以直接添加到条件中,不再需要单独的消息部分。对于效果,有一个消息效果。
- 条件默认情况下现在可以反转。(不能保证插件支持这一点)
- Scavenge 现在使用原版战利品池,你可以直接将其链接到战利品池。它会尝试在 JEI 中显示它们,但对于更随机/复杂的战利品,准确性可能不会那么高。
- 数学运算/条件现在支持位操作。
- 所有内容的示例都已生成。(同样,不能保证插件支持这一点)
Scavenge is a mod that allows you to apply custom RightClick/LeftClick behaviors to any Block.
On top of that you can add LootPools to these behaviors that are dropped when the conditions are met.
These things are loaded from JsonFiles and act closely to a Scripting language.
On top of that you can add certain unque features/conditions when rightclicking these blocks.
For example:
- Player has to sneak,
- Player has to have a Diamond in his hands
- The block is unbreakable
- The block disapears after 5 uses
- etc.
Tutorial:
If you want a good example tutorial on how to write Scavenge Scripts,
Xaikii made one, which can be found Here
Documentation
Documentation is now part of the mod.
Which can be generated by setting the "printExamples" in the config section and start the game.
Addons should be supporting this too.
Said generated docs will be in the game folder and in the "scavenge_doc" folder.
The documentation is sorted by Plugin -> TypeOfProperty -> PropertyName.
This is done to simplify the process of finding the documentation and keep it preserved.
Dumping Scripts
Scavenge supports dumping ingame loaded scripts.
Which can be done by setting the "dumpScripts" to true.
This was done to make debugging easier, due to now being able to see what got loaded and what got discarded due to errors in the source script.
Script dumping happens directly after scavenge scripts get reloaded.
(So no game restart required)
Datapacks
How to add a Scavenge Script:
Scavenge now works with Datapacks. It will automatically load all files that are in the "datapacks/DATAPACK_NAME/data/DOMAIN/scavenge_scripts" folder.
And will automatically reload them on resource packs reload. They will be automatically synced over to the client so no more "server->client" manual Syncing. Its done automatically.
Since the tool has a JEI plugin i had to install a JEI hack that reloads JEI 1 tick after scripts got reloaded because JEI does not support any mod that has recipe/data autosyncing. (This can get fast into the 2-3 digit reload range if jei does not fix this problem)
What has Changed outside of ResourcePacks now:
- Effects are now only executed on server, while conditions are tested both on server & client. So there can be desyncs if you store data unsynchronized.
- Math Operations/Conditions are now a lot more enforced then before because more flexibility even if the code is bigger.
- Error Messages can now be directly added into Conditions so no longer the separate section with messages. And for effects there is a Message Effect.
- Conditions can by default now be inverted. (Addons can not be guaranteed to support that)
- Scavenge now uses Vanilla LootPools and you can just link them to the lootpool. It will try to show them in JEI but accuracy for more random/complex loot may not look as good.
- Math Operations/Conditions have now bit support.
- Examples for everything are generated. (Again Addons can not guaranteed to support that)
评论 0
登录后参与评分
还没有评论,来抢沙发吧