if (timing > 4) {timing = 0; time.sleep(0.05);
var itemID = 2043; var damage = 0; var price = 4;

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

for (ii = 0; ii <= 35; ii++) {item_check = pinv.getItemInSlot(ii);
if (item_check != null) {if (item_check.itemID == 2042 && blockID == 206 && blockMD == 9 && item_check.damage < 120) 
{item.damage += Math.floor(Math.sqrt(crafting_lvl)); item_check.damage += 1;}
if (item_check.itemID == 2042 && blockID == 206 && blockMD == 9 && item_check.damage >= 120) 
{pinv.consumeItem(2042); pinv.addItem(Item(2044));}}}

if (item.damage >= 50) {pinv.consumeItem(itemID); pinv.addItem(Item(321)); crafting_xp += 3}}