当前位置: 首页>>代码示例>>Java>>正文


Java SoundLoadEvent类代码示例

本文整理汇总了Java中net.minecraftforge.client.event.sound.SoundLoadEvent的典型用法代码示例。如果您正苦于以下问题:Java SoundLoadEvent类的具体用法?Java SoundLoadEvent怎么用?Java SoundLoadEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SoundLoadEvent类属于net.minecraftforge.client.event.sound包,在下文中一共展示了SoundLoadEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSoundLoad

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
@ForgeSubscribe
public void onSoundLoad(SoundLoadEvent event)
{

    // For each custom sound file we have defined in Sounds
    for (String soundFile : soundFiles)
    {
        // Try to add the custom sound file to the pool of sounds
        try
        {
            event.manager.addSound(soundFile);
        }
        // If we cannot add the custom sound file to the pool, log the exception
        catch (Exception e)
        {
            FMLLog.warning("Failed loading sound file: " + soundFile);
        }
    }
}
 
开发者ID:PaleoCrafter,项目名称:R0b0ts,代码行数:20,代码来源:SoundHandler.java

示例2: onSound

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
@ForgeSubscribe
public void onSound(SoundLoadEvent event) {
       try {
       	for (Sound sound : Sound.values()) {
       		if (!sound.isRandom()) {
       			event.manager.soundPoolSounds.addSound(sound.getName()+".ogg");
       		} else {
       			for (int i = 1; i <= sound.randomVariants; i++) {
       				event.manager.soundPoolSounds.addSound(sound.getName()+i+".ogg");
       			}
       		}
       	}
       }
       catch (Exception e) {
       	Dota2Items.logger.warning("Failed to register one or more sounds.");
       }
   }
 
开发者ID:Hunternif,项目名称:Dota2Items,代码行数:18,代码来源:ClientProxy.java

示例3: onSoundLoad

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
@ForgeSubscribe
public void onSoundLoad(SoundLoadEvent event)
{
    // For each custom sound file we have defined in Sounds
    for (String soundFile : Sounds.soundFiles)
    {
        // Try to add the custom sound file to the pool of sounds
        try
        {
            event.manager.addSound(Resources.MOD_ID + ":" + soundFile);
        }
        // If we cannot add the custom sound file to the pool, log the
        // exception
        catch (Exception e)
        {
            LogHelper.warning("Failed loading sound file: " + soundFile);
        }
    }
}
 
开发者ID:Dynious,项目名称:EnergyFromMatter,代码行数:20,代码来源:SoundHandler.java

示例4: onSoundLoad

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
@SubscribeEvent
    public void onSoundLoad(SoundLoadEvent event) 
	{
//            event.manager.addSound("yourmod:YourSound.ogg");//refers to: yourmod/sound/YourSound.ogg
//            event.manager.addSound("yourmod:optionalFile/YourSound.ogg");
//            event.manager.addSound("yourmod:optionalFile/optionalFile2/YourSound.ogg");
    }
 
开发者ID:GhostMonk3408,项目名称:MidgarCrusade,代码行数:8,代码来源:SoundHandler.java

示例5: onSound

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
public void onSound(SoundLoadEvent event) {
	try {
		for(String sound : sounds) {
			//event.manager.playSound(sound);
		}
	} catch (Exception e) {
		System.err.println("Failed to register one or more sounds.");
		System.err.println(e);
	}
}
 
开发者ID:NotGyro,项目名称:WeirdScience,代码行数:11,代码来源:EventSounds.java

示例6: onSoundLoad

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@ForgeSubscribe
public void onSoundLoad(SoundLoadEvent event) // NO_UCD (unused code)
{
    // Load sounds as required by event.
    this.loadItemSounds( event );
    this.loadTileEntitySounds( event );
}
 
开发者ID:Maxwolf,项目名称:MC-MineAPI.Java,代码行数:9,代码来源:SoundLoader.java

