Java Code Examples for net.minecraft.entity.projectile.EntityArrow

The following are top voted examples for showing how to use
net.minecraft.entity.projectile.EntityArrow. These examples are extracted from open source projects.
You can vote up the examples you like and your votes will be used in our system to generate
more good examples.

/**
* Destroys skeleton arrows in the protected area
* Checks whether the arrow was shot by a class deriving from IRangedAttackMob
* Sets the arrow on fire for visual effect by default
* An arrow already on fire is killed
* The effect of this is that the arrow, for one tick, is engulfed in flame, as it looks strange to have the arrow disappear for no reason
* @param chunkBounds AxisAlignedBB in which block should act
*/
private void killArrows(AxisAlignedBB chunkBounds) {
List<EntityArrow> list = world.getEntitiesWithinAABB(EntityArrow.class, chunkBounds);
for (EntityArrow arrow : list) {
if (arrow.shootingEntity instanceof IRangedAttackMob) {
if (arrow.isBurning()) {
arrow.setDead();
} else {
arrow.setFire(1);
arrow.addVelocity(-arrow.motionX, 0, -arrow.motionZ);
}
}
}
}

/**
* Destroys skeleton arrows in the protected area
* Checks whether the arrow was shot by a class deriving from IRangedAttackMob
* Sets the arrow on fire for visual effect by default
* An arrow already on fire is killed
* The effect of this is that the arrow, for one tick, is engulfed in flame, as it looks strange to have the arrow disappear for no reason
* @param areaBounds AxisAlignedBB in which block should act
*/
private void killArrows(AxisAlignedBB areaBounds) {
List<EntityArrow> list = world.getEntitiesWithinAABB(EntityArrow.class, areaBounds);
for (EntityArrow arrow : list) {
if (arrow.shootingEntity instanceof IRangedAttackMob) {
if (arrow.isBurning()) {
arrow.setDead();
} else {
arrow.setFire(1);
arrow.addVelocity(-arrow.motionX, 0, -arrow.motionZ);
}
}
}
}