Playing Wolf Hearts around a player

Discussion in 'Plugin Development' started by xxCoderForLifexx, Jan 15, 2013.

Thread Status:
Not open for further replies.
  1. Code:
    player.playEffect(EntityEffect.WOLF_HEARTS);
    I use that but I can't get the location of the player
     
  2. Offline

    gomeow

  3. Offline

    evilmidget38

    I don't understand what you mean. If you're trying to play an effect visible to all players, you can use World#playEffect(Location location, Effect effect, int data).
     
  4. I tried that it is an
    Code:
    EntityEffect
    Not a regular Effect
     
  5. Offline

    evilmidget38

    Hmm, good point. Why exactly isn't your current code working? Entity#playeEffect(EntityEffect) should work.
     
  6. Yes that does work but I can't see any hearts and I can't give it a location at all
     
  7. Offline

    evilmidget38

    Can other players see the hearts? I'd assume you can't pass in a location as it applies the effect to the entity.
     
  8. Wait would I need to send packets to the server?
     
  9. Offline

    Ne0nx3r0

    This can be done, but you wont like it.

    Code:
            Location l = p.getLocation();
            l.setY(400);
            final LivingEntity kludgeE = (LivingEntity) p.getWorld().spawnEntity(l, EntityType.WOLF);
            kludgeE.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY,100,100));
            kludgeE.teleport(p.getLocation());
       
            plugingetServer().getScheduler().runTaskLater(plugin,  new Runnable() {
                @Override
                public void run()
                {
                    kludgeE.playEffect(EntityEffect.WOLF_HEARTS);
                    kludgeE.remove();
                }
            },3);
    
    More info:
    http://forums.bukkit.org/threads/villager-heart-effect-on-player.120685/
     
  10. Testing now...
     
Thread Status:
Not open for further replies.

Share This Page