Solved Stop mobs from spawning and spawning my own

Discussion in 'Plugin Development' started by xepisolonxx, Mar 7, 2014.

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

    xepisolonxx

    My code doesn't seem to spawn in the zombie
    Code:
    @EventHandler
        public void onCreatureSpawn (CreatureSpawnEvent e) {
            e.getEntity().remove();
     
            Zombie z = (Zombie) e.getLocation().getWorld().spawnEntity(e.getLocation(), EntityType.ZOMBIE);
         
            z.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,Integer.MAX_VALUE,0));
            z.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,Integer.MAX_VALUE,1));         
            z.setCanPickupItems(false);
            z.setCustomNameVisible(true);
            z.setCustomName("Rougue Ninja");
         
            z.getEquipment().setHelmet(EntityClothes.getNinjaHead());
            z.getEquipment().setChestplate(EntityClothes.getNinjaChest());
            z.getEquipment().setLeggings(EntityClothes.getNinjaLegs());
            z.getEquipment().setBoots(EntityClothes.getNinjaBoots());
            z.getEquipment().setItemInHand(EntityClothes.getNinjaWeapon());
       
    }
    }
     
  2. Offline

    Wizehh

    xepisolonxx
    PHP:
    import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
    if (!
    e.getSpawnReason().equals(SpawnReason.CUSTOM)) {
        
    e.setCancelled(true);
            }
     
Thread Status:
Not open for further replies.

Share This Page