var repair = 1; var damageGet = 0; var itemID = 468; var maxDamage = 1;
var power = (4+Math.sqrt(unarmed_lvl*2))*energy/maxEnergy; var breakSpeech = "Wait, how did I broke these?";
var tool = [1, 45, 1, 20, 35, 2, 80]; energy -= energyGenerate*(4 + Math.sqrt(unarmed_lvl*2));

if (pinv.getCurrentItem() != null)
{if (pinv.getCurrentItem().itemID == itemID) {var ent = pinv.getCurrentItem(); player.swingMainHand();}}
if (pinv.getOffhandItem() != null) 
{if (pinv.getOffhandItem().itemID == itemID) {var ent = pinv.getOffhandItem(); player.swingOffHand();}}

if (hitBlock != null) {time.sleep(0.05);
script.runScript("destructable blocks.js");
if (blockID == 50) {for (var i = 0; torchArray [i] != undefined; i++)
{if (getBlock != null && torchArray [i] [1] [0] == getBlock.x && torchArray [i] [1] [1] == getBlock.y
&& torchArray [i] [1] [2] == getBlock.z) {torchLabel.alpha = 0;
world.setBlockID(getBlock.x, getBlock.y, getBlock.z, 0);
pinv.addItem(Item(2099, 1, (gameTiming - torchArray [i] [3])/ (torchArray [i] [2] - torchArray [i] [3])*200));}}}

if (blockID == 206 && (blockMD == 7 || blockMD == 6 || blockMD == 3 || blockMD == 2) && actD != -1) 
if (fireArray [actD] [1] [0] == hitBlock.x || fireArray [actD] [1] [1] == hitBlock.y || fireArray [actD] [1] [2] == hitBlock.z) {
	i = actD; if (fireArray [i] [2] < fireArray [i] [3]/4) {
		if (fireArray [i] [7] != 0) {
			for (jj = 0; jj < fireArray [i] [11]; jj++) {player.dropItem(Item(fireArray [i] [7]));} 
			if (fireArray [i] [9] == 6) {cooking_xp += Math.sqrt(fireArray [i] [3])/5;} 
			if (fireArray [i] [9] == 2) {smithing_xp += Math.sqrt(fireArray [i] [3])/5;}
			itemSearch = player.getEntitiesWithinRange(0.5); 
			pHealth -= Math.max(Math.sqrt(fireArray [i] [4]) - 2, 0); player.attackEntityFrom(player, 1);
			for (ii = 0; ii < itemSearch.length; ii++) if (itemSearch[ii].getClassType() == "Item") {
				vec = player.getLookVec(); itemSearch[ii].addVelocity(vec.scale(-1/6));
				itemSearch[ii].setPosition(hitBlock.x + 0.5,hitBlock.y + 0.7,hitBlock.z + 0.5);
			}
		}
	} else if (fireArray [i] [8] != 0) {
		player.dropItem(Item(fireArray [i] [8])); itemSearch = player.getEntitiesWithinRange(0.5);
		pHealth -= Math.max(Math.sqrt(fireArray [i] [4]) - 2, 0); player.attackEntityFrom(player, 1);
		for (ii = 0; ii < itemSearch.length; ii++) if (itemSearch[ii].getClassType() == "Item") {
			vec = player.getLookVec(); itemSearch[ii].addVelocity(vec.scale(-1/6));
			itemSearch[ii].setPosition(hitBlock.x + 0.5,hitBlock.y + 0.7,hitBlock.z + 0.5);
		}
	}

	fireArray [i] [2] = 0; fireArray [i] [3] = 0;
	if (ent.damage < 150) {blockHP = Math.max(blockHP-power,0); ent.damage += 1;} 
	else {pinv.consumeItem(itemID.maxDamage,1);}
	fireArray [i] [6] = ""; fireArray [i] [7] = 0; fireArray [i] [8] = 0; fireHP = 0; fireMaxHP = 0; fireburn = 0;
}
}