Guest User

PixelEngineRegistry.class

a guest
Sep 30th, 2016
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.15 KB | None | 0 0
  1. public class PixelEngineRegistry {
  2.    
  3.     //this was static first time
  4.     private final Map<String,SoundManager>sndmngs=new HashMap<String,SoundManager>();
  5.    
  6.     public void registerSoundManager(String id, SoundManager sndmng){
  7.         if(!id.equals("")&&!id.equals(" ")){
  8.             sndmngs.put(id, sndmng);
  9.             PixelEngine.LOGGER.info("Successfulley registered SoundManager '"+id+"' into PixelEngine Registry.");
  10.         }else if(sndmngs.containsKey(id))
  11.             PixelEngine.LOGGER.info("There already is a SoundManager registered with the id '"+id+"'. Using the registered one instead.");
  12.         else
  13.             PixelEngine.LOGGER.info("There was a problem registering the SoundManager '"+id+"', either it's null or it has an invalid id.");
  14.     }
  15.    
  16.     public void registerResourcePack(IResourcePack pack){
  17.         List<IResourcePack> defaultPack=ObfuscationReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "defaultResourcePacks");
  18.         defaultPack.add(pack);
  19.     }
  20.    
  21.     public SoundManager getSoundManager(String id) {
  22.         return this.sndmngs.get(id);
  23.     }
  24.    
  25.     public SoundManager getWorldSoundManager(World world) {
  26.         return this.sndmngs.get(WorldData.forWorld(world).getWorldID());
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment