#3x3x3 Pickaxe enchantment
1 messages · Page 1 of 1 (latest)
Breathe
Idk how to XDXDXDXDXDXDXDXD
ik how to do 😄
I need more of an explanation
I can't tell you the exact implementation, but something like on mine, you have to loop the blocks in a 3x3x3 area, give them to the player and remove the drops if you want to transfer them directly to inventory, or just break them if not
I have it somewhere on my laptop, and i'll give you it in about 2-3 hours if it's not solved by then
I don't have the code anymore, but I can give you further advice now that i am free. It would look something like this, however, i cannot assure you that the code is correct, since I'm writing on phone and cannot debug:
on mine:
set {_lore::*} to lore of player's tool
loop {_lore::*}:
if "%loop-value%" contains "-your enchant name here, with color codes-":
set {_location} to location of event-block
remove 1 from y coord of {_location}
loop all blocks around {_location} in radius 2 (do not add this part, but you can change the radius by testing. 1.5-3.5, try for yourself and see):
if loop-block is not bedrock:
give player loop-block
set loop-block to air
stop (make sure to stop the code from running into further lore values from loop once you found the good one and ran the code, every millisecond saved is a millisecond gained)
Note that the remove 1 from y coord works for a 3x3x3 area if you're mining while looking down and mining a block underneath you
You can implement some if's to check for player orientation, that way it works no matter where you look. The code would be something like:
if player's facing is west:
remove 1 from x coord of {_location}
else if player's facing is east:
add 1 to x coord of {_location}
North: remove 1 from z
South: add 1 to z
Now there's more to that, to check for up/down you have to use pitch
if player's pitch is less than 0:
Means you're looking down
Greater than 0: looking up
These 2 work no matter how high or low the blocks are, as long as you're mining bellow/above your position.
For even more complicated code, if you want to be sure that you are breaking the right blocks, you need to use yaw for combined facings:
if player's yaw is greater than 22.5:
if player's yaw is less than 67.5:
You're facing northeast i believe, not sure. All these information about pitch/yaw are in F3 menu.
It is way more complicated than you've thought, but I hope it helps and that i provided correct information. If anyone here sees something wrong, please correct me
I forgot something, so I'll add it now. Furthermore, you can use
set {_playerlocation} to player's location
then check if y's value of {_location} (block's location) is higher than {_playerlocation}+1 at y coord, meaning the block is above you and you add 1 to y, or lower than {_playerlocation}, meaning the block you mine is bellow you, and you remove 1 from y, so you don't need to go into orientation branches anymore (maybe set a different variable like a {_check} which is set as false then becomes true into those 2 ifs, then the third is if {_check} is false: means the block you mined is at your level, so you check for pitch/yaw in there)
In the end it would come along something as:
on mine:
set {_lore::*} to lore of player's tool
loop {_lore::*}:
if "%loop-value%" contains "enchant":
set {_location} to location of event-block
set {_playerlocation} to player's location
set {_check} to false
add 1 to y coord of {_playerlocation}
if y coord of {_location} is higher than y coord of {_playerlocation} (not sure if this condition works):
add 1 to y coord of {_location}
set {_check} to true
remove 1 from y coord of {_playerlocation}
if y coord of {_location} is lower than y coord of {_playerlocation}:
remove 1 from y coord of {_location}
set {_check} to true
if {_check} is false:
if player's facing is west:
remove 1 from x coord of {_location}
else if player's facing is east:
add 1 to x coord of {_location}
else if player's facing is north:
remove 1 from z coord of {_location}
else if player's facing is south:
add 1 to z coord of {_location}
loop all blocks around {_location} in radius 2:
if loop-block is not bedrock:
give player loop-block
set loop-block to air
stop
```I'm not sure the conditions are gonna work, or if the orientations will without checking for yaw (northeast, northwest, southeast, southwest). Also, I did the +1 to Y of player's location because i believe it pulls the location of the block at your feet, and you want to get if it's above your head (might need 1.5). Try it for yourself, and add those conditions if necessary and check that the coordinates are correct.
Or, the easy way out, get rid of all if's, but then it wouldnt really be 3x3x3,but 3x3x2
That's spoonfeeding code
The checks are better if you mine in a straight line, since it basically mines a 3x3x3 around the block after the one you mine, the one you can't see, so it basically mines more blocks. Useful if you mine underground in a straight line (survival) or in a mine (prison). However, the most time-efficient code is the other one without checks, which mines 3x3x3 straight from the block you mined. Your choice, i put them both so you can choose whatever you see best to fit for you
I'd suggest you to read everything I've said so you can understand working with coordinates in skript.
@void temple here my working skript for it please give credit and enjoy
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Sorry I had to paste in paste bin as the file is to big and I’m on mobile
Thanks bro enjoy lmk if there’s errors but I doubt it as I tested it a few weeks ago, only thing is that it can break region protected blocks and I don’t know how to fix that so if you do end up finding out how lmk please
Ok thanks 🙏
