Solved Farming skript

  • 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.

kays

New Member
Jul 15, 2017
9
2
3
28
Skript Version: Skript 2.2 dev33
Skript Author: Bensku
Minecraft Version: 1.12.2

I'm trying to create a unique farming skript. Where plants growth by it self but I don't know how to make it so when player break that specific block the plant stop growing. I know my problem but I have no clue how to write it

Here is my take and it works but when break the blocks still growth because of tick. :3 anyways I can stop it when a person break??
code_language.skript:
on rightclick on soil:
    if name of tool of player is "&aCucumber Seed":
        remove 1 of event-item from player
        if block above is air:
            wait 10 tick
            set block above to crops
            wait 20 tick
            set block above to crops:1
            wait 20 tick
            set block above to crops:2
            wait 20 tick
            set block above to crops:3
            wait 20 tick
            set block above to crops:4
            wait 20 tick
            set block above to crops:5
            wait 20 tick
            set block above to crops:6
            wait 20 tick
            set block above to crops:7
            wait 20 tick
            set block above to fern

on break of crops:0-6:
    if block below event-block is farmland:
        cancel event
 
Here's something that should fix that and also make it more efficient. If you want to make it slower it wlll be a lot easier, and if the server restarts in the middle of growing it should pick up where it left off.

code_language.skript:
on rightclick on soil:
    if name of player's tool is "&aCucumber Seed":
        if block above clicked block is air:
            remove 1 of player's tool from player
            add location above clicked block to {cucumbers::*}
            set block above clicked block to crops

every 20 ticks:
    loop {cucumbers::*}:
        if block at loop-value is crops:    # This checks to see if it has been harvested
            if data value of block at loop-value is greater than 6:
                set block at loop-value to fern
            else:
                add 1 to data value of block at loop-value    # The data value is the grow state in the case of crops
        else:
            remove loop-value from {cucumbers::*}
            # Deletes the cucumber location variable if harvested or full grown

on break of crops:0-6:
    if block below event-block is farmland:
        cancel event
 
is there a way to add tags on the block fern so when I break the fern block with certain NBT tags it drop certains thing. :O I tried add nbt "{Tags:"Cucumber"}" to event-block but not working.
[doublepost=1519582077,1519577739][/doublepost]I figured it out ":emoji_grinning:
 
  • Like
Reactions: Gladrian
Status
Not open for further replies.