Minecraft – How to change a blocks breaking time

minecraft-commandsminecraft-java-edition

I would like to change the time it takes to break a block, eg. a dirt block would take about 5 seconds to break with the player's hand, or a diamond ore would take just a second to break with the player's hand.
I don't want to use any texture packs or mods. Is this possible in vanilla Minecraft?

Best Answer

It's only possible by using a really complex system of detection and applying effects.
First you'll need some sort of detector (for example invisible marker armor stand) that would move relatively to a player, based on his rotation.
Then you'd just need a clock, that would give players haste or fatigue, based on data from the detector.

So, first of all you summon your detector:

execute @a ~ ~ ~ summon ArmorStand ~ ~ ~ {CustomName:"Reader",Marker:1b,Invulnerable:1}

Then you need a repeating command block, that would detect player rotation and tp the reader to right position. It would probably take quite a bunch of blocks with commands like this:

execute @a[rxm=XM,rx=X,rym=RM,ry=Y] ~ ~ ~ teleport @e[c=1,name=Reader] ~1 ~ ~

Using "teleport" works only in 1.10 snapshots, and it's going to move the reader relatively to the player. You could make command bigger and make it work with tp as well.

Then it's as simple, as giving the player effects, based on block, that detector fill find.

execute @e[name=Reader] ~ ~ ~ detect ~ ~ ~ stone -1 effect @p ...

This is quite a complex system, so I would recommend making a resource pack instead.