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 FAWE Block Distribution (Types)

Discussion in 'Skript' started by AsuDev, Oct 26, 2019.

Tags:
Thread Status:
Not open for further replies.
  1. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    243
    Likes Received:
    21
    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 (Skript):
    1. function getBlocksInRegion(pos1: location, pos2: location) :: objects:
    2.     set {_session} to getEditSession(world of {_pos1})
    3.     set {_blocks} to {_session}.getBlockDistributionWithData(getRegion({pos1}, {pos2}))
    4.     loop ...{_blocks}:
    5.  
    6.         broadcast "%loop-value%"
    7.         set {_block} to ?
    8.  
    9.         #add {_block} to {_return::*}
    10.     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..
     
  2. Best Answer:
    Post #2 by TPGamesNL, Oct 27, 2019
  3. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    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
     
Thread Status:
Not open for further replies.

Share This Page

Loading...