Why are wither skulls "blinking"? How to fix it?

Discussion in 'Spigot Plugin Development' started by fujiboy4, Jul 2, 2015.

  1. Hello. I'm making a minigame for my server which includes Wither Skulls. I have run into a little problem.
    The wither skulls keep on blinking or disappearing and then reappearing.
    Here is some of my code.

    Code (Text):
    @EventHandler
        public void onInteract(PlayerInteractEvent e) {
            Player p = (Player) e.getPlayer();
            if (e.getAction() == Action.LEFT_CLICK_AIR
                    || e.getAction() == Action.LEFT_CLICK_BLOCK) {
                if (p.getItemInHand().getType() == Material.BLAZE_ROD) {
                    p.playSound(p.getLocation(), Sound.HORSE_SKELETON_DEATH, 100, 2);
                    Location loc = p
                            .getEyeLocation()
                            .toVector()
                            .add(p.getLocation().getDirection().multiply(1))
                            .toLocation(p.getWorld(), p.getLocation().getYaw(),
                                    p.getLocation().getPitch());
                    WitherSkull skull = p.getWorld().spawn(loc, WitherSkull.class);
                    skull.setCharged(true);

                }

            }

        }
    Is there a way to fix this error/bug?
     
  2. It could be that the skull is invisible because when the velocity is 0 they get invisible, maybe try to set the velocity to a very low number, if you want it to stay still
     
  3. I want it to move at the direction of the player's head. But would i need to set the multiplier to something like 0.1?
     
  4. Not in 1.8.3+ clients.
     
  5. you just do player.getLocation().getDirection() to get the velocity and you might want to multiply it.

    Thanks for saying!
     
  6. Don't... blink..
     
    • Funny Funny x 1
  7. Isn't that what I'm doing here:
    Code (Text):
    p.getLocation().getDirection().multiply(1)
    And I am using 1.8.1 client.
     
  8. You can just do
    Code (Text):
    player.launchProjectile(WitherSkull.class);
     
  9. You did that to the location, you need to set the velocity of the wither skull also. And because you don't use 1.8.3+ as somebody said earlier you get the blinking if the velocity is 0.
     
  10. I think this may work... Although, getting the location and vector and what not may be what my code is doing..