SoundType

预计阅读时间: 小于 1 分钟

概述

SoundType 定义了方块被交互时发出的声音,包括放置、破坏、行走等操作。

预定义声音类型

SoundType.STONE      // 石头声音
SoundType.GRASS      // 草方块声音
SoundType.GRAVEL     // 砂砾声音
SoundType.WOOD       // 木头声音
SoundType.WOOL       // 羊毛声音
SoundType.SAND       // 沙子声音
SoundType.SNOW       // 雪声音
SoundType.LADDER     // 梯子声音
SoundType.ANVIL      // 铁砧声音
SoundType.SLIME_BLOCK // 粘液块声音
SoundType.HONEY_BLOCK // 蜂蜜块声音

在方块注册中使用

StartupEvents.registry('block', event => {
  event.create('custom_wood')
    .displayName('Custom Wood')
    .material('wood')
    .soundType('wood')
})