Patch for bug which stops skeletons attacking players. #5


  • New
  • Patch
Open
Assigned to _ForgeUser8418616
  • gorbb created this issue Jul 6, 2013

    An arrow, which is an implementation of projectile can return the shooter of the projectile.

    In this case, you can use the projectile instance to find out whether the entity that threw the projectile is a player or not.

    Note that I've specifically said projectile, and not arrow. This means any projectile, e.g. snowball, egg, fireball, arrow, can be thrown and allowed to damage the entity shooting it isn't a player.

    The code for such would be as follows:

    else if(e.getDamager() instanceof Projectile)
    {
    	Projectile proj = (Projectile) e.getDamager();
    	if (proj.getShooter() instanceof Player)
    	{
    		e.setCancelled(true);
    	}
    }
    

    I hope this helps squish one of your bugs. :)

  • gorbb added the tags New Patch Jul 6, 2013

To post a comment, please login or register a new account.