User:Coryf883378/blockHardness

This data was extracted from the source.

Strength vs. Block
Divided by 5.0 if player is in water or not on ground. If not effective against a block, it's strength is 1.0

Sword
Effective Against: *

Shovel
Effective Against: grass, dirt, sand, gravel, snow, blockSnow, blockClay

Axe
Effective Against: planks, bookShelf, wood, crate

Pickaxe
Effective Against: cobblestone, stairDouble, stairSingle, stone, cobblestoneMossy, oreIron, blockSteel, oreCoal, blockGold, oreGold, oreDiamond, blockDiamond, blockIce, bloodStone

Hardness
Math used if a player cannot harvest a block: 1.0 / Hardness / 100.0 Math used if a player can harvest a block: StrVsBlock / Hardness / 30.0

Block Removal Times
Ticks (days:hours:minutes:seconds) | Ticks, in water or not on ground (days:hours:minutes:seconds)

Pseudocode
global destroy = 0.0;

// "If you get upwards of 100 FPS while playing Minecraft, a tick should equal about 1/16 of a second" function tick { destroy += hardnessCalc(getBlockBeingHit); if (destroy >= 1.0) { removeBlock(getBlockBeingHit) destroy = 0.0; } }

function hardnessCalc(block) { if (block.hardness < 0.0) { return 0.0; }	if (cannotHarvestBlock) { return 1.0 / block.hardness / 100.0; } else { return playerStrVsBlock(block) / block.hardness / 30.0; } }

function playerStrVsBlock(block) { float f = 1.0; if (holdingItem) {		f = getStrVsBlock(heldItem, block); }	if (inwater || notOnGround) {		f /= 5.0; }	return f; }

function getStrVsBlock(heldItem, block) { switch (type(heldItem)) case "Sword": switch (material(heldItem)) { case "Wood": case "Steel": case "Stone": case "Gold": case "Diamond": return 1.5; }			break; case "Shovel": blockType = type(block); if (blockType != "grass" && blockType != "dirt" && blockType != "sand" && blockType != "gravel" && blockType != "snow" && blockType != "blockSnow" && blockType != "blockClay") { return 1.0; }			switch (material(heldItem)) { case "Wood": return 2.0; case "Steel": return 6.0; case "Stone": return 4.0; case "Gold": return 2.0; case "Diamond": return 8.0; }			break; case "Axe": blockType = type(block); if (blockType != "planks" && blockType != "bookShelf" && blockType != "wood" && blockType != "crate") { return 1.0; }			switch (material(heldItem)) { case "Wood": return 2.0; case "Steel": return 6.0; case "Stone": return 4.0; case "Gold": return 2.0; case "Diamond": return 8.0; }			break; case "Pickaxe": blockType = type(block); if (blockType != "cobblestone" && blockType != "stairDouble" && blockType != "stairSingle" && blockType != "stone" && blockType != "cobblestoneMossy" && blockType != "oreIron" && blockType != "blockSteel" && blockType != "oreCoal" && blockType != "blockGold" && blockType != "oreGold" && blockType != "oreDiamond" && blockType != "blockDiamond" && blockType != "blockIce" && blockType != "bloodStone") { return 1.0; }			switch (material(heldItem)) { case "Wood": return 2.0; case "Steel": return 6.0; case "Stone": return 4.0; case "Gold": return 2.0; case "Diamond": return 8.0; }			break; }	return 1.0; }