User blog:Davidgumazon/Minecraft Code is BlockUnbreakable

This is Minecraft: Java Edition. protected Block setBlockUnbreakable { this.setHardness(-1.0F); return this; } Unbreakable in Minecraft just means the block has a hardness value of -1.

Hidden deep within Minecraft code lies a line of code like this: float f = state.getBlockHardness(worldIn, pos);

if (f < 0.0F) { return 0.0F; } else { return !player.canHarvestBlock(state) ? player.getDigSpeed(state) / f / 100.0F : player.getDigSpeed(state) / f / 30.0F; }

All you need to know about it is that whenever you try to mine up a block in Minecraft the game checks to see what that block hardness value of less than zero which all classified unbreakable blocks are Minecraft just returned zero as you're mining progress number, meaning you never make any progress in mining up the block no matter what.

if (f < 0.0F) { return 0.0F; } & protected Block setBlockUnbreakable { this.setHardness(-1.0F); return this; } ...