DirectionalSoundInstance.java
net.minecraft.client.resources.sounds.DirectionalSoundInstance
信息
- 全限定名:net.minecraft.client.resources.sounds.DirectionalSoundInstance
- 类型:public class
- 包:net.minecraft.client.resources.sounds
- 源码路径:src/main/java/net/minecraft/client/resources/sounds/DirectionalSoundInstance.java
- 起始行号:L12
- 继承:AbstractTickableSoundInstance
- 职责:
TODO
字段/常量
-
camera- 类型:
Camera - 修饰符:
private final - 源码定位:
L13 - 说明:
TODO
- 类型:
-
xAngle- 类型:
float - 修饰符:
private final - 源码定位:
L14 - 说明:
TODO
- 类型:
-
yAngle- 类型:
float - 修饰符:
private final - 源码定位:
L15 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public DirectionalSoundInstance(SoundEvent event, SoundSource source, RandomSource random, Camera camera, float xAngle, float yAngle) @ L17
- 构造器名:DirectionalSoundInstance
- 源码定位:L17
- 修饰符:public
参数:
- event: SoundEvent
- source: SoundSource
- random: RandomSource
- camera: Camera
- xAngle: float
- yAngle: float
说明:
TODO
方法
下面的方法块按源码顺序生成。
private void setPosition() @ L25
- 方法名:setPosition
- 源码定位:L25
- 返回类型:void
- 修饰符:private
参数:
- 无
说明:
TODO
public void tick() @ L33
- 方法名:tick
- 源码定位:L33
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class DirectionalSoundInstance extends AbstractTickableSoundInstance {
private final Camera camera;
private final float xAngle;
private final float yAngle;
public DirectionalSoundInstance(SoundEvent event, SoundSource source, RandomSource random, Camera camera, float xAngle, float yAngle) {
super(event, source, random);
this.camera = camera;
this.xAngle = xAngle;
this.yAngle = yAngle;
this.setPosition();
}
private void setPosition() {
Vec3 direction = Vec3.directionFromRotation(this.xAngle, this.yAngle).scale(10.0);
this.x = this.camera.position().x + direction.x;
this.y = this.camera.position().y + direction.y;
this.z = this.camera.position().z + direction.z;
this.attenuation = SoundInstance.Attenuation.NONE;
}
@Override
public void tick() {
this.setPosition();
}
}引用的其他类
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Vec3.directionFromRotation()
- 引用位置: