Solved FAWE Block Distribution (Types)

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

AsuDev

VIP
Jan 27, 2017
241
22
18
24
United States
Note: I am not using and I will not use Skematic or FaweSK. So do not mention it.

I am trying to get the types of blocks in a region, but I am not sure how. Right now I have this function:
code_language.skript:
function getBlocksInRegion(pos1: location, pos2: location) :: objects:
    set {_session} to getEditSession(world of {_pos1})
    set {_blocks} to {_session}.getBlockDistributionWithData(getRegion({pos1}, {pos2}))
    loop ...{_blocks}:
 
        broadcast "%loop-value%"
        set {_block} to ?

        #add {_block} to {_return::*}
    return {_return::*}
I am trying to figure out how to parse the loop-value as a block but haven't found a solution yet... Here is the current output of loop-value:
Capture.PNG

This should be stone, as the region is only made of stone in this example. If I were to add multiple types of blocks, they would also be like this, just with different ids.

If someone has a solution for how to parse this as an itemtype or block that would be great..
 
Note: I am not using and I will not use Skematic or FaweSK. So do not mention it.

I am trying to get the types of blocks in a region, but I am not sure how. Right now I have this function:
code_language.skript:
function getBlocksInRegion(pos1: location, pos2: location) :: objects:
    set {_session} to getEditSession(world of {_pos1})
    set {_blocks} to {_session}.getBlockDistributionWithData(getRegion({pos1}, {pos2}))
    loop ...{_blocks}:
 
        broadcast "%loop-value%"
        set {_block} to ?

        #add {_block} to {_return::*}
    return {_return::*}
I am trying to figure out how to parse the loop-value as a block but haven't found a solution yet... Here is the current output of loop-value:
View attachment 3899
This should be stone, as the region is only made of stone in this example. If I were to add multiple types of blocks, they would also be like this, just with different ids.

If someone has a solution for how to parse this as an itemtype or block that would be great..
You need to use `loop-value.getID()`, which should return BlockState (com.sk89q.worldedit.world.block.BlockState).
Then you can use `BlockState#getBlockType()` to get the the block type
 
Status
Not open for further replies.