Spaces:
Build error
Build error
File size: 1,370 Bytes
d46f4a3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
package net.minecraft.client.resources.sounds;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.entity.animal.sniffer.Sniffer;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class SnifferSoundInstance extends AbstractTickableSoundInstance {
private static final float VOLUME = 1.0F;
private static final float PITCH = 1.0F;
private final Sniffer sniffer;
public SnifferSoundInstance(Sniffer p_273565_) {
super(SoundEvents.SNIFFER_DIGGING, SoundSource.NEUTRAL, SoundInstance.createUnseededRandom());
this.sniffer = p_273565_;
this.attenuation = SoundInstance.Attenuation.LINEAR;
this.looping = false;
this.delay = 0;
}
@Override
public boolean canPlaySound() {
return !this.sniffer.isSilent();
}
@Override
public void tick() {
if (!this.sniffer.isRemoved() && this.sniffer.getTarget() == null && this.sniffer.canPlayDiggingSound()) {
this.x = (double)((float)this.sniffer.getX());
this.y = (double)((float)this.sniffer.getY());
this.z = (double)((float)this.sniffer.getZ());
this.volume = 1.0F;
this.pitch = 1.0F;
} else {
this.stop();
}
}
} |