Looping Through Loaded Chunks

Discussion in 'Plugin Development' started by BurnerDiamond, Mar 3, 2015.

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

    BurnerDiamond

    Basically I'm making a Combat Tag plugin.

    Basically I need to do multiple things.

    1. Need to loop through all loaded chunks and check if sponge is at -1, (under bedrock).

    2. If so make a wall out of cobble reaching into y = 150, this will be done using p.sendBlockChange();

    3. Once the combat tag is over, remove the sendBlockChange();

    How do I loop through the loaded chunks and check if at -1y or under bedrock is sponge? And then do the rest?
     
  2. Offline

    1Rogue

    For a combat tag plugin? Why?
     
  3. Offline

    BurnerDiamond

    @1Rogue

    It was a friends request so I just decided to try it out.
     
  4. Offline

    1Rogue

    I mean what is the point of sending all these block changes to a player who isn't even online.
     
  5. Offline

    BurnerDiamond

    @1Rogue

    Sorry this will be done for a combat tag plugin, it will be sent to the damaged and reciever, which will be online. This is basically looping through the chunks, looking for any sponge blocks. Send a block change for walls which will pillar up to y = 100.
     
  6. Offline

    1Rogue

    Thought it was 150?

    So if one player logs off, you're going to send a block change for every single chunk that has a sponge in it? If you're making a wall around the chunk, the player isn't even going to see farther than the chunk they're in...

    Additionally I don't get the point of making someone who is killing another that logged off think they're trapped. The whole point behind combat tagging is that players who log off to avoid combat can still be killed. What benefit is trapping an attacker?
     
  7. Offline

    BurnerDiamond

    @1Rogue

    The sponge is used to enclose the pop free zone.

    Basically so the player can't enter it.

    No point in questioning the logic, he just thought it would look cool, that's it.

    Edit: I see the logic of your question now.

    When a player combat tags another I don't want them to be able to go into a pvp free zone.

    Each sponge block that is under bedrock, when found, will sendBlockChange to both the attacker and the reciever.

    Basically if a sponge is at 34, -1, 56... It will make a straight line replacing all air blocks at 34, 56 and will set all air blocks to glass.
     
    Last edited: Mar 3, 2015
  8. Offline

    1Rogue

    In that case just get the current chunk, iterate over the bedrock and look for sponges. Then for each sponge iterate upwards to 150, replacing any air found. Do note that you'll also have to make sure no players break those sponges.
     
  9. Offline

    Konato_K

    @BurnerDiamond If you actually do that you'll end up with a really weird plugin (also I believe sending that many block changes may cause FPS drops to some clients).

    Anyway, you can't have blocks under y0
     
  10. Offline

    BurnerDiamond

    @1Rogue

    Is it possible to place sponges under the bedrock?
     
  11. Offline

    1Rogue

    No.

     
  12. Offline

    BurnerDiamond

    @1Rogue

    I know you can place blocks under 0. But you can't check if they're there.

    Do you think an easy solution would be setting them at y =256

    Actually how do I loop through all the blocks in a chunk if it's a sponge?

    EDIT by Timtower: merged posts
     
    Last edited by a moderator: Mar 4, 2015
Thread Status:
Not open for further replies.

Share This Page