Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onProjectileHitListener(ProjectileHitEvent event)
- {
- Block blockhit = null;
- //blockhit = block actually hit by the egg.
- if(event.getEntityType() != EntityType.EGG)
- return;
- World world = event.getEntity().getWorld();
- BlockIterator iterator = new BlockIterator(world, event.getEntity().getLocation().toVector(), event.getEntity().getVelocity().normalize(), 0, 4);
- blockhit = null;
- while (iterator.hasNext())
- {
- blockhit = iterator.next();
- if (blockhit.getTypeId() != 0)
- break;
- }
- if(blockhit == null || blockhit.getType() == Material.GLASS)
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment