Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. package omtteam.openmodularturrets.init;
  2.  
  3. import net.minecraft.util.ResourceLocation;
  4. import net.minecraft.util.SoundEvent;
  5.  
  6. import java.lang.reflect.Field;
  7.  
  8.  
  9. /**
  10. * Created by Keridos on 24/11/16.
  11. * This Class handles all the sounds in the mod.
  12. */
  13. public class ModSounds {
  14. public static SoundEvent turretDeploySound;
  15. public static SoundEvent turretRetractSound;
  16. public static SoundEvent bulletHitSound;
  17. public static SoundEvent railGunHitSound;
  18. public static SoundEvent laserHitSound;
  19. public static SoundEvent disposableLaunchSound;
  20. public static SoundEvent grenadeLaunchSound;
  21. public static SoundEvent machinegunLaunchSound;
  22. public static SoundEvent incendiaryLaunchSound;
  23. public static SoundEvent laserLaunchSound;
  24. public static SoundEvent potatoLaunchSound;
  25. public static SoundEvent railgunLaunchSound;
  26. public static SoundEvent relativisticLaunchSound;
  27. public static SoundEvent rocketLaunchSound;
  28. public static SoundEvent teleportLaunchSound;
  29. public static SoundEvent turretWarnSound;
  30.  
  31.  
  32. public static void init() {
  33. int size = SoundEvent.REGISTRY.getKeys().size();
  34. turretDeploySound = new SoundEvent(new ResourceLocation("openmodularturrets", "turret_deploy"));
  35. turretRetractSound = new SoundEvent(new ResourceLocation("openmodularturrets", "turret_retract"));
  36. bulletHitSound = new SoundEvent(new ResourceLocation("openmodularturrets", "bullet_hit"));
  37. railGunHitSound = new SoundEvent(new ResourceLocation("openmodularturrets", "rail_gun_hit"));
  38. laserHitSound = new SoundEvent(new ResourceLocation("openmodularturrets", "laser_hit"));
  39. disposableLaunchSound = new SoundEvent(new ResourceLocation("openmodularturrets", "disposable"));
  40. grenadeLaunchSound = new SoundEvent(new ResourceLocation("openmodularturrets", "grenade"));
  41. machinegunLaunchSound = new SoundEvent(new ResourceLocation("openmodularturrets", "machine_gun"));
  42. incendiaryLaunchSound = new SoundEvent(new ResourceLocation("openmodularturrets", "incendiary"));
  43. laserLaunchSound = new SoundEvent(new ResourceLocation("openmodularturrets", "laser"));
  44. potatoLaunchSound = new SoundEvent(new ResourceLocation("openmodularturrets", "potato"));
  45. railgunLaunchSound = new SoundEvent(new ResourceLocation("openmodularturrets", "rail_gun"));
  46. relativisticLaunchSound = new SoundEvent(new ResourceLocation("openmodularturrets", "relativistic"));
  47. rocketLaunchSound = new SoundEvent(new ResourceLocation("openmodularturrets", "rocket"));
  48. teleportLaunchSound = new SoundEvent(new ResourceLocation("openmodularturrets", "teleport"));
  49.  
  50. registerSounds();
  51. }
  52.  
  53. public static void registerSounds() {
  54. int size = SoundEvent.REGISTRY.getKeys().size();
  55. for (Field field : ModSounds.class.getDeclaredFields()) {
  56. if (field.getType() == SoundEvent.class) {
  57. try {
  58. SoundEvent soundEvent = (SoundEvent) field.get(null);
  59. SoundEvent.REGISTRY.register(size, soundEvent.getRegistryName(), soundEvent);
  60. size++;
  61. } catch (Exception e) {
  62. e.printStackTrace();
  63. }
  64. }
  65. }
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement