警告
这是一个库(Library),而非内容模组。它本身不会添加任何游戏功能,你需要使用命令或安装依赖它的其他项目才能施放其中添加的法术。
描述
向游戏中添加法术,以辅助魔法类模组和数据包的创作者。支持原版环境,但内置没有施法系统,因为这是一个库,旨在作为其他项目的基础,而不是单独使用。
使用方法:
使用 /function spell_lib:spells/<spell> {<args>}
法术列表及测试示例
<spell> | 描述 | <args>:
- sonic_boom | 生成一道类似监守者(Warden)音波冲击攻击的光束。 | owner, length, damage
/function spell_lib:spells/sonic_boom {owner:"@p",length:3,damage:5}
- lightning_strike | 延迟后召唤闪电,并在之前提供粒子效果作为预警。请寻找掩体以避免被闪电击中。 | target, time_until_strike, warning_period (粒子爆发之间的间隔)
/function spell_lib:spells/lightning_strike {target:"@p",time_until_strike:200,warning_period:10}
- cloud_tp_and_invis | 角色消失在烟雾云中并进入隐身状态/从当前位置传送离开。 | owner, tp, sound, radius, has_invis, invis_time
/function spell_lib:spells/cloud_tp_and_invis {owner:"@p",tp:true, sound:true,radius:10,has_invis:true,invis_time:3}
(v1.0 更新)
库的使用方法
如果使用此库,请将其作为依赖项添加,无论你的项目是数据包还是模组。切勿直接复制内部文件。你可以随意使用其中的任意数量的法术,并设计有趣且独特的施放方式。你甚至可以将它们用于非传统法术的用途。在使用前,请务必理解命令参数的工作原理及其交互方式。例如,该机制不支持 @s(即使是你自己运行也不起作用)或未加引号的选择器(owner:Name 有效,owner:@p 无效,owner:"@p" 有效)。你还需要为每个参数都提供值,即使像 cloud_tp_and_invis 中的 has_invis 会抵消其他参数(如 invis_time)的情况也是如此。请尝试法术列表中的示例命令以理解每个法术的具体作用。另外请注意,施放一个法术会取消该类型当前活跃的法术(例如,如果一名玩家施放了 lightning_strike,而另一名玩家在第一名玩家被击中前也施放了它,则只有第二名玩家会被击中。)然而,一条命令可以针对多个实体(owner:"@e" 将使所有实体施放该法术,但它们将同时以相同的设置运行)。
由于该库使用函数宏(function macros),大量使用法术可能会导致性能问题。如果在发布的项目中使用了此库,建议注明这一点。请注意,这些宏仅在法术激活时运行,而不是每刻(tick)都运行(v1.0 更新)
版本
支持 Java 版 1.21.5 - 26.3
兼容性
与任何具有相同文件名的内容不兼容。在单玩家环境中测试命令,以便了解其工作原理。
在同一种法术结束前施放第二种同类法术将覆盖旧法术,并将其转移给新的所有者、目标或配置。
使用函数宏。可能会影响性能,尽管我不清楚具体程度。请在运行数据包的计算机上进行测试,并尝试诸如让许多法术针对许多实体等情况以确定影响效果。如果你正在使用此库,请添加此免责声明。
Warning
This is a library, not a content mod. It does not add gameplay functionality alone, and you will need to use commands or install a project that uses it to cast any of the spells it adds.
Description
Adds spells to the game, to aid creators of magic mods and datapacks. Works in vanilla, but there is no casting system built-in, as this is a library and meant to be a base for other projects, not used alone.
To use the spells:
Use /function spell_lib:spells/<spell> {<args>}
Spell list with testing examples
<spell> | description | <args>:
- sonic_boom | Makes a beam similar to the Warden's sonic boom attack. | owner, length, damage
/function spell_lib:spells/sonic_boom {owner:"@p",length:3,damage:5}
- lightning_strike | Strikes lightning after a delay, giving particles as a warning. Take cover to protect you from the lightning. | target, time_until_strike, warning_period (the delay between bursts of particles)
/function spell_lib:spells/lightning_strike {target:"@p",time_until_strike:200,warning_period:10}
- cloud_tp_and_invis | You vanish in a cloud of smoke and go invisible/teleport away from your location. | owner, tp, sound, radius, has_invis, invis_time
/function spell_lib:spells/cloud_tp_and_invis {owner:"@p",tp:true, sound:true,radius:10,has_invis:true,invis_time:3}
(updated in v1.0)
Using the library
If using the library, please add it as a dependency, whether your project is a datapack or mod. Do NOT just copy the files inside. Feel free to use as many of my spells as you want, and add an interesting, unique way to cast them. You can even use them in ways other than spells. Before using it, remember to understand how the command arguments work and interact. For example, it won't work with @s (even when you run it yourself) or a selector without quotes (owner:Name works, owner:@p doesn't work, owner:"@p" works). You also need to run the command with every argument, even if one like has_invis in cloud_tp_and_invis cancels out others (like invis_time). Try the example commands in the spell list to understand each one. Also note that using a spell will cancel out active spells of that type (for example, if one player casts lightning_strike then another casts it before the first player is struck, only the second player will get struck.) However, one command can target multiple entities (owner:"@e" will cast the spell as every entity, but they will all run at the same time and with the same settings.)
Since the library uses function macros, heavy use of spells may cause performance issues. If publishing a project using this, it would be helpful to mention this. Note that these macros are only run when spells are active, and not run every tick (updated in v1.0)
Versions
Supports Java Edition 1.21.5 - 26.3
Compatibility
Incompatible with anything with the same filenames. Test the commands in singleplayer before using them, to understand how the commands work.
Casting a second spell of the same type before one has ended will overwrite the old spell and transfer it to the new owner, target, or config.
Uses function macros. May affect performance, although I don't know the extent. Test it on the computer running the datapack, and try things such as many spells targetting many entities to determine the effects. If you're using the library, please add this disclaimer.
评论 0
登录后参与评分
还没有评论,来抢沙发吧