Make things like the ExtraUtils muffler actually have an effect on our machines. VERY HACKY.

This commit is contained in:
Ben Spiers 2014-08-20 01:30:31 +01:00
parent 6b4ef3bb50
commit c24c11cb33

View file

@ -7,7 +7,11 @@ import mekanism.api.Pos3D;
import mekanism.client.MekanismClient; import mekanism.client.MekanismClient;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.ISound.AttenuationType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.ForgeHooksClient;
public abstract class Sound public abstract class Sound
{ {
@ -78,6 +82,9 @@ public abstract class Sound
return; return;
} }
ISound sound = ForgeHooksClient.playSound(SoundHandler.getSoundManager(), new DummySound());
if (!(sound instanceof DummySound)) return;
ticksSincePlay = 0; ticksSincePlay = 0;
if(SoundHandler.getSoundSystem() != null) if(SoundHandler.getSoundSystem() != null)
@ -184,4 +191,61 @@ public abstract class Sound
} catch(Exception e) {} } catch(Exception e) {}
} }
} }
public class DummySound implements ISound
{
@Override
public ResourceLocation getPositionedSoundLocation()
{
return new ResourceLocation("mekanism", "sound.ogg");
}
@Override
public boolean canRepeat()
{
return false;
}
@Override
public int getRepeatDelay()
{
return 0;
}
@Override
public float getVolume()
{
return 1;
}
@Override
public float getPitch()
{
return 0;
}
@Override
public float getXPosF()
{
return (float)getLocation().xPos;
}
@Override
public float getYPosF()
{
return (float)getLocation().yPos;
}
@Override
public float getZPosF()
{
return (float)getLocation().zPos;
}
@Override
public AttenuationType getAttenuationType()
{
return AttenuationType.LINEAR;
}
}
} }