Search in sources :

Example 1 with SoundHandler

use of net.minecraft.client.audio.SoundHandler in project ForestryMC by ForestryMC.

the class SoundUtil method playSoundEvent.

@SideOnly(Side.CLIENT)
public static void playSoundEvent(SoundEvent soundIn, float pitchIn) {
    Minecraft minecraft = Minecraft.getMinecraft();
    SoundHandler soundHandler = minecraft.getSoundHandler();
    PositionedSoundRecord sound = PositionedSoundRecord.getMasterRecord(soundIn, pitchIn);
    soundHandler.playSound(sound);
}
Also used : PositionedSoundRecord(net.minecraft.client.audio.PositionedSoundRecord) SoundHandler(net.minecraft.client.audio.SoundHandler) Minecraft(net.minecraft.client.Minecraft) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with SoundHandler

use of net.minecraft.client.audio.SoundHandler in project BetterRain by OreCruncher.

the class DynSurroundConfigGui method generateSoundList.

protected void generateSoundList(final ConfigCategory cat) {
    cat.setRequiresMcRestart(false);
    cat.setRequiresWorldRestart(false);
    final SoundHandler handler = Minecraft.getMinecraft().getSoundHandler();
    final List<String> sounds = new ArrayList<String>();
    for (final Object resource : handler.sndRegistry.getKeys()) sounds.add(resource.toString());
    Collections.sort(sounds);
    for (final String sound : sounds) {
        final Property prop = new Property(sound, "false", Property.Type.BOOLEAN);
        prop.setDefaultValue(false);
        prop.setRequiresMcRestart(false);
        prop.setRequiresWorldRestart(false);
        prop.set(SoundRegistry.isSoundBlocked(sound));
        cat.put(sound, prop);
    }
}
Also used : SoundHandler(net.minecraft.client.audio.SoundHandler) ArrayList(java.util.ArrayList) Property(net.minecraftforge.common.config.Property)

Example 3 with SoundHandler

use of net.minecraft.client.audio.SoundHandler in project BetterRain by OreCruncher.

the class SoundBlockHandler method soundConfigReload.

@SubscribeEvent
public void soundConfigReload(final SoundConfigEvent.Reload event) {
    this.soundsToBlock.clear();
    this.soundCull.clear();
    final SoundHandler handler = Minecraft.getMinecraft().getSoundHandler();
    for (final Object resource : handler.sndRegistry.getKeys()) {
        final String rs = resource.toString();
        if (SoundRegistry.isSoundBlocked(rs)) {
            ModLog.debug("Blocking sound '%s'", rs);
            this.soundsToBlock.add(rs);
        } else if (SoundRegistry.isSoundCulled(rs)) {
            ModLog.debug("Culling sound '%s'", rs);
            this.soundCull.put(rs, -ModOptions.soundCullingThreshold);
        }
    }
}
Also used : SoundHandler(net.minecraft.client.audio.SoundHandler) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 4 with SoundHandler

use of net.minecraft.client.audio.SoundHandler in project Armourers-Workshop by RiskyKen.

the class GuiList method mouseClicked.

public boolean mouseClicked(int mouseX, int mouseY, int button) {
    if (!this.visible) {
        return false;
    }
    for (int i = 0; i < listItems.size(); i++) {
        int yLocation = y - scrollAmount + 2 + i * slotHeight;
        if (mouseY >= y & mouseY <= y + height - 2) {
            if (listItems.get(i).mousePressed(fontRenderer, x + 2, yLocation, mouseX, mouseY, button, width)) {
                SoundHandler sh = mc.getSoundHandler();
                sh.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
                selectedIndex = i;
                return true;
            }
        }
    }
    return false;
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) SoundHandler(net.minecraft.client.audio.SoundHandler)

Example 5 with SoundHandler

use of net.minecraft.client.audio.SoundHandler in project BetterRain by OreCruncher.

the class ProxyClient method postInit.

@Override
public void postInit(final FMLPostInitializationEvent event) {
    super.postInit(event);
    if (ModOptions.enableDebugLogging) {
        final SoundHandler handler = Minecraft.getMinecraft().getSoundHandler();
        final List<String> sounds = new ArrayList<String>();
        for (final Object resource : handler.sndRegistry.getKeys()) sounds.add(resource.toString());
        Collections.sort(sounds);
        ModLog.info("*** SOUND REGISTRY ***");
        for (final String sound : sounds) ModLog.info(sound);
        ModLog.info("*** REGISTERED BLOCK NAMES ***");
        final GenerateBlockReport report = new GenerateBlockReport();
        for (final String entry : report.getBlockNames()) {
            ModLog.info(entry);
        }
        ForgeDictionary.dumpOreNames();
    }
}
Also used : GenerateBlockReport(org.blockartistry.mod.DynSurround.client.footsteps.game.user.GenerateBlockReport) SoundHandler(net.minecraft.client.audio.SoundHandler) ArrayList(java.util.ArrayList)

Aggregations

SoundHandler (net.minecraft.client.audio.SoundHandler)7 ArrayList (java.util.ArrayList)3 Property (net.minecraftforge.common.config.Property)2 Minecraft (net.minecraft.client.Minecraft)1 PositionedSoundRecord (net.minecraft.client.audio.PositionedSoundRecord)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1 GenerateBlockReport (org.blockartistry.mod.DynSurround.client.footsteps.game.user.GenerateBlockReport)1