Declaring an entity

Discussion in 'Plugin Development' started by Muod, Dec 27, 2013.

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

    Muod

    I have
    Player player = event.getPlayer();
    int fx = 61;
    int fy = 65;
    int fz = -1040;
    World world = Bukkit.getWorld("Lobby");
    Location Zombie = new Location(world, fx, fy, fz);
    Entity Bill = player.getWorld().spawnEntity(Zombie, EntityType.ZOMBIE);
    ((LivingEntity)Bill).setCustomName(ChatColor.BOLD + "" + ChatColor.RED + "Bill");
    ((LivingEntity)Bill).setCustomNameVisible(true);
    if (event.getRightClicked().getPassenger() == Bill){
    but how would I make it so it doesnt create a new zombie. How would I declare a zombie with that instead of having to create Bill each time. Cant I just declare bill.
     
  2. Offline

    CubieX

    Your question is a bit vague.
    Do you want to use an existing zombie?
    You can get a right clicked entity in PlayerInteractEvent for example.
    Then check if the right clicked entity is a living entity and if so, cast it to LivingEntity.
    Then you can apply your changes.

    But there are also other ways of getting mobs.
     
Thread Status:
Not open for further replies.

Share This Page