Solved Block location next to block in all directions?

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

JustADev

Well-Known Member
Apr 8, 2017
379
9
18
22
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?
 
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?

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
Reactions: Pikachu
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?

I think it can be smaller but i couldn't it works tho

code_language.skript:
function middlecheck(loc: location) :: boolean:
    set {_found} to 0
    loop all blocks in radius 1 around {_loc}:
        loop-block is emerald ore
        if y-coordinate of loop-block = y-coordinate of {_loc}:
            add 1 to {_found}
    if {_found} = 5:
        loop all blocks in radius 1 around {_loc}:
            loop-block is emerald ore
            if y-coordinate of loop-block = y-coordinate of {_loc}:
                set loop-block to air
        set block at {_loc} to a ender chest
        return true
    else:
        return false
        
on place of emerald ore:
    set {_check} to middlecheck(location of event-block)
    if {_check} is true:
        stop
    if block north of event-block is emerald ore:
        set {_check} to middlecheck(location of block north of event-block)
        if {_check} is true:
            stop
    if block east of event-block is emerald ore:
        set {_check} to middlecheck(location of block east of event-block)
        if {_check} is true:
            stop
    if block south of event-block is emerald ore:
        set {_check} to middlecheck(location of block south of event-block)
        if {_check} is true:
            stop
    if block west of event-block is emerald ore:
        set {_check} to middlecheck(location of block west of event-block)
        if {_check} is true:
            stop
 
Status
Not open for further replies.