net.minecraft.util.SoundEvent.setRegistryName()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(66)

本文整理了Java中net.minecraft.util.SoundEvent.setRegistryName()方法的一些代码示例,展示了SoundEvent.setRegistryName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SoundEvent.setRegistryName()方法的具体详情如下:
包路径:net.minecraft.util.SoundEvent
类名称:SoundEvent
方法名:setRegistryName

SoundEvent.setRegistryName介绍

暂无

代码示例

代码示例来源:origin: SlimeKnights/TinkersConstruct

private static SoundEvent sound(String name) {
 ResourceLocation location = Util.getResource(name);
 SoundEvent event = new SoundEvent(location);
 event.setRegistryName(location);
 sounds.add(event);
 return event;
}

代码示例来源:origin: Vazkii/Botania

private static SoundEvent makeSoundEvent(String name) {
  ResourceLocation loc = new ResourceLocation(LibMisc.MOD_ID, name);
  return new SoundEvent(loc).setRegistryName(loc);
}

代码示例来源:origin: TeamLapen/Vampirism

private static SoundEvent create(String soundNameIn) {
    ResourceLocation resourcelocation = new ResourceLocation(REFERENCE.MODID, soundNameIn);
    SoundEvent event = new SoundEvent(resourcelocation);
    event.setRegistryName(REFERENCE.MODID, soundNameIn.replaceAll("\\.", "_"));
    return event;
  }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

private static SoundEvent registerSound(String name) {
 //thanks for the help: https://github.com/Choonster/TestMod3/tree/162914a163c7fcb6bdd992917fcbc699584e40de/src/main/java/com/choonster/testmod3
 // and http://www.minecraftforge.net/forum/index.php?topic=38076.0
 final ResourceLocation res = new ResourceLocation(Const.MODID, name);
 SoundEvent sound = new SoundEvent(res);
 sound.setRegistryName(res);
 sounds.add(sound);
 return sound;
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

private static SoundEvent createSoundEvent(String soundName) {
    ResourceLocation registryName = new ResourceLocation(AncientWarfareNPC.MOD_ID, soundName);
    return new SoundEvent(registryName).setRegistryName(registryName);
  }
}

代码示例来源:origin: MrCrayfish/MrCrayfishDeviceMod

private static SoundEvent registerSound(String soundNameIn)
{
  ResourceLocation resource = new ResourceLocation(soundNameIn);
  SoundEvent sound = new SoundEvent(resource).setRegistryName(soundNameIn);
  return sound;
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

private static SoundEvent createSoundEvent(final String soundName) {
    final ResourceLocation soundID = new ResourceLocation(MODID, soundName);
    return new SoundEvent(soundID).setRegistryName(soundID);
  }
}

代码示例来源:origin: Silentine/GrimoireOfGaia

private static SoundEvent createSoundEvent(final String soundName) {
    ResourceLocation soundID = new ResourceLocation(GaiaReference.MOD_ID, soundName);
    return new SoundEvent(soundID).setRegistryName(soundID);
  }
}

代码示例来源:origin: thraaawn/CompactMachines

private static SoundEvent createSoundEvent(String name) {
  ResourceLocation loc = new ResourceLocation(CompactMachines3.MODID, name);
  SoundEvent event = new SoundEvent(loc).setRegistryName(loc);
  return event;
}

代码示例来源:origin: ldtteam/minecolonies

/**
   * Register a {@link SoundEvent}.
   *
   * @param soundName The SoundEvent's name without the minecolonies prefix
   * @return The SoundEvent
   */
  public static SoundEvent getSoundID(final String soundName)
  {
    return new SoundEvent(new ResourceLocation(Constants.MOD_ID, soundName)).setRegistryName(soundName);
  }
}

代码示例来源:origin: MrCrayfish/MrCrayfishFurnitureMod

private static SoundEvent registerSound(String soundNameIn)
{
  ResourceLocation resource = new ResourceLocation(soundNameIn);
  SoundEvent sound = new SoundEvent(resource).setRegistryName(soundNameIn);
  RegistrationHandler.Sounds.add(sound);
  return sound;
}

代码示例来源:origin: Glitchfiend/FamiliarFauna

