Dynamic Bows 是一个旨在增强弓类武器并使其更加多功能的数据包。它添加了 2 种新的弓类型,调整了一些弓附魔,并为弓添加了新的音效。此外,它还作为一个库,允许其他数据包创建具有完全自定义属性的新弓武器。
弓
短弓 (Shortbow)
短弓是一种充能速度快但威力较小且精度较低的弓。在拉满短弓时,玩家仍然可以奔跑,但速度会降低。它的合成配方为 3 根木棍和 1 根线。
可以使用命令 /loot give @s loot dynamicbows:bows/shortbow 获取。

长弓 (Longbow)
长弓是一种强大的弓,具有高伤害、射程更远且精度更高,但充能时间更长。它的合成配方为 3 根木棍、3 根线和 2 个铁粒。
可以使用命令 /loot give @s loot dynamicbows:bows/longbow 获取。

附魔
快速装填 (Quick Charge)
快速装填现在适用于弓!然而,与普通的快速装填不同,每级快速装填只会使弓的充能时间减少 11%,而不是 25%。
力量 (Power)
力量现在使远程伤害在第 1 级增加 50%,并在第 1 级之上每级增加 25%,以确保短弓和长弓都保持在预期的伤害范围内。这不会影响普通弓的伤害。
其他特性
弓的音效
现在在开始拉弓和完全拉满弓时会有音效。
修改后的箭矢伤害
箭矢会穿透伤害冷却(无敌帧),使得充能时间极短的弓仍能造成伤害,而无需担心伤害冷却问题。
自定义弓
此数据包允许通过向任何 minecraft:bow 物品的 minecraft:custom_data 组件添加数据来创建具有自定义属性的自定义弓。
示例自定义数据组件
{
"minecraft:custom_data": {
"ve": {
"components": {
"bow": {
"damage": 2,
"uncertainty": 1,
"power": 3,
"max_charge_time": 20,
"dynamic_animation": true,
"inherit_motion": true,
"inherit_motion_scale": 1,
"mob": {
"power_scale": 0.75,
"uncertainty_scale": 1,
"crit": false
},
"commands": {
"on_start_charging": "tellraw @a \"started charging!\"",
"on_charging": "tellraw @a \"charging!\"",
"on_fully_charged": "tellraw @a \"fully charged!\"",
"on_fired": "tellraw @a \"I shot a shot bow!\"",
"on_projectile_spawned": "tellraw @a \"arrow fired!\"",
"on_hit_event": "tellraw @a \"hit event!\"",
"on_hit_block": "tellraw @a \"hit a block!\""
}
}
}
}
}
}
配置
基础配置
基础弓配置选项。此处可以省略任何值。
damage: 从该弓射出的箭矢的基础伤害。默认为 2.0
uncertainty: 弓的最大不精确度,以度为单位。默认为 1.0
power: 完全充能射击的速度,以每个刻的方块数计。默认为 3.0
max_charge_time: 弓完全充能所需的时间,以刻为单位。默认为 20。如果最大充能时间低于此值,该值将默认为最小值 3。
dynamic_animation: 弓是否应根据其充能时间动态播放拉弓动画。默认为 true。需要特定的物品模型配置才能正常工作。
inherit_motion: 由该弓射出的箭矢是否应继承射手的运动状态。默认为 true。
inherit_motion_scale: 如果将 inherit_motion 设置为 true,则在将运动应用到射出的箭矢之前,缩放射手的运动。默认为 true。
生物特定配置
这些选项控制生物如何射出弓。请注意,生物不受弓的最大充能时间影响,它们将以原版速率始终发射。
power_scale: 当由生物射出时,缩放弓的 power 值。默认为 0.55。
uncertainty_scale: 当由生物射出时,缩放弓的 uncertainty 值。默认为 2.0。
crit: 持有此弓的生物射出的箭矢是否为暴击箭矢。默认为 false。
命令
所有通过此自定义组件运行的命令都可以访问存储在存储 dynamicbows:temp bow 中的弓的数据,除了 on_hit_event 和 on_hit_block,在这种情况下,数据存储在箭头实体数据下的 data.ve.shot_data 中。
谓词 dynamicbows:fully_charged 可用于玩家和箭矢,以检测他们的弓是否已完全充能。
on_start_charging: 当玩家首次开始对此弓进行充能时运行的命令。
on_charging: 当玩家对弓进行充能的每一刻运行的命令。
on_fully_charged: 当玩家根据 max_charge_time 字段指定的时间将弓完全充能时运行的命令。
on_fired: 在射出弓的实体上运行的命令。
on_projectile_spawned : 当弓射出时,在射出的箭矢上运行的命令。
on_hit_event: 当弓射出的箭矢击中实体时运行的命令。以受害者实体身份执行。
on_hit_block: 当弓射出的箭矢击中方块时运行的命令。在箭头实体位置执行。
命中事件特定功能
从 on_hit_event 执行的命令可以访问额外的谓词,用于选择所有涉及的实体。
dynamicbows:hit_event/is_arrow: 测试一个实体是否为命中时使用的箭矢。
dynamicbows:hit_event/is_attacker: 测试一个实体是否为在命中事件中拉弓的实体。
dynamicbows:hit_event/is_victim: 测试一个实体是否为被另一实体使用弓箭攻击的目标。如果目标在攻击中死亡,则无法通过目标选择器选中它,因此对已死亡目标执行的任何命令必须使用 @s 选择器。
dynamicbows:hit_event/victim_killed: 测试目标是否在命中事件中死亡。
函数标签
自定义弓配置中的每个命令字段也都有相应的函数标签,数据包可以利用这些标签。这些函数标签总是在特定于弓的命令之后运行,并且无论使用何种弓都会运行。还包含了一些没有特定于弓事件的额外标签。可以通过运行 dynamicbows:bow/get_current_bow_data 函数来获取这些数据标签中的任意位置的弓数据,该函数会将当前充能弓的数据输出到 dynamicbows:temp bow 存储中,但 on_hit_event 和 on_hit_block 除外,在这种情况下,数据会存储在箭矢实体的 data.ve.shot_data 和 weapon 下。
#dynamicbows:bow/on_start_charging: 玩家首次为弓充能时运行的函数。
#dynamicbows:bow/on_charging: 玩家每帧为弓充能时运行的函数。
#dynamicbows:bow/on_fully_charged: 当玩家将弓充能达到 max_charge_time 字段指定的时间时运行的函数。
#dynamicbows:bow/on_fired: 在发射弓的实体上运行的函数。
#dynamicbows:bow/on_projectile_spawned : 当弓发射时,在射出的箭矢上运行的函数。
#dynamicbows:bow/on_hit_event: 当弓射出的箭矢击中实体时运行的函数。以目标实体为执行者并在其位置执行。所有命中事件特定的功能都适用于此标签。
#dynamicbows:bow/on_hit_block: 当弓射出的箭矢击中方块时运行的函数。以箭矢实体为执行者。
#dynamicbows:bow/modifies_charge_time: 修改最大充能时间的函数。这些函数应修改正在充能的玩家的 dynamicbows.bow.charge_time.max 分数。
#dynamicbows:bow/on_reset: 当弓停止充能 或 被射出时运行的函数。
使用动态动画
如果启用了弓上的动态动画,则必须专门设置物品模型以支持它们,使用 custom_model_data。建议还将 hand_animation_swap 设置为 false,以防止在切换帧时物品晃动。与原版弓类似,需要4个单独的模型,3个用于每个充能阶段,1个用于基础物品。
示例模型
{
"model": {
"type": "minecraft:select",
"property": "minecraft:custom_model_data",
"index": 0,
"cases": [
{
"when": "0",
"model": {
"type": "minecraft:model",
"model": "minecraft:item/bow_pulling_0"
}
},
{
"when": "1",
"model": {
"type": "minecraft:model",
"model": "minecraft:item/bow_pulling_1"
}
},
{
"when": "2",
"model": {
"type": "minecraft:model",
"model": "minecraft:item/bow_pulling_2"
}
}
],
"fallback": {
"type": "minecraft:condition",
"on_false": {
"type": "minecraft:model",
"model": "minecraft:item/bow"
},
"on_true": {
"type": "minecraft:range_dispatch",
"entries": [
{
"model": {
"type": "minecraft:model",
"model": "minecraft:item/bow_pulling_0"
},
"threshold": 0.1
},
{
"model": {
"type": "minecraft:model",
"model": "minecraft:item/bow_pulling_1"
},
"threshold": 0.65
},
{
"model": {
"type": "minecraft:model",
"model": "minecraft:item/bow_pulling_2"
},
"threshold": 0.9
}
],
"fallback": {
"type": "minecraft:model",
"model": "minecraft:item/bow"
},
"property": "minecraft:use_duration",
"scale": 0.05
},
"property": "minecraft:using_item"
}
},
"hand_animation_on_swap": false
}
兼容性
- 具有赋予弓多重射击效果附魔的数据包或模组应将其附魔添加到
#dynamicbows:is_multishot 附魔标签中。具有此标签中附魔的弓将始终至少具有1个不确定性,并以1的比例继承运动。
- 具有检查
crit nbt 或使用 projectile_spawned 附魔修改箭矢运动 nbt 的数据包应改用 #dynamicbows:bow/on_projectile_spawned 函数标签,因为在执行附魔效果后,Dynamic Bows 会覆盖 crit 和 Motion。
Dynamic Bows is a datapack aiming to enhance bows and make them more versatile. It adds 2 new bow types, tweaks some bow enchantments, and adds new sounds for bows. It also functions as a library which allows other datapacks to create new bow weapons with fully customizable stats.
Bows
Shortbow
The Shortbow is a fast charging but weaker and less accurate bow. While charging a Shortbow, players can still sprint but at a reduced speed. It is crafted with 3 sticks and 1 string.
Can be given with the command /loot give @s loot dynamicbows:bows/shortbow

Longbow
The Longbow is a powerful bow which deals high damage, shoots further, and is more accurate, but takes longer to charge. It is crafted with 3 sticks, 3 string, and 2 iron nuggets.
Can be given with the command /loot give @s loot dynamicbows:bows/longbow

Enchantments
Quick Charge
Quick Charge now applies to bows! However, unlike normal Quick Charge, bows only gain an 11% charge time reduction per level instead of 25%.
Power
Power now increases ranged damage by 50% at level 1, and 25% for each level above 1 to ensure that both the Shortbow and Longbow stay within their intended damage ranges. This does not affect normal bow damage.
Other Features
Bow Sounds
Bows now have sounds when beginning to charge them and when fully charging them.
Modified Arrow Damage
Arrows bypass damage cooldown (immunity frames), allowing bows with very small charge times to still deal damage without needing to worry about damage cooldown.
Custom Bows
This datapack allows the creation of custom bows with custom stats by adding some data to the minecraft:custom_data component of any minecraft:bow item.
Example custom data component
{
"minecraft:custom_data": {
"ve": {
"components": {
"bow": {
"damage": 2,
"uncertainty": 1,
"power": 3,
"max_charge_time": 20,
"dynamic_animation": true,
"inherit_motion": true,
"inherit_motion_scale": 1,
"mob": {
"power_scale": 0.75,
"uncertainty_scale": 1,
"crit": false
},
"commands": {
"on_start_charging": "tellraw @a \"started charging!\"",
"on_charging": "tellraw @a \"charging!\"",
"on_fully_charged": "tellraw @a \"fully charged!\"",
"on_fired": "tellraw @a \"I shot a shot bow!\"",
"on_projectile_spawned": "tellraw @a \"arrow fired!\"",
"on_hit_event": "tellraw @a \"hit event!\"",
"on_hit_block": "tellraw @a \"hit a block!\""
}
}
}
}
}
}
Configuration
Basic Config
Basic bow configuration options. Any value here can be omitted.
damage: The base damage of the arrows fired from this bow. Defaults to 2.0
uncertainty: The maximum inaccuracy of the bow, in degrees. Defaults to 1.0
power: The velocity of fully charged shots, in blocks per tick. Defaults to 3.0
max_charge_time: The amount of time it takes for the bow to fully charge, in ticks. Defaults to 20. This value will default to a minimum of 3 if maximum charge time is below this value.
dynamic_animation: If the bow should dynamically play its draw animation based on its charge time. Defaults to true. Requires a specific item model configuration to work correctly.
inherit_motion: If arrows shot by this bow should inherit the motion of the shooter. Defaults to true.
inherit_motion_scale: Scales the motion of the shooter before applying it to shot arrows, if inherit_motion is set to true. Defaults to true.
Mob-Specific Config
These options control how mobs shoot the bow. Note that mobs are unaffected by the bow's max charge time, they will always fire at their vanilla rates.
power_scale: Scales the power value of the bow when shot by a mob. Defaults to 0.55.
uncertainty_scale: Scales the uncertainty value of the bow when shot by a mob. Defaults to 2.0.
crit: Whether or not arrows shot by mobs wielding this bow should be critical arrows. Defaults to false.
Commands
All commands run through this custom component have access to the bow's data, stored in the storage dynamicbows:temp bow, with the exception of on_hit_event and on_hit_block in which case it is stored in the arrow entity data under data.ve.shot_data.
The predicate dynamicbows:fully_charged can be used on players and arrows to detect if their bow is fully charged.
on_start_charging: Command to run on the first tick this bow is charged by a player.
on_charging: Command to run each tick the bow is charged by a player.
on_fully_charged: Command to run when the bow has been charged to the time specified in the max_charge_time field by a player.
on_fired: Command to run on the entity that fired the bow.
on_projectile_spawned : Command to run on arrows shot by the bow when it is fired.
on_hit_event: Command to run when an arrow from the bow hits an entity. Executes as and at the victim entity.
on_hit_block: Command to run when an arrow from the bow hits a block. Executes at the arrow entity.
Hit Event-Specific Functionality
Commands run from on_hit_event have access to extra predicates which allow for selection of all involved entities.
dynamicbows:hit_event/is_arrow: Tests if an entity is the arrow that was used during a hit.
dynamicbows:hit_event/is_attacker: Tests if an entity is the entity that shot the bow during a hit.
dynamicbows:hit_event/is_victim: Tests if an entity is the victim of an attack from another entity using the bow. The victim cannot be selected by a target selector if it was killed in the attack, so any commands run on the victim must use the @s selector if they were killed.
dynamicbows:hit_event/victim_killed: Tests if the victim was killed during a hit.
Function Tags
Each command field in custom bow configuration also has respective function tag, which can be taken advantage of in datapacks. These function tags always runs after bow-specific commands, and run regardless of the bow being used. Some extra tags are also included which do not have bow-specific events. Bow data can be retrieved in any of these function tags by running the dynamicbows:bow/get_current_bow_data function, which outputs the currently charged bow's data to the dynamicbows:temp bow storage, with the exception of on_hit_event and on_hit_block in which case it is stored in the arrow entity data under data.ve.shot_data and weapon.
#dynamicbows:bow/on_start_charging: Functions to run on the first tick this bow is charged by a player.
#dynamicbows:bow/on_charging: Functions to run each tick the bow is charged by a player.
#dynamicbows:bow/on_fully_charged: Functions to run when the bow has been charged to the time specified in the max_charge_time field by a player.
#dynamicbows:bow/on_fired: Functions to run on the entity that fired the bow.
#dynamicbows:bow/on_projectile_spawned : Functions to run on arrows shot by the bow when it is fired.
#dynamicbows:bow/on_hit_event: Functions to run when an arrow from the bow hits an entity. Executes as and at the victim entity. All hit event specific functionality applies to this tag.
#dynamicbows:bow/on_hit_block: Functions to run when an arrow from the bow hits a block. Executes at the arrow entity.
#dynamicbows:bow/modifies_charge_time: Functions that modify maximum charge time. These functions should modify the dynamicbows.bow.charge_time.max score of the player charging the bow.
#dynamicbows:bow/on_reset: Functions to run when a bow has stopped charging or has been shot.
Using Dynamic Animations
Item models must be set up specifically to support dynamic animations if they are enabled on the bow, using custom_model_data. It is also suggested to set hand_animation_swap to false to prevent the item from bobbing when changing frames. Like the vanilla bow, 4 separate models are needed, 1 for each charging stage (3 total) and 1 for the base item.
Example Model
{
"model": {
"type": "minecraft:select",
"property": "minecraft:custom_model_data",
"index": 0,
"cases": [
{
"when": "0",
"model": {
"type": "minecraft:model",
"model": "minecraft:item/bow_pulling_0"
}
},
{
"when": "1",
"model": {
"type": "minecraft:model",
"model": "minecraft:item/bow_pulling_1"
}
},
{
"when": "2",
"model": {
"type": "minecraft:model",
"model": "minecraft:item/bow_pulling_2"
}
}
],
"fallback": {
"type": "minecraft:condition",
"on_false": {
"type": "minecraft:model",
"model": "minecraft:item/bow"
},
"on_true": {
"type": "minecraft:range_dispatch",
"entries": [
{
"model": {
"type": "minecraft:model",
"model": "minecraft:item/bow_pulling_0"
},
"threshold": 0.1
},
{
"model": {
"type": "minecraft:model",
"model": "minecraft:item/bow_pulling_1"
},
"threshold": 0.65
},
{
"model": {
"type": "minecraft:model",
"model": "minecraft:item/bow_pulling_2"
},
"threshold": 0.9
}
],
"fallback": {
"type": "minecraft:model",
"model": "minecraft:item/bow"
},
"property": "minecraft:use_duration",
"scale": 0.05
},
"property": "minecraft:using_item"
}
},
"hand_animation_on_swap": false
}
Compatability
- Data packs or mods which have enchantments that grant multishot effects to bows should add their enchantments to the
#dynamicbows:is_multishot enchantment tag. Bows with enchantments in this tag will always have at minimum 1 uncertainty and will inherit motion at a scale of 1.
- Data packs which have enchantments that check for
crit nbt or modify arrow motion nbt with the projectile_spawned enchantment should instead use the #dynamicbows:bow/on_projectile_spawned function tag, as both crit and Motion are overwritten by Dynamic Bows after enchantment effects are executed.
评论 0
登录后参与评分
还没有评论,来抢沙发吧