Solved Mob Won't Spawn

Discussion in 'Plugin Development' started by BrickBoy55, Jul 6, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    BrickBoy55

    I'm working on making a custom mob plugin, and most of the mobs work, except for 4. I've noticed that all 4 of them are either a PigZombie or an Enderman, and I just can't figure out the problem. The command that spawns them says the spawn message, but theres no mob. I'll post where I'm spawning it from, and the spawn method, and help is appreciated!

    Spawn Methods:
    Code:
        public void spawnUndeadWarrior(Location location) {
            PigZombie pigzombie = (PigZombie) location.getWorld().spawn(location, PigZombie.class);
            pigzombie.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 72000, 2));
            pigzombie.setMaxHealth(pigzombie.getMaxHealth() * 1.5);
            pigzombie.setHealth(pigzombie.getMaxHealth());
            pigzombie.setCustomName("Undead Warrior");
            pigzombie.setCustomNameVisible(true);
            pigzombie.setMetadata("undeadwarrior", new FixedMetadataValue(instance, true));
        }
      
        public void spawnUndeadElder(Location location) {
            PigZombie pigzombie = (PigZombie) location.getWorld().spawnEntity(location, EntityType.PIG_ZOMBIE);
            pigzombie.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 72000, 2));
            pigzombie.setMaxHealth(250);
            pigzombie.setHealth(250);
            pigzombie.setMetadata("undeadelder", new FixedMetadataValue(instance, true));
        }
      
        public void spawnEnderWarrior(Location location) {
            Enderman enderman = (Enderman) location.getWorld().spawnEntity(location, EntityType.ENDERMAN);
            enderman.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 72000, 2));
            enderman.setMaxHealth(enderman.getMaxHealth() * 2);
            enderman.setHealth(enderman.getMaxHealth());
            enderman.setMetadata("enderwarrior", new FixedMetadataValue(instance, true));
        }
        public void spawnEndsChampion(Enderman champion) {
            champion.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 72000, 2));
            champion.setRemoveWhenFarAway(false);
            champion.setCustomName("Ends Champion");
            champion.setCustomNameVisible(true);
            champion.setMaxHealth(1500);
            champion.setHealth(1500);
            champion.setMetadata("endschampion", new FixedMetadataValue(instance, true));
        }
    
    Spawning From
    Code:
                        Enderman enderman = (Enderman) player.getWorld().spawnEntity(player.getLocation(), EntityType.ENDERMAN);
                        spawnEndsChampion(enderman);
                        player.sendMessage(ChatColor.GREEN + "Spawned the ends champion.");
    
                        spawnUndeadElder(player.getLocation());
                        player.sendMessage(ChatColor.GREEN + "Spawned undead elder.");
                   
                        spawnEnderWarrior(player.getLocation());
                        player.sendMessage(ChatColor.GREEN + "Spawned ender warrior.");
                   
                        spawnUndeadWarrior(player.getLocation());
                        player.sendMessage(ChatColor.GREEN + "Spawned undead warrior.");
    
    Help is appreciated! Thanks in advance.
     
    Last edited: Jul 6, 2015
  2. Can you spawn them with egg/command? Do you get any messages in the console?
     
  3. Offline

    BrickBoy55

    @adventuretc I currently spawn them with a command, and no console messages.
     
  4. I mean, can you spawn them with other plugins' commands or an egg? If not, then another plugin might be blocking it.
     
  5. Offline

    BrickBoy55

    @adventuretc You don't use another plugin's commands or an egg.

    For some reason, Undead Warrior and Undead Elder spawn this:
    Code:
        public void spawnForgotten(Location location) {
            Skeleton forgotten = (Skeleton) location.getWorld().spawnEntity(location, EntityType.SKELETON);
            forgotten.setSkeletonType(Skeleton.SkeletonType.WITHER);
            forgotten.getEquipment().setItemInHand(new ItemStack(Material.DIAMOND_SWORD, 1));
            forgotten.setRemoveWhenFarAway(false);
            forgotten.setMaxHealth(1000);
            forgotten.setHealth(1000);
            forgotten.setCustomName("The Forgotten");
            forgotten.setCustomNameVisible(true);
            forgotten.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 72000, 2));
            forgotten.setMetadata("theforgotten", new FixedMetadataValue(instance, true));
        }
    
    I'm a retard, thread solved.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
  6. Offline

    HenkDeKipGaming

    What did you do wrong?
    kinda curious xD
     
  7. Offline

    BrickBoy55

    @HenkDeKipGaming Well... there were configurable chances of how the mobs spawned. And I mixed up the <= and >= symbols, so it couldn't spawn the right mob.
     
Thread Status:
Not open for further replies.

Share This Page