示例7: loadTileEntitySounds

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
private void loadTileEntitySounds(SoundLoadEvent event)
{
    // -----------
    // TILE ENTITY
    // -----------
    Iterable<TileEntityFactoryProduct> registeredMachines = TileEntityFactory.instance().getMachineInfoList();
    for (Iterator iterator = registeredMachines.iterator(); iterator.hasNext(); )
    {
        TileEntityFactoryProduct registeredMachine = (TileEntityFactoryProduct) iterator.next();
        if (registeredMachine != null)
        {
            // Grab processed list of filenames of sounds that need to be registered with Forge/MC.
            String[] unregisteredSounds = registeredMachine.loadSoundArchive();
            if (unregisteredSounds == null)
            {
                continue;
            }

            // Loop through the filenames and register them.
            for (String unregisteredSound : unregisteredSounds)
            {
                event.manager.addSound( unregisteredSound );
                //MadScience.logger.info("[" + registeredMachine.getMachineName() + "]Registering Sound:" + unregisteredSound);
            }
        }
    }
}
 
开发者ID:Maxwolf,项目名称:MC-MineAPI.Java,代码行数:28,代码来源:SoundLoader.java

示例8: loadItemSounds

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
private void loadItemSounds(SoundLoadEvent event)
{
    // -----
    // ITEMS
    // -----
    Iterable<ItemFactoryProduct> registeredItems = ItemFactory.instance().getItemInfoList();
    for (Iterator iterator = registeredItems.iterator(); iterator.hasNext(); )
    {
        ItemFactoryProduct registeredItem = (ItemFactoryProduct) iterator.next();
        if (registeredItem != null)
        {
            List<String> unregisteredSounds = new ArrayList<String>();

            // Loop through all sub-items.
            for (SubItemsArchive subItem : registeredItem.getSubItems())
            {
                // Skip items that have no sounds associated with them.
                String[] itemSounds = subItem.loadSoundArchive();
                if (itemSounds == null)
                {
                    continue;
                }

                // Load sound archive for each sub-item.
                for (String unloadedSound : itemSounds)
                {
                    unregisteredSounds.add( unloadedSound );
                }
            }

            // Loop through the filenames and register them.
            for (String unregisteredSound : unregisteredSounds)
            {
                event.manager.addSound( unregisteredSound );
                //MadScience.logger.info("[" + registeredMachine.getMachineName() + "]Registering Sound:" + unregisteredSound);
            }
        }
    }
}
 
开发者ID:Maxwolf,项目名称:MC-MineAPI.Java,代码行数:40,代码来源:SoundLoader.java

示例9: importSound

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
@SubscribeEvent
public void importSound(SoundLoadEvent event) {
	IC2NuclearControl ncInstance = IC2NuclearControl.instance;
	ncInstance.availableAlarms = new ArrayList<String>();

	try {
		List list = Minecraft
				.getMinecraft()
				.getResourceManager()
				.getAllResources(
						new ResourceLocation("nuclearcontrol",
								"sounds.json"));

		for (int i = list.size() - 1; i >= 0; --i) {
			IResource iresource = (IResource) list.get(i);

			try {
				Map map = (Map) gson.fromJson(new InputStreamReader(
						iresource.getInputStream()), type);
				Iterator iterator1 = map.entrySet().iterator();

				while (iterator1.hasNext()) {
					Entry entry = (Entry) iterator1.next();
					ncInstance.availableAlarms
							.add(((String) entry.getKey()).replace(
									"alarm-", ""));
				}
			} catch (RuntimeException runtimeexception) {
				;
			}
		}
	} catch (IOException ioexception) {
		;
	}

	ncInstance.serverAllowedAlarms = new ArrayList<String>();
}
 
开发者ID:xbony2,项目名称:Nuclear-Control,代码行数:38,代码来源:ClientTickHandler.java

示例10: onSoundLoad

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
@ForgeSubscribe
   public void onSoundLoad(SoundLoadEvent event) {
       // For each custom sound file we have defined in Sounds
       for (String soundFile : soundFiles) {
           // Try to add the custom sound file to the pool of sounds
           try {
           	event.manager.addSound(soundFile);
           }
           // If we cannot add the custom sound file to the pool, log the exception
           catch (Exception e) {
               FMLCommonHandler.instance().getFMLLogger().log(Level.WARNING, "Zero Quest failed loading sound file: " + soundFile);
           }
       }
}
 
开发者ID:NovaViper,项目名称:ZeroQuest,代码行数:15,代码来源:SoundManagerZQuest.java

示例11: onSound

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
@SubscribeEvent
   public void onSound(SoundLoadEvent evt){
	event=evt;

	try {
		addSounds();
	} catch (Exception e) {
		System.err.println("Failed to register one or more sounds: "+e);
	}
}
 
开发者ID:delta534,项目名称:Chisel,代码行数:11,代码来源:Sounds.java

示例12: onSound

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
@ForgeSubscribe
public void onSound(SoundLoadEvent event) {
  for(int i=1;i<26;i++)
    event.manager.soundPoolSounds.addSound("fysiksfun:rubble"+i+".ogg");
  event.manager.soundPoolSounds.addSound("fysiksfun:earthquake.ogg");
  for(int i=1;i<=7;i++)
    event.manager.soundPoolSounds.addSound("fysiksfun:woodCrack"+i+".ogg");
  for(int i=1;i<=2;i++)
    event.manager.soundPoolSounds.addSound("fysiksfun:timber"+i+".ogg");
}
 
开发者ID:mbrx,项目名称:FysiksFun,代码行数:11,代码来源:FFSounds.java

示例13: onSoundsLoaded

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@ForgeSubscribe
public void onSoundsLoaded(SoundLoadEvent event)
{
	
	//Sounds
	event.manager.addSound("skullforge:paint.ogg");
	event.manager.addSound("skullforge:remove.ogg");
	
	//Print Load Message to Console.
	System.out.println("[SkullForge] Loading Sound Manager...");
}
 
开发者ID:LanceShield,项目名称:SkullForge,代码行数:13,代码来源:SoundManager.java

示例14: onSoundLoad

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
@ForgeSubscribe
 public void onSoundLoad(SoundLoadEvent event)
 {
 	FMLCommonHandler.instance().getFMLLogger().log(Level.INFO, "[Decay] Loading sounds...");
 	try {
  	event.manager.addSound("decayingworld:rock1.ogg");
  	event.manager.addSound("decayingworld:rock2.ogg");
 	}
 	catch (Exception e) {
FMLCommonHandler.instance().getFMLLogger().log(Level.WARNING, "[Decay] Failed adding sound file.");
FMLCommonHandler.instance().getFMLLogger().log(Level.WARNING, "[Decay] " + e.getMessage());
e.printStackTrace();
 	}
 }
 
开发者ID:Draco18s,项目名称:Decaying-World,代码行数:15,代码来源:EventHandlerClient.java

示例15: onSoundsLoaded

import net.minecraftforge.client.event.sound.SoundLoadEvent; //导入依赖的package包/类
@ForgeSubscribe
   public void onSoundsLoaded(SoundLoadEvent event){
   	for (Sounds sound : Sounds.values()) {
   		addSound(event, sound);
   	}
	event.manager.soundPoolStreaming.addSound(Reference.MOD_ID + ":" + Strings.Disc1 + ".ogg");
       event.manager.soundPoolStreaming.addSound(Reference.MOD_ID + ":" + Strings.Disc2 + ".ogg");
       event.manager.soundPoolStreaming.addSound(Reference.MOD_ID + ":" + Strings.Disc3 + ".ogg");
       event.manager.soundPoolStreaming.addSound(Reference.MOD_ID + ":" + Strings.Disc4 + ".ogg");
       event.manager.soundPoolStreaming.addSound(Reference.MOD_ID + ":" + Strings.Disc5 + ".ogg");
       event.manager.soundPoolStreaming.addSound(Reference.MOD_ID + ":" + Strings.Disc6 + ".ogg");
       event.manager.soundPoolStreaming.addSound(Reference.MOD_ID + ":" + Strings.Disc7 + ".ogg");
       event.manager.soundPoolStreaming.addSound(Reference.MOD_ID + ":" + Strings.Disc8 + ".ogg");
       event.manager.soundPoolStreaming.addSound(Reference.MOD_ID + ":" + Strings.Disc9 + ".ogg");
}
 
开发者ID:Wehavecookies56,项目名称:Kingdom-Keys,代码行数:16,代码来源:SoundManager.java


注:本文中的net.minecraftforge.client.event.sound.SoundLoadEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。