2

I am working in 1.14 and I'm making an adventure/survival map. Right now I have a pair of shears that I give the player using this command /give @p minecraft:shears{CanDestroy:["minecraft:stone","minecraft:oak_log"]} 1. The problem with this is that the stone and oak_log takes a very long time to mine since shears are not the right tool for mining those blocks. When I give the player haste, this doesn't fix this either. Is there a way for me to give the player an item that acts like it is the right tool to mine a specific type of block (ie: wood, dirt, stone etc)?

  • Not even haste level 127? That should instant-mine everything except obsidian, ender chests and unbreakable blocks. – Fabian Röling Jun 7 '19 at 6:44
  • @Fabian Rolling I tired haste 255 which is the max for potion amplifiers – Hydra Jun 7 '19 at 12:04
  • 1
    Nope, haste 255 actually makes you mine slower, haste 127 is the maximum. – Fabian Röling Jun 7 '19 at 14:40
  • @Fabian Rölling that's actually good to know, I'll try that when I get home. – Hydra Jun 7 '19 at 15:34
  • 1
    That haste mining thing where 255 is slower than 127 is because Java uses two's complement for its integers. 0-127 is 0-127 in two's complement, but 128-255 is (-128)-(-1), so 255 is actually haste -1. – Nik3141 Jun 7 '19 at 22:24
3

Haste 255 makes you mine slower, because the number wraps around into the negatives. Haste 127 makes you mine the fastest.

There is no item that gives you haste (and the effect.digSpeed attribute modifier apparently doesn't work at all), so you have to use commands to check for holding the item in the main hand. Commands for that are easily found online.

2

To allow the player to instantly destroy blocks in survival/adventure mode haste level 127 is best.

/effect give @s haste 30 127 true

In this partiular case, where this effect is bound to an item, a command like this one in a repeating command block is the best solution:

/effect give @a[nbt={SelectedItem:{id:"minecraft:shears"}}] haste 1 127 true
0

I think this is the closest you can get to what you want in vanilla minecraft, it works, but it is vulnerable to cheating.

Run this command in a repeating command block:

/execute as @a[nbt={SelectedItem:{id:"minecraft:shears"},OnGround:1b}] run gamemode creative

And this one in a chain command block after it:

/execute as @a[nbt=!{SelectedItem:{id:"minecraft:shears"},OnGround:1b},tag=!stayInCreative] run gamemode survival

It does prevent regular players from flying while they hold shears. If you want to stay in creative, after setting this up, you can run this command:

/tag @s add stayInCreative

It will also allow you to fly again.

  • Thank you for the help, but as you said this does give the players the ability to cheat. Giving the player haste 127 and keeping them in adventure mode should work out just fine for me. – Hydra Jun 8 '19 at 18:58
  • I expected something like that, but please make a propper answer and mark that as the answer, just for the statistics. Edit: in case I was unclear, you are not supposed to mark my answer as the answer, but make a new one and mark that one, I am not asking you to improove my statistics or anything – user232393 Jun 8 '19 at 19:00
  • I would prefer if @FabianRolling answers the question since they were the one to discover this and would explain it better/in more detail than I can. – Hydra Jun 8 '19 at 19:05
  • That would really make the most sense, but you are the second best person to do this. – user232393 Jun 8 '19 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.