private static SoundEvent registerSound(String soundName)
  {
    ResourceLocation location = new ResourceLocation(FamiliarFauna.MOD_ID, soundName);
    SoundEvent event = new SoundEvent(location);
    event.setRegistryName(location);
    ForgeRegistries.SOUND_EVENTS.register(event);
    return event;
  }
}

代码示例来源:origin: Darkhax-Minecraft/Bookshelf

/**
 * Registers a new sound with the game. The sound must also exist in the sounds.json file.
 *
 * @param name The name of the sound file. No upper case chars!
 * @return The sound event that was registered.
 */
public SoundEvent registerSound (String name) {
  final ResourceLocation id = new ResourceLocation(this.modid, name);
  final SoundEvent sound = new SoundEvent(id).setRegistryName(id);
  this.sounds.add(sound);
  return sound;
}

代码示例来源:origin: sinkillerj/ProjectE

private static void registerSound(IForgeRegistry<SoundEvent> registry, String soundName)
{
  ResourceLocation name = new ResourceLocation(PECore.MODID, soundName);
  registry.register(new SoundEvent(name).setRegistryName(name));
}

代码示例来源:origin: CoFH/ThermalDynamics

private static SoundEvent registerSoundEvent(String id) {
  SoundEvent sound = new SoundEvent(new ResourceLocation(ThermalDynamics.MOD_ID + ":" + id));
  sound.setRegistryName(id);
  ForgeRegistries.SOUND_EVENTS.register(sound);
  return sound;
}

代码示例来源:origin: CoFH/ThermalFoundation

private static SoundEvent registerSoundEvent(String id) {
  SoundEvent sound = new SoundEvent(new ResourceLocation(ThermalFoundation.MOD_ID + ":" + id));
  sound.setRegistryName(id);
  ForgeRegistries.SOUND_EVENTS.register(sound);
  return sound;
}

代码示例来源:origin: CoFH/ThermalExpansion

private static SoundEvent registerSoundEvent(String id) {
  SoundEvent sound = new SoundEvent(new ResourceLocation(ThermalExpansion.MOD_ID + ":" + id));
  sound.setRegistryName(id);
  ForgeRegistries.SOUND_EVENTS.register(sound);
  return sound;
}

代码示例来源:origin: SleepyTrousers/EnderIO

@SubscribeEvent
public static void registerSounds(@Nonnull ModSoundRegisterEvent event) {
 for (SoundRegistry soundRegistry : values()) {
  if (SoundEvent.REGISTRY.containsKey(soundRegistry.resourceLocation)) {
   soundRegistry.soundEvent = event.getRegistry().getValue(soundRegistry.resourceLocation);
  } else {
   SoundEvent soundEvent_nullchecked = soundRegistry.soundEvent = new SoundEvent(soundRegistry.resourceLocation);
   event.getRegistry().register(soundEvent_nullchecked.setRegistryName(soundRegistry.resourceLocation));
  }
 }
}

代码示例来源:origin: gr8pefish/IronBackpacks

@SubscribeEvent
public static void registerSounds(RegistryEvent.Register<SoundEvent> event) {
  event.getRegistry().register(new SoundEvent(new ResourceLocation(IronBackpacks.MODID, "open_backpack")).setRegistryName("open_backpack"));
  event.getRegistry().register(new SoundEvent(new ResourceLocation(IronBackpacks.MODID, "close_backpack")).setRegistryName("close_backpack"));
}

代码示例来源:origin: SleepyTrousers/EnderIO

@SubscribeEvent
public static void registerSounds(@Nonnull ModSoundRegisterEvent event) {
 for (SoundRegistry soundRegistry : values()) {
  if (SoundEvent.REGISTRY.containsKey(soundRegistry.resourceLocation)) {
   soundRegistry.soundEvent = event.getRegistry().getValue(soundRegistry.resourceLocation);
  } else {
   SoundEvent soundEvent_nullchecked = soundRegistry.soundEvent = new SoundEvent(soundRegistry.resourceLocation);
   event.getRegistry().register(soundEvent_nullchecked.setRegistryName(soundRegistry.resourceLocation));
  }
 }
}

相关文章

微信公众号

最新文章

更多