How to add fortune and silk touch to my auto pickup?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

ItzSulf

New Member
Jul 15, 2022
7
0
1
21
Basically i want every block to be auto picked up when broken. This is the first skript i tried then realized fortune nor silk touch works with this. i know why im jsut not sure how to implement it.
Code:
on block break:

    if player's gamemode is not creative:
        if player has permission "block.tp":
            cancel event
            set block to air
            give drops of event-block to player

code i've tried before realizing i only want fortune working only on ores like in vanilla mc.
Code:
on block break:
    if player's gamemode is not creative:
        if player has permission "block.tp":
            cancel event
            set {_amount} to 1
            if player's tool is enchanted with fortune 1:
            chance of 33%:
            set {_amount} to 2
            if player's tool is enchanted with fortune 2:
            chance of 25%:
            set {_amount} to 2
            chance of 25%:
            set {_amount} to 3
            if player's tool is enchanted with fortune 3:
            chance of 20%:
            set {_amount} to 2
            chance of 20%:
            set {_amount} to 3
            chance of 20
            set {_amount} to 4
            give {_amount} of event-block to player

The problem is the blocks dont drop after broken. I need only want fortune to work like vanilla and i need to add silk touch compability.

Yes ive searched around and used the docs still no luck.
 
Just asking, why cancel the event if you're setting the block to air anyways? Also the event-block is far from the drops (ores, grass, etc.)

You can just use the

%blocks%'s drops [(using|with) %itemtype% [(as %entity%)]]

for example


Code:
on mine:
    if player's gamemode is not creative:
        if player has permission "block.tp":
            give drops of event-block using player's tool to player
            cancel drops
 
Status
Not open for further replies.