mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-20 03:59:37 +00:00
48 lines
992 B
Java
48 lines
992 B
Java
package mekanism.common.base;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
import mekanism.client.sound.IResettableSound;
|
|
import mekanism.client.sound.ISoundSource;
|
|
import mekanism.client.sound.SoundHandler;
|
|
import mekanism.client.sound.TileSound;
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
public class SoundWrapper
|
|
{
|
|
@SideOnly(Side.CLIENT)
|
|
public IResettableSound sound;
|
|
|
|
public SoundWrapper(IHasSound tile, ISoundSource source)
|
|
{
|
|
try {
|
|
sound = new TileSound(tile, source);
|
|
} catch(Throwable t) {}
|
|
}
|
|
|
|
public SoundWrapper(IHasSound tile, ISoundSource source, ResourceLocation location)
|
|
{
|
|
try {
|
|
sound = new TileSound(tile, source, location);
|
|
} catch(Throwable t) {}
|
|
}
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
public void reset()
|
|
{
|
|
sound.reset();
|
|
}
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
public void play()
|
|
{
|
|
SoundHandler.playSound(sound);
|
|
}
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
public boolean canRestart()
|
|
{
|
|
return SoundHandler.canRestartSound(sound);
|
|
}
|
|
}
|