Sugarcane and bamboo crop regen

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

Iroh

New Member
Apr 8, 2022
9
0
1
25
Versions and addons:
Skript for Paper 2.6.1
SkDragon
skript-reflect
SkBee
SkriptGUI
SkQuery
SkRayfall
Skream
Minecraft 1.17.1

So i had this problem a while ago where I couldn't figure out a good skript to regenerate bamboo and sugarcane because breaking the bottom crop automatically breaks the others.
I came up with this but it is insanely long so I was wondering if there were better solutions.


Code:
on break of sugar cane:
  if "%region at player%" contains "spawn":
    cancel event
    if block above event-block is sugar cane:
      break block above event-block
      if block 2 above event-block is sugar cane:
        break block 2 above event-block
        if block 3 above event-block is sugar cane:
          break block 3 above event-block
          if block 4 above event-block is sugar cane:
            break block 4 above event-block
            if block 5 above event-block is sugar cane:
              break block 5 above event-block
              if block 6 above event-block is sugar cane:
                break block 6 above event-block
                wait 20 seconds
                set block above event-block to sugar cane
                set block 2 above event-block to sugar cane
                set block 3 above event-block to sugar cane
                set block 4 above event-block to sugar cane
                set block 5 above event-block to sugar cane
                set block 6 above event-block to sugar cane
              else:
                wait 20 seconds
                set block above event-block to sugar cane
                set block 2 above event-block to sugar cane
                set block 3 above event-block to sugar cane
                set block 4 above event-block to sugar cane
                set block 5 above event-block to sugar cane
            else:
              wait 20 seconds
              set block above event-block to sugar cane
              set block 2 above event-block to sugar cane
              set block 3 above event-block to sugar cane
              set block 4 above event-block to sugar cane
          else:
            wait 20 seconds
            set block above event-block to sugar cane
            set block 2 above event-block to sugar cane
            set block 3 above event-block to sugar cane
        else:
          wait 20 seconds
          set block above event-block to sugar cane
          set block 2 above event-block to sugar cane
      else:
        wait 20 seconds
        set block above event-block to sugar cane
 
Status
Not open for further replies.