Nerflytra - 让火箭烧毁鞘翅
这款高效的数据包通过破坏玩家的鞘翅或在每次使用火箭飞行时将其耐久度降低 10%,来阻止/劝阻玩家使用火箭进行长距离飞行。
此数据包支持配置,您可以设置玩家在发射火箭时鞘翅是受损还是完全损坏、数据包的检测频率(针对对性能极度敏感的玩家),以及是否允许某些玩家被排除在此数据包的“鞘翅燃烧”机制之外。请参阅使用方法部分获取指导。
使用方法
改为仅损伤而非直接销毁鞘翅
运行命令 /function nerflytra:toggle_damaging_instead_of_destroying_elytra。
启用后,此数据包将在每次使用火箭时将鞘翅的耐久度降低 10%(而不是直接将其设置为 1%)。由于这种效果仅在每次使用火箭时触发一次,玩家可以使用更持久的火箭飞行更长时间。
如果您希望造成更少的伤害,可以按照下文描述降低数据包的检测频率。请注意,这将使烟花造成的伤害大幅减少。
若要手动更改此设置,您可以编辑文件 /data/item_modifier/lower_durability.json 中的 damage 数值,该数值为介于 1.00 和 0.00 之间的百分比。
允许特定玩家使用火箭
您可以通过给予玩家记分板目标 nerflytra.can_rocket 值为 1,将这些玩家从此数据包中排除。将此值设置为 0 将再次禁止他们使用火箭。
执行此操作的命令格式如下:/scoreboard players set PLAYERNAME nerflytra.can_rocket 1。
降低数据包的检测频率
默认情况下,数据包每秒检测两次正在飞行的玩家,性能表现非常出色。如果您不需要那么高的精度,或者对性能格外谨慎,可以通过函数 /function nerflytra:toggle_frequency 进一步降低此数据包的检测频率。请注意,如果您同时配置了数据包仅损伤鞘翅而不直接销毁它,降低检测频率将使鞘翅受到的伤害显著变慢。
工作原理
当数据包进行检测时,如果玩家的胸甲槽位中装备有鞘翅,且自上次检测以来使用了烟火火箭,则该胸甲槽位会受到损伤。
数据包默认每秒检测两次,但您可以在使用方法部分了解如何更改此设置。
如果您设置了不销毁鞘翅而是仅损伤它的选项,鞘翅的耐久度将被降低而非直接报废,只会播放一半的音效,且不显示任何消息。
如果您已启用此选项但仍希望造成比平时更少的伤害,可以按照使用方法部分所述,降低数据包的检测频率。
许可证
本作品遵循 GPLv3 许可证。您可以将其理解为:只要您对代码的使用也采用 GPLv3 许可证并免费分享,您就可以随意使用该代码。
如果您有代码建议,可以通过我的个人资料联系,我可以更新此数据包,或者可能创建一个 Git 仓库以进行协作。
Nerflytra - Make rockets burn elytras
This performant datapack stops/discourages players from using rockets to fly long distances by breaking their elytra or reducing its durability by 10% every time they do.
This pack is configurable, you can configure whether players elytras are damaged or entirely broken when they rocket, how often the pack checks (for the performance paranoid out there), and whether to allow some players to be excluded from this datapack's elytra-burning proclivities. See the How to section for guidance.
How to
Damage instead of destroy the elytra
Run /function nerflytra:toggle_damaging_instead_of_destroying_elytra.
When toggled on, this will make the datapack reduce the durability by 10% (instead of setting it directly to 1%) every time they use a rocket. Since this only occurs once per rocket-usage, players can use longer-lasting rockets to fly for longer.
If you want this to do even less damage, you can make the datapack check less frequently as described below. Note that this will make fireworks do far less damage.
To change this manually, you can edit the damage number in the file /data/item_modifier/lower_durability.json, this is a percentage between 1.00 and 0.00.
Allow certain players to use rockets
You can exclude players from this datapack by giving them the scoreboard objective nerflytra.can_rocket with the value 1. Setting this to the value 0 will stop them from using rockets again.
The command to do this will look like /scoreboard players set PLAYERNAME nerflytra.can_rocket 1.
Make the datapack check less frequently
By default the datapack checks for flying players twice per second, and is very perfomant. If you don't need that precision or are extra cautious about performance, you can make this datapack check even less frequently with the function /function nerflytra:toggle_frequency. Note that if you've also configured this pack to only damage elytras instead of destroy them, this will make the elytra take significantly slower damage.
How it works
If a player is flying with an elytra in their chest slot when the datapack checks, and they have used firework rockets since the last check, their chest slot is damaged.
The datapack checks twice per second by default, but you can change this like described in the How to section.
If you set the option to not break the elytra but instead damage it, the elytras durability is reduced instead of destroyed, only half the sound effects play, and no message is shown.
If you've set this option but want it to do even less damage than usual, you can make the datapack check less frequently as described in the How to section.
License
This work is licensed under GPLv3. You can think of it as allowing you to do anything with this code, as long as what you do with it also uses the GPLv3 license, and is shared for free.
If you have code suggestions you can reach out via bio and I can update the datapack, or potentially open a git repository for collaboration.
评论 0
登录后参与评分
还没有评论,来抢沙发吧