[QUESTION] How to check all blocks in a world?

Discussion in 'Plugin Development' started by ElConquistador, Jul 23, 2011.

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

    ElConquistador

    Hello,
    I want to make a plugin that removes all ores in a world. But I need a block list or something that checks all blocks whether they are ores or not.
    ElConquistador
     
  2. Offline

    loganwm

  3. Offline

    ElConquistador

    But I want a plugin that removes all ores from a existing world, not a new one.
     
  4. Offline

    bergerkiller

    I guess this is more a task for external programs like MCedit. This, because you would need to load the entire world before you can modify -everything-. This would raise the RAM for very large worlds and would be slower because of connected clients and handling physics updates in this entire world. Also, the risk exists that chunks get unloaded before you modify it, which would require a chunk unload listener as well.

    If you are stubborn, look into World.getLoadedChunks and use the x/z coordinates to loop through all of the 16x16x128 blocks. Note: this is 9x9x16x16x128 = 2654208 blocks when your server has fully loaded all chunks around a single player. In WorldEdit this set operation took around 30 mins. You'd be better off using //replace multiple times. :)
     
  5. Offline

    Supersam654

    Although I can see practical purposes for this, it just isn't feasible. First of all, removing ores from non-loaded chunks is very difficult and possibly not possible. The next issue, that @bergerkiller pointed out, is that this is a very resource intensive operation. Even if you could get this to successfully work, there would be a huge load on the server whenever someone explores un-"removed" chunks.

    I guess if you really wanted this to work, you would need to keep a list of all the chunks that are resource free and limit your world size to a fixed area. Then you just need to make sure the server is empty and manually load all of the chunks (by logging in and walking around). However, this seems very complicated compared with @loganwm 's idea that you just remove the ore populator from a new world when it is generated.
     
  6. Offline

    ElConquistador

    @bergerkiller
    I tried to modify my world using MCEdit, but it crashes when i want to save the world.
    And if I use WorldEdit, how can I select my hole world?
     
  7. Offline

    bergerkiller

    You will never be able to select the whole world, since for selections you need to select a cuboid. (Left and right-click with a wooden axe on a block, in your case one selection of bedrock, the other high in the air)
    Best is to start off with a populator plugin to stop the generation of new ores, I bet those plugins already exist.
     
Thread Status:
Not open for further replies.

Share This Page