3

Mining modification help

Lutece1979 2/4/22 2:32 am history
188
2/19/2022 7:32 am
Hello guys,

I'm new to creating the vast world of datapacks and could use a little help.

I'm interested in modifying a pickaxe so that it can mine one more block in front as well as the same on the block below.

I took different packs to understand but I'm happy to be lost with this:

execute if block ~1 ~1 ~ #minecraft:break_list run setblock ~1 ~1 ~ air destroy
execute if block ~1 ~ ~ #minecraft:break_list run setblock ~1 ~ ~ air destroy
execute if block ~1 ~-1 ~ #minecraft:break_list run setblock ~1 ~-1 ~ air destroy
execute if block ~-1 ~1 ~ #minecraft:break_list run setblock ~-1 ~1 ~ air destroy
execute if block ~-1 ~ ~ #minecraft:break_list run setblock ~-1 ~ ~ air destroy
execute if block ~-1 ~-1 ~ #minecraft:break_list run setblock ~-1 ~-1 ~ air destroy
execute if block ~ ~1 ~ #minecraft:break_list run setblock ~ ~1 ~ air destroy
execute if block ~ ~-1 ~ #minecraft:break_list run setblock ~ ~-1 ~ air destroy

and this for the 4 directions, as well as up and down.

A little nudge would be welcome.

Thanks for your help
Posted by
Lutece1979
Level 9 : Apprentice Miner
0

  Have something to say?

JoinSign in

12

Lutece1979
02/19/2022 7:32 am
Level 9 : Apprentice Miner
Hi Kefaku,

I had to tamper a bit, especially on east and west where I had to add two additional lines.
I canceled up and down, too many complications.
But it finally works, I arrived at a good compromise.

Thank you very much for your help !
1
Kefaku
02/05/2022 4:57 am
Level 45 : Master Nerd
What exactly is the problem with the commands you came up with?
What would you like them to do instead of what they do right now?
1
Lutece1979
02/11/2022 7:11 am
Level 9 : Apprentice Miner
I would like to have the same for all the directions as the east does. 1 block depper and 2 blocks depht in front of me.
when i'm facinf north or west or south it breaks blocks beside me...
1
Kefaku
02/11/2022 11:16 am
Level 45 : Master Nerd
I'm not exactly sure, but I think you need 4 different mcfunction files for the 4 different directions, which all break blocks in different locations as I pointed out in my last comment.
1
Lutece1979
02/05/2022 6:52 pm
Level 9 : Apprentice Miner
history
Currently it breaks the block I'm aiming for as well as the one above and below and the same left and right.

I would like it to break only the block below (not those on the sides) but on the other hand it would mine 1 more depth
2
Kefaku
02/06/2022 3:01 am
Level 45 : Master Nerd
history
I hope I'm understanding you correctly. If that isn't what you want achieve or you came across additional questions, feel free to ask, but here's what I think you should do:

I assume, that the location ~ ~ ~ is where the original block is broken by the player. (Correct?)
First you "would like it to break only the block below", so we remove everything except the line for below:

execute if block ~1 ~1 ~ #minecraft:break_list run setblock ~1 ~1 ~ air destroy
execute if block ~1 ~ ~ #minecraft:break_list run setblock ~1 ~ ~ air destroy
execute if block ~1 ~-1 ~ #minecraft:break_list run setblock ~1 ~-1 ~ air destroy
execute if block ~-1 ~1 ~ #minecraft:break_list run setblock ~-1 ~1 ~ air destroy
execute if block ~-1 ~ ~ #minecraft:break_list run setblock ~-1 ~ ~ air destroy
execute if block ~-1 ~-1 ~ #minecraft:break_list run setblock ~-1 ~-1 ~ air destroy
execute if block ~ ~1 ~ #minecraft:break_list run setblock ~ ~1 ~ air destroy
execute if block ~ ~-1 ~ #minecraft:break_list run setblock ~ ~-1 ~ air destroy

Then you want it to "mine 1 more depth". I'm not sure whether you mean 1 more block down (1 block deeper) or 1 block more depth in the direction the player is facing, while breaking the original block (1 block more depth).
The first variant would mean you just have to add 1 line, which breaks an additional block 1 block deeper:

execute if block ~ ~-1 ~ #minecraft:break_list run setblock ~ ~-1 ~ air destroy
execute if block ~ ~-2 ~ #minecraft:break_list run setblock ~ ~-2 ~ air destroy

The second variant would mean you'd have to add two lines, that break additional blocks in the facing direction instead. Therefore you'd have to add 1 to the axis that was just ~ in all the commands you had before (for that specific direction):

execute if block ~ ~-1 ~ #minecraft:break_list run setblock ~ ~-1 ~ air destroy
execute if block ~ ~-1 ~1 #minecraft:break_list run setblock ~ ~-1 ~1 air destroy
execute if block ~ ~ ~1 #minecraft:break_list run setblock ~ ~ ~1 air destroy

This might break additional blocks, where you stand, instead of behind the block that was broken, then you'd have to replace all the 1 with -1.
Then you'd need to repeat this "for the 4 directions, as well as up and down". I assume you have a seperate *.mcfunction file for every direction.
Also, I don't know what your block tag #minecraft:break_list contains. If you just want it to break the stuff a standard pickaxe is used to break, there already is an existing block tag called #minecraft:mineable/pickaxe, so if that's what you need you wouldn't have to add a custom block tag.
1
Lutece1979
02/06/2022 5:31 am
Level 9 : Apprentice Miner
history
Hi Kefaku,

Thanks for your return.
You understood correctly, one more block down (deeper) and also one more depth
I did a little sketch.
R is the block i'm facing



so I think it's variant 2 that I have to use, isn't it?
Thank you very much for your help
2
Kefaku
02/06/2022 6:28 am
Level 45 : Master Nerd
Yes, exactly!
Just keep in mind "This might break additional blocks, where you stand, instead of behind the block that was broken, then you'd have to replace all the 1 with -1."
1
Lutece1979
02/10/2022 11:09 am
Level 9 : Apprentice Miner
Hi Kefaku,

So I writed the commands on all my mcfunctions directions and it works perfectly on east (even when i'm looking up or down it's ok for me) but it's a mess on the three others...
It breaks the 2 more blocks at the south direction i'm facing...
2

Welcome