Mekanism-tilera-Edition/common/mekanism/client/sound/PlayerSound.java

50 lines
830 B
Java
Raw Normal View History

2013-12-06 21:26:44 +01:00
package mekanism.client.sound;
2013-12-22 07:04:35 +01:00
import mekanism.api.Pos3D;
2013-12-06 21:26:44 +01:00
import net.minecraft.entity.player.EntityPlayer;
2013-12-08 05:51:07 +01:00
import net.minecraft.world.World;
2013-12-06 21:26:44 +01:00
public abstract class PlayerSound extends Sound
{
/** The TileEntity this sound is associated with. */
public EntityPlayer player;
2013-12-06 21:26:44 +01:00
public PlayerSound(String id, String sound, EntityPlayer entity)
{
2013-12-22 07:04:35 +01:00
super(id, sound, entity, new Pos3D(entity));
2013-12-06 21:26:44 +01:00
player = entity;
}
2013-12-06 21:26:44 +01:00
@Override
public float getMultiplier()
{
return super.getMultiplier()*0.3F;
2013-12-06 21:26:44 +01:00
}
2013-12-08 05:51:07 +01:00
@Override
public boolean update(World world)
{
if(player.isDead)
{
return false;
}
else if(player.worldObj != world)
{
return false;
}
else if(!world.loadedEntityList.contains(player))
{
return false;
}
2013-12-08 05:51:07 +01:00
return true;
}
2013-12-06 21:26:44 +01:00
@Override
2013-12-22 07:04:35 +01:00
public Pos3D getLocation()
2013-12-06 21:26:44 +01:00
{
2013-12-22 07:04:35 +01:00
return new Pos3D(player);
2013-12-06 21:26:44 +01:00
}
}