Guest User

Untitled

a guest
Oct 16th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.31 KB | None | 0 0
  1. (Contained in onCreatureSpawn)
  2.  
  3.         if(!Config.APOCALYPTIC){
  4.             if(!(event.getEntity() instanceof Zombie)){
  5.                 event.setCancelled(true);
  6.             }
  7.             else if(r.nextInt(100) < Config.REG_SPAWN_CHANCE){ //check to see if it is a special zombie
  8.                 Util.totalMobs++;
  9.                 return;
  10.             }
  11.             else{
  12.                 Util.totalMobs++;
  13.                 Zombie z = (Zombie) event.getEntity();
  14.                 //spawn a special based off of the config values for spawning chances
  15.                 Util.transformZombieToSpecial(z, getRandomZombieType());
  16.             }
  17.         }
  18.  
  19.  
  20. _____________________________________________________________________________-
  21.  
  22.  
  23.  
  24.  
  25.  
  26.     /**
  27.      * Turns the zombie into a specified zombie type
  28.      *
  29.      * @param z
  30.      * Zombie to be added
  31.      *
  32.      * @param specZombie
  33.      * Type of zombie to change to
  34.      */
  35.     public static void transformZombieToSpecial(Zombie z, String specZombie){
  36.         if(specZombie.equalsIgnoreCase("infernite")){
  37.             Util.infernites.add(z);
  38.             Util.setSkin(z, Config.INF_SKIN);
  39.             return;
  40.         }
  41.         else if(specZombie.equalsIgnoreCase("leaper")){
  42.             Util.leapers.add(z);
  43.             Util.setSkin(z, Config.LEAP_SKIN);
  44.             return;
  45.         }
  46.         else if(specZombie.equalsIgnoreCase("webber")){
  47.             Util.webbers.add(z);
  48.             Util.setSkin(z, Config.WEB_SKIN);
  49.             return;
  50.         }
  51.         else if(specZombie.equalsIgnoreCase("splitter")){
  52.             Util.splitters.add(z);
  53.             Util.setSkin(z, Config.SPLIT_SKIN);
  54.             return;
  55.         }
  56.         else if(specZombie.equalsIgnoreCase("shade")){
  57.             Util.shades.add(z);
  58.             System.out.println("Shade Spawned");
  59.             Util.setSkin(z, Config.SHADE_SKIN);
  60.  
  61.             return;
  62.         }
  63.     }
  64.  
  65.  
  66.  
  67. ______________________________________________________________________________________
  68.  
  69.  
  70.  
  71.  
  72.     /**
  73.      * Compact way of setting skins for entities
  74.      *
  75.      * @param le
  76.      * Entity's skin to change
  77.      *
  78.      * @param url
  79.      * URL to grab skin.png (or jpg) from
  80.      */
  81.     public static void setSkin(Zombie le, String url){
  82.         if(url.equalsIgnoreCase("none")){//if no skin is set, no skin is applied
  83.             return;
  84.         }
  85.         final LivingEntity finalLe = le;
  86.         final String finalURL = url;
  87.         //experimental scheduler to try and fix entity skins not loading in onCreatureSpawn
  88.         DeadMines.scheduler.scheduleSyncDelayedTask(Config.plugin, new Runnable(){
  89.             public void run(){
  90.                 SpoutManager.getAppearanceManager().setGlobalEntitySkin(finalLe, finalURL, EntitySkinType.DEFAULT);
  91.             }
  92.         }, 10);
  93.        
  94.     }
Add Comment
Please, Sign In to add comment