/* * Decompiled with CFR 0.152. */ package net.minecraft.client.resources.sounds; import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; public class EntityBoundSoundInstance extends AbstractTickableSoundInstance { private final Entity entity; public EntityBoundSoundInstance(SoundEvent event, SoundSource source, float volume, float pitch, Entity entity, long seed) { super(event, source, RandomSource.create(seed)); this.volume = volume; this.pitch = pitch; this.entity = entity; this.x = (float)this.entity.getX(); this.y = (float)this.entity.getY(); this.z = (float)this.entity.getZ(); } @Override public boolean canPlaySound() { return !this.entity.isSilent(); } @Override public void tick() { if (this.entity.isRemoved()) { this.stop(); return; } this.x = (float)this.entity.getX(); this.y = (float)this.entity.getY(); this.z = (float)this.entity.getZ(); } }