for (i = 0; arrowA [i] != undefined && arrowA [i] [0] != false; i++) {}
if (arrowA [i] == undefined) {arrowA [i] = [false, 0, 0, 0, false, 0, 0];}
arrowA [i] [4] = true; if (arrowA [i] [1] < 16) {arrowA [i] [1] += 1;} arrowA [i] [2] -= 5;
throwingValue = (arrowA [i] [1]/16); throwingID = 2100; energy -= energyGenerate;

itemID = 2100; repair = 6; 
if (timing > 4) {timing = 0;
	if (pinv.getCurrentItem() != null) {if (pinv.getCurrentItem().itemID == itemID) {var ent = pinv.getCurrentItem();}}
	if (pinv.getOffhandItem() != null) {if (pinv.getOffhandItem().itemID == itemID) {var ent = pinv.getOffhandItem();}}
	ii = ent.damage; repairFun(repair, ent, itemID); if (ii > ent.damage) {
	throwingValue = 0; for (var i = 0; arrowA [i] != undefined; i++) {if (arrowA [i] [0] == false) break;} arrowA [i] [1] = -4;
	if (pinv.getCurrentItem() != null) {if (pinv.getCurrentItem().itemID == itemID) {player.swingMainHand();}}
	if (pinv.getOffhandItem() != null) {if (pinv.getOffhandItem().itemID == itemID) {player.swingOffHand();}}}
}

function arrowShoot() {
	throwingValue = 0;
	if (pinv.getSlotContainingItem(262) != -1 && arrowA [i] [1] > 5) {
		arrowA [i] [1] = 0; arrowA [i] [0] = true; arrowA [i] [6] = time.time; vec = player.getLookVec();
		arrowA [i] [3] = world.spawnEntity("Arrow", pos.x, pos.y, pos.z);
		arrowA [i] [3].setPosition(pos.x + vec.x*1.3, pos.y + vec.y*1.3, pos.z + vec.z*1.3); 

		if (player.isSneaking() == true) {lightBlock = 0; 
		for (ii = 0; ii < 7; ii++) {for (j = 0; j < 4; j++) {for (k = 0; k < 7; k++) 
		{lightBlock += world.getLightValue(ii - 3 + Math.round(pos.x), 
		j + Math.round(pos.y), k - 3 + Math.round(pos.z));}}} 
		lightBlock = lightBlock/2940 * 100; arrowA [i] [7] = lightBlock;}

		j = (Math.sqrt(range_lvl*2)/6+1); range_xp += arrowA [i] [2]/50*j;
		if (player.isSneaking() == true) {j *= 1.5;}
		arrowA [i] [3].setVelocity(vec.x*arrowA [i] [2]/15*j + (Math.random()*0.6 - 0.3)/j, 
		vec.y*arrowA [i] [2]/15*j + (Math.random()*0.6 - 0.3)/j, vec.z*arrowA [i] [2]/15*j + (Math.random()*0.6 - 0.3)/j); 
		arrowA [i] [3].isPlayersArrow = true; pinv.consumeItem(262);

		if (ent.damage < ent.maxDamage) {ent.damage += Math.round(Math.sqrt(Math.random()*arrowA [i] [2]));} 
		else {pinv.consumeItemAmount(itemID, ent.damage, 1); arrowA [i] [2] = 0;}
	}
}