Java Code Examples for net.minecraft.entity.projectile.EntityArrow.setDead()

The following are Jave code examples for showing how to use setDead() of the net.minecraft.entity.projectile.EntityArrow class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: MobBlocker   File: TileEntityChunkProtector.java   Source Code and License Vote up 5 votes
/**
 * 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);
			}
		}
	}
}
 
Example 2
Project: MobBlocker   File: TileEntityAreaProtector.java   Source Code and License Vote up 5 votes
/**
 * 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);
			}
		}
	}
}