mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-20 03:59:37 +00:00
After much client code isolation, there should be no more issues on the server side with sounds
This commit is contained in:
1 parent
12b6b4610b
commit
339e048a4e
9 files changed
+103
-41
No files matched your search
@@ -0,0 +1,47 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user