Sound.java
net.minecraft.client.resources.sounds.Sound
信息
- 全限定名:net.minecraft.client.resources.sounds.Sound
- 类型:public class
- 包:net.minecraft.client.resources.sounds
- 源码路径:src/main/java/net/minecraft/client/resources/sounds/Sound.java
- 起始行号:L14
- 实现:Weighted
- 职责:
TODO
字段/常量
-
SOUND_LISTER- 类型:
FileToIdConverter - 修饰符:
public static final - 源码定位:
L15 - 说明:
TODO
- 类型:
-
location- 类型:
Identifier - 修饰符:
private final - 源码定位:
L16 - 说明:
TODO
- 类型:
-
volume- 类型:
SampledFloat - 修饰符:
private final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
pitch- 类型:
SampledFloat - 修饰符:
private final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
weight- 类型:
int - 修饰符:
private final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
type- 类型:
Sound.Type - 修饰符:
private final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
stream- 类型:
boolean - 修饰符:
private final - 源码定位:
L21 - 说明:
TODO
- 类型:
-
preload- 类型:
boolean - 修饰符:
private final - 源码定位:
L22 - 说明:
TODO
- 类型:
-
attenuationDistance- 类型:
int - 修饰符:
private final - 源码定位:
L23 - 说明:
TODO
- 类型:
内部类/嵌套类型
net.minecraft.client.resources.sounds.Sound.Type- 类型:
enum - 修饰符:
public static - 源码定位:
L92 - 说明:
TODO
- 类型:
构造器
public Sound(Identifier location, SampledFloat volume, SampledFloat pitch, int weight, Sound.Type type, boolean stream, boolean preload, int attenuationDistance) @ L25
- 构造器名:Sound
- 源码定位:L25
- 修饰符:public
参数:
- location: Identifier
- volume: SampledFloat
- pitch: SampledFloat
- weight: int
- type: Sound.Type
- stream: boolean
- preload: boolean
- attenuationDistance: int
说明:
TODO
方法
下面的方法块按源码顺序生成。
public Identifier getLocation() @ L38
- 方法名:getLocation
- 源码定位:L38
- 返回类型:Identifier
- 修饰符:public
参数:
- 无
说明:
TODO
public Identifier getPath() @ L42
- 方法名:getPath
- 源码定位:L42
- 返回类型:Identifier
- 修饰符:public
参数:
- 无
说明:
TODO
public SampledFloat getVolume() @ L46
- 方法名:getVolume
- 源码定位:L46
- 返回类型:SampledFloat
- 修饰符:public
参数:
- 无
说明:
TODO
public SampledFloat getPitch() @ L50
- 方法名:getPitch
- 源码定位:L50
- 返回类型:SampledFloat
- 修饰符:public
参数:
- 无
说明:
TODO
public int getWeight() @ L54
- 方法名:getWeight
- 源码定位:L54
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public Sound getSound(RandomSource random) @ L59
- 方法名:getSound
- 源码定位:L59
- 返回类型:Sound
- 修饰符:public
参数:
- random: RandomSource
说明:
TODO
public void preloadIfRequired(SoundEngine soundEngine) @ L63
- 方法名:preloadIfRequired
- 源码定位:L63
- 返回类型:void
- 修饰符:public
参数:
- soundEngine: SoundEngine
说明:
TODO
public Sound.Type getType() @ L70
- 方法名:getType
- 源码定位:L70
- 返回类型:Sound.Type
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean shouldStream() @ L74
- 方法名:shouldStream
- 源码定位:L74
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean shouldPreload() @ L78
- 方法名:shouldPreload
- 源码定位:L78
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public int getAttenuationDistance() @ L82
- 方法名:getAttenuationDistance
- 源码定位:L82
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public String toString() @ L86
- 方法名:toString
- 源码定位:L86
- 返回类型:String
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class Sound implements Weighted<Sound> {
public static final FileToIdConverter SOUND_LISTER = new FileToIdConverter("sounds", ".ogg");
private final Identifier location;
private final SampledFloat volume;
private final SampledFloat pitch;
private final int weight;
private final Sound.Type type;
private final boolean stream;
private final boolean preload;
private final int attenuationDistance;
public Sound(
Identifier location, SampledFloat volume, SampledFloat pitch, int weight, Sound.Type type, boolean stream, boolean preload, int attenuationDistance
) {
this.location = location;
this.volume = volume;
this.pitch = pitch;
this.weight = weight;
this.type = type;
this.stream = stream;
this.preload = preload;
this.attenuationDistance = attenuationDistance;
}
public Identifier getLocation() {
return this.location;
}
public Identifier getPath() {
return SOUND_LISTER.idToFile(this.location);
}
public SampledFloat getVolume() {
return this.volume;
}
public SampledFloat getPitch() {
return this.pitch;
}
@Override
public int getWeight() {
return this.weight;
}
public Sound getSound(RandomSource random) {
return this;
}
@Override
public void preloadIfRequired(SoundEngine soundEngine) {
if (this.preload) {
soundEngine.requestPreload(this);
}
}
public Sound.Type getType() {
return this.type;
}
public boolean shouldStream() {
return this.stream;
}
public boolean shouldPreload() {
return this.preload;
}
public int getAttenuationDistance() {
return this.attenuationDistance;
}
@Override
public String toString() {
return "Sound[" + this.location + "]";
}
@OnlyIn(Dist.CLIENT)
public static enum Type {
FILE("file"),
SOUND_EVENT("event");
private final String name;
private Type(String name) {
this.name = name;
}
public static Sound.@Nullable Type getByName(String name) {
for (Sound.Type type : values()) {
if (type.name.equals(name)) {
return type;
}
}
return null;
}
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
字段/构造调用 - 关联成员:
FileToIdConverter()
- 引用位置:
-
- 引用位置:
参数/字段/返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/字段/返回值
- 引用位置: