本文整理汇总了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);
}
}
}
示例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.");
}
}
示例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);
}
}
}
示例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");
}
示例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);
}
}
示例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 );
}
示例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);
}
}
}
}
示例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);
}
}
}
}
示例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>();
}
示例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);
}
}
}
示例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);
}
}
示例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");
}
示例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...");
}
示例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();
}
}
示例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");
}