信息
此数据包允许玩家选择一组预设音效,在受到伤害或死亡时播放。它还提供了添加自定义音效预设的简便方法,除了默认预设之外。
此数据包 不会 禁用原版受击音效,它只是在原版音效的基础上额外播放另一个音效。你可以使用资源包来移除或降低原版受击音效的音量。
默认音效预设:
- 无
- 狼
- 猫
- 村民
- 悦灵
- 蜜蜂
- 狗
- 僵尸
- 掠夺者
- 猪灵
- 末影人
- 咯吱声(Creaking)
- 金属
- 玻璃
- 空气
注意:遗憾的是,如果不使用资源包添加自定义音效,就无法更改显示的副标题。这意味着使用该数据包时,你可能会看到不准确的副标题。
添加你自己的音效预设
音效预设由 hitsoundpicker:preset_registries 标签中的函数定义。默认情况下,唯一的此类函数是 hitsoundpicker:register_default。要添加你自己的预设,可以创建自己的函数并将其添加到 hitsoundpicker:preset_registries,或者直接将这些预设添加到 hitsoundpicker:register_default 中。
在函数内部,音效预设通过调用 hitsoundpicker:api/register_preset 或 hitsoundpicker:api/register_preset_pitched 来定义。以下是两种调用的示例。
register_preset:
function hitsoundpicker:api/register_preset { \
"display": "Silverfish", \
"sound": "minecraft:entity.silverfish.hurt", \
"death_sound": "minecraft:entity.silverfish.death" \
}
register_preset_pitched:
function hitsoundpicker:api/register_preset_pitched { \
"display": "Wool", \
"sound": "minecraft:block.wool.break", \
"sound_pitch": 1.0, \
"death_sound": "minecraft:block.wool.break", \
"death_sound_pitch": 0.5 \
}
参数 display、sound 和 death_sound 在两个函数中是相同的:
display 是预设在选择菜单中显示的名称
sound 是玩家在受到普通伤害时播放的音效
death_sound 是玩家在死亡时播放的音效
参数 sound_pitch 和 death_sound_pitch 仅存在于 register_preset_pitched 中:
sound_pitch 是 sound 的播放速度
death_sound_pitch 是 death_sound 的播放速度
register_preset 是调用 register_preset_pitched 并将 sound_pitch 和 death_sound_pitch 都设置为 1.0 的简写形式。
音效预设将按照注册它们的函数调用的顺序显示在菜单中。
非原版音效也可以与该数据包配合使用,前提是所有人都拥有提供这些音效的必要资源包或模组。
其他
如有错误或建议,请在 Discord 上联系 @parax342
感谢 Minecraft Commands Discord 社区对本项目的帮助
Info
This datapack allows players to choose a preset of sounds to play when they're hit, or die. It also provides an easy way to add your own sound presets, in addition to the default ones.
This pack does not disable the vanilla hit sound, it simply plays another sound in addition to it. You can use a resource pack to remove, or decrease the sound of, the vanilla hit sound.
Default sound presets:
- None
- Wolf
- Cat
- Villager
- Allay
- Bee
- Dog
- Zombie
- Pillager
- Piglin
- Enderman
- Creaking
- Metal
- Glass
- Air
Note: unfortunately, you cannot change what subtitles are shown without using a resource pack to add custom sound effects. This means you may see inaccurate subtitles when using the pack.
Adding your own sound presets
Sound presets are defined by functions in the hitsoundpicker:preset_registries tag. By default, the only such function is hitsoundpicker:register_default. To add your own presets, you can create your own functions and add them to hitsoundpicker:preset_registries, or you can directly add the presets to hitsoundpicker:register_default.
Inside a function, sound presets are defined by either calling hitsoundpicker:api/register_preset or hitsoundpicker:api/register_preset_pitched. Below are examples of calls to both.
register_preset:
function hitsoundpicker:api/register_preset { \
"display": "Silverfish", \
"sound": "minecraft:entity.silverfish.hurt", \
"death_sound": "minecraft:entity.silverfish.death" \
}
register_preset_pitched:
function hitsoundpicker:api/register_preset_pitched { \
"display": "Wool", \
"sound": "minecraft:block.wool.break", \
"sound_pitch": 1.0, \
"death_sound": "minecraft:block.wool.break", \
"death_sound_pitch": 0.5 \
}
The arguments display, sound, and death_sound are the same across both functions:
display is what the preset will display as in the selection menu
sound is the sound that will play when the player takes regular damage
death_sound is the sound that will play when the player dies
The arguments sound_pitch and death_sound_pitch are present only in register_preset_pitched:
sound_pitch is the speed at which sound will play
death_sound_pitch is the speed at which death_sound will play
register_preset is a shorthand for calling register_preset_pitched with sound_pitch and death_sound_pitch both set to 1.0
Sound presets will show up in the menu in the order that the function calls to register them were made.
Non-vanilla sounds will also work with the datapack, assuming that everyone has the necessary resource pack or mod to provide the sounds.
Other
Contact me on discord @parax342 with bugs or suggestions
Thanks to the Minecraft Commands discord for helping with this project
评论 0
登录后参与评分
还没有评论,来抢沙发吧