//--------Axes v1.0 - Renounce4----//
UpdateAxefrozenEntities()

var pinv = player.getInventory();

var bombSlotId = 8;

if(hasBombs == true)
{
	if(pinv.getSlotContainingItemDamage(bombPlaceholderId, bombPlaceholderMetadata) != -1)
	{
		bombSlotId = pinv.getSlotContainingItemDamage(bombPlaceholderId, bombPlaceholderMetadata);
	}
	else if(pinv.getSlotContainingItem(466) != -1)
	{
		bombSlotId = pinv.getSlotContainingItem(466);
	}
}

var aLimit = 0, aCount = 0;
var vIDs = new Array(290,291,292,293);
var vSize = new Array(20,30,40,50);
var itemToLimit = 262;

if (pinv.getSlotContainingItem(vIDs[3]) != -1) { aLimit = vSize[3]; }
else if (pinv.getSlotContainingItem(vIDs[2])  != -1) { aLimit = vSize[2]; }
else if (pinv.getSlotContainingItem(vIDs[1])  != -1) { aLimit = vSize[1]; }
else if (pinv.getSlotContainingItem(vIDs[0])  != -1) { aLimit = vSize[0]; }

if (aLimit>0) { hasLimiter = true; }

if (pinv.getSlotContainingItem(itemToLimit) != -1) {
	for(i=0;i<=35;i++)
	{
		if(pinv.getItemInSlot(i) != null)
		{
			var curItem = pinv.getItemInSlot(i);
			if (curItem.getItemID() == itemToLimit) {
				if (curItem.getQuantity() > 0) {
					aCount += curItem.getQuantity();
				}
			}
		}
	}
}

if (aCount >= aLimit) {
	pinv.consumeItemAmount(itemToLimit, 0, (aCount - aLimit));
}

var arrowTargetId = 19

for each(var entity in player.getEntitiesWithinRange(40))
{
	if(entity.classType == "Arrow")
	{
		if(entity.isPlayersArrow && entity.inBlockID == arrowTargetId)
		{
			thisBlock3 = entity.inBlockCoords
			world.triggerBlock(thisBlock3.x, thisBlock3.y, thisBlock3.z+1) // North
			world.triggerBlock(thisBlock3.x, thisBlock3.y, thisBlock3.z-1) // South
			world.triggerBlock(thisBlock3.x+1, thisBlock3.y, thisBlock3.z) // East
			world.triggerBlock(thisBlock3.x-1, thisBlock3.y, thisBlock3.z) // West
			world.triggerBlock(thisBlock3.x, thisBlock3.y+1, thisBlock3.z) // Up
			world.triggerBlock(thisBlock3.x, thisBlock3.y-1, thisBlock3.z) // Down
		}
	}
}

if (player.isInsideOfWater() && ((pinv.getItemInSlot(36) != null && pinv.getItemInSlot(36).getItemID() != 317) || pinv.getItemInSlot(36) == null))
{
player.addVelocity(0, .15, 0);
}

if (player.isInsideOfWater() && pinv.getItemInSlot(36) != null && pinv.getItemInSlot(36).getItemID() == 317)
{
    player.addVelocity(0, -0.046, 0);
}

if (player.isInsideOfWater() && pinv.getItemInSlot(38) != null && pinv.getItemInSlot(38).getItemID() == 314)
{
    player.setAir(280);
}