Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (Contained in onCreatureSpawn)
- if(!Config.APOCALYPTIC){
- if(!(event.getEntity() instanceof Zombie)){
- event.setCancelled(true);
- }
- else if(r.nextInt(100) < Config.REG_SPAWN_CHANCE){ //check to see if it is a special zombie
- Util.totalMobs++;
- return;
- }
- else{
- Util.totalMobs++;
- Zombie z = (Zombie) event.getEntity();
- //spawn a special based off of the config values for spawning chances
- Util.transformZombieToSpecial(z, getRandomZombieType());
- }
- }
- _____________________________________________________________________________-
- /**
- * Turns the zombie into a specified zombie type
- *
- * @param z
- * Zombie to be added
- *
- * @param specZombie
- * Type of zombie to change to
- */
- public static void transformZombieToSpecial(Zombie z, String specZombie){
- if(specZombie.equalsIgnoreCase("infernite")){
- Util.infernites.add(z);
- Util.setSkin(z, Config.INF_SKIN);
- return;
- }
- else if(specZombie.equalsIgnoreCase("leaper")){
- Util.leapers.add(z);
- Util.setSkin(z, Config.LEAP_SKIN);
- return;
- }
- else if(specZombie.equalsIgnoreCase("webber")){
- Util.webbers.add(z);
- Util.setSkin(z, Config.WEB_SKIN);
- return;
- }
- else if(specZombie.equalsIgnoreCase("splitter")){
- Util.splitters.add(z);
- Util.setSkin(z, Config.SPLIT_SKIN);
- return;
- }
- else if(specZombie.equalsIgnoreCase("shade")){
- Util.shades.add(z);
- System.out.println("Shade Spawned");
- Util.setSkin(z, Config.SHADE_SKIN);
- return;
- }
- }
- ______________________________________________________________________________________
- /**
- * Compact way of setting skins for entities
- *
- * @param le
- * Entity's skin to change
- *
- * @param url
- * URL to grab skin.png (or jpg) from
- */
- public static void setSkin(Zombie le, String url){
- if(url.equalsIgnoreCase("none")){//if no skin is set, no skin is applied
- return;
- }
- final LivingEntity finalLe = le;
- final String finalURL = url;
- //experimental scheduler to try and fix entity skins not loading in onCreatureSpawn
- DeadMines.scheduler.scheduleSyncDelayedTask(Config.plugin, new Runnable(){
- public void run(){
- SpoutManager.getAppearanceManager().setGlobalEntitySkin(finalLe, finalURL, EntitySkinType.DEFAULT);
- }
- }, 10);
- }
Add Comment
Please, Sign In to add comment