// DayTime

time.set(5000);


//Continuous block checker. If block found, run the sculpt!
var vec = player.getLookVec();
var pos = player.getPosition();
var itemCheck = -1;
var itemMeta = 0;
var undoBlock = -1;
var undoMeta = 0;
try { itemCheck = pInv.getItemInSlot(35).getItemID(); } catch(e) {}
try { itemMeta = pInv.getItemInSlot(35).getDamage(); } catch(e) {}
try { undoBlock = pInv.getItemInSlot(34).getItemID(); } catch(e) {}
try { undoMeta = pInv.getItemInSlot(34).getDamage(); } catch(e) {}

for (i = 0; i <= 4; i += 0.25) {
	if (checkBlock(i,vec,pos,itemCheck,itemMeta)) {
		sculptStart(Math.floor(vec.x*i+pos.x),Math.floor(vec.y*i+pos.y),Math.floor(vec.z*i+pos.z));
		break;
	}
	if (checkBlock(i,vec,pos,undoBlock,undoMeta)) {
		world.setBlockID(Math.floor(vec.x*i+pos.x),Math.floor(vec.y*i+pos.y),Math.floor(vec.z*i+pos.z),0);
		undoStart(pInv.getItemInSlot(34).getQuantity() == 2);
		break;
	}
}