1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Block location next to block in all directions?

Discussion in 'Skript' started by JustADev, Sep 12, 2017.

Thread Status:
Not open for further replies.
  1. JustADev

    JustADev Well-Known Member

    Joined:
    Apr 8, 2017
    Messages:
    380
    Likes Received:
    9
    Plugins:
    SkQuery
    Skript 2.2
    SkDragon
    Umbaska

    Version;
    Spigot 1.8

    Question:
    How do I make it so that when emerald ore is placed in a cross like this:
    Key: x = air o = ore
    xox
    ooo
    xox
    that the blocks are removed and an enderchest spawns in the middle?

     
  2. Best Answer:
    Post #3 by ShaneBee, Sep 12, 2017
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,181
    Likes Received:
    220
    With a little bit of brain.

    A pinch of logic.

    A slice of hard work

    And too top it all of, cooked in a hot pre-heated oven at 200 degrees, it'll indeed produce what you're looking for.
     
    • Like Like x 1
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,181
    Likes Received:
    220
    I think it can be smaller but i couldn't it works tho

    Code (Skript):
    1. function middlecheck(loc: location) :: boolean:
    2.     set {_found} to 0
    3.     loop all blocks in radius 1 around {_loc}:
    4.         loop-block is emerald ore
    5.         if y-coordinate of loop-block = y-coordinate of {_loc}:
    6.             add 1 to {_found}
    7.     if {_found} = 5:
    8.         loop all blocks in radius 1 around {_loc}:
    9.             loop-block is emerald ore
    10.             if y-coordinate of loop-block = y-coordinate of {_loc}:
    11.                 set loop-block to air
    12.         set block at {_loc} to a ender chest
    13.         return true
    14.     else:
    15.         return false
    16.        
    17. on place of emerald ore:
    18.     set {_check} to middlecheck(location of event-block)
    19.     if {_check} is true:
    20.         stop
    21.     if block north of event-block is emerald ore:
    22.         set {_check} to middlecheck(location of block north of event-block)
    23.         if {_check} is true:
    24.             stop
    25.     if block east of event-block is emerald ore:
    26.         set {_check} to middlecheck(location of block east of event-block)
    27.         if {_check} is true:
    28.             stop
    29.     if block south of event-block is emerald ore:
    30.         set {_check} to middlecheck(location of block south of event-block)
    31.         if {_check} is true:
    32.             stop
    33.     if block west of event-block is emerald ore:
    34.         set {_check} to middlecheck(location of block west of event-block)
    35.         if {_check} is true:
    36.             stop
     
Thread Status:
Not open for further replies.

Share This Page

Loading...