Blaze and Spider Pets

Discussion in 'Plugin Development' started by LeonTG77, Aug 22, 2014.

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

    LeonTG77

    You see the title, I'm trying to make a spider and a blaze pet, that will attact everyone else than the owner, also, YES I did search up before posting, no results
    My Code atm (not working):
    Code:java
    1. Blaze blaze = (Blaze) player.getWorld().spawnEntity(player.getLocation(), EntityType.BLAZE);
    2. blaze.setHealth(20F);
    3. ((Tameable) blaze).setOwner(player);
    4. ((Tameable) blaze).setTamed(true);
    5. blaze.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 1000000, 3));
    6. blaze.setCustomName(ChatColor.GRAY + player.getName() + ChatColor.GRAY + "'s Blaze");
    7. blaze.setCustomNameVisible(true);
     
  2. Offline

    Necrodoom

    But they dont extend tameable..
     
    stormneo7 likes this.
  3. Offline

    LeonTG77


    I've seen on hypixel that they have made them tameable
     
  4. Offline

    Necrodoom

    LeonTG77 Then they construct a custom entity with changed behavior.

    They created their own way of making it 'tamable'. It's harder than it looks i think, They stop it from shooting, they make the blaze walk at a certain distance from the player, they constantly make it target that player, etc..

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Aug 25, 2018
  5. Offline

    glory_fades

    for making it not shoot it can actually make an event listener making it target nothing
     
  6. Offline

    LeonTG77

    I want them to shoot at the players that is not the owner
     
  7. Offline

    glory_fades

    alrighty then so u would want to do something like
    Code:java
    1. @EventHandler
    2. public void blazeTarget(EntityTargetEvent e)
    3. {
    4. if ((e.getEntity() instanceof Blaze)) {
    5. // so this gets the mob and below it is where u get to set its attacker
    6. e.setTarget(Player)
     
Thread Status:
Not open for further replies.

Share This Page