GuardianAttackSoundInstance.java
net.minecraft.client.resources.sounds.GuardianAttackSoundInstance
信息
- 全限定名:net.minecraft.client.resources.sounds.GuardianAttackSoundInstance
- 类型:public class
- 包:net.minecraft.client.resources.sounds
- 源码路径:src/main/java/net/minecraft/client/resources/sounds/GuardianAttackSoundInstance.java
- 起始行号:L10
- 继承:AbstractTickableSoundInstance
- 职责:
TODO
字段/常量
-
VOLUME_MIN- 类型:
float - 修饰符:
private static final - 源码定位:
L11 - 说明:
TODO
- 类型:
-
VOLUME_SCALE- 类型:
float - 修饰符:
private static final - 源码定位:
L12 - 说明:
TODO
- 类型:
-
PITCH_MIN- 类型:
float - 修饰符:
private static final - 源码定位:
L13 - 说明:
TODO
- 类型:
-
PITCH_SCALE- 类型:
float - 修饰符:
private static final - 源码定位:
L14 - 说明:
TODO
- 类型:
-
guardian- 类型:
Guardian - 修饰符:
private final - 源码定位:
L15 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public GuardianAttackSoundInstance(Guardian guardian) @ L17
- 构造器名:GuardianAttackSoundInstance
- 源码定位:L17
- 修饰符:public
参数:
- guardian: Guardian
说明:
TODO
方法
下面的方法块按源码顺序生成。
public boolean canPlaySound() @ L25
- 方法名:canPlaySound
- 源码定位:L25
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public void tick() @ L30
- 方法名:tick
- 源码定位:L30
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class GuardianAttackSoundInstance extends AbstractTickableSoundInstance {
private static final float VOLUME_MIN = 0.0F;
private static final float VOLUME_SCALE = 1.0F;
private static final float PITCH_MIN = 0.7F;
private static final float PITCH_SCALE = 0.5F;
private final Guardian guardian;
public GuardianAttackSoundInstance(Guardian guardian) {
super(SoundEvents.GUARDIAN_ATTACK, SoundSource.HOSTILE, SoundInstance.createUnseededRandom());
this.guardian = guardian;
this.attenuation = SoundInstance.Attenuation.NONE;
this.looping = true;
this.delay = 0;
}
@Override
public boolean canPlaySound() {
return !this.guardian.isSilent();
}
@Override
public void tick() {
if (!this.guardian.isRemoved() && this.guardian.getTarget() == null) {
this.x = (float)this.guardian.getX();
this.y = (float)this.guardian.getY();
this.z = (float)this.guardian.getZ();
float scale = this.guardian.getAttackAnimationScale(0.0F);
this.volume = 0.0F + 1.0F * scale * scale;
this.pitch = 0.7F + 0.5F * scale;
} else {
this.stop();
}
}
}引用的其他类
-
- 引用位置:
继承
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
SoundInstance.createUnseededRandom()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置: