How to fill chunks with flowing water

Discussion in 'Plugin Development' started by ixilon, Nov 17, 2020.

Thread Status:
Not open for further replies.
  1. I'm using

    import org.bukkit.Material;
    import org.bukkit.generator.ChunkGenerator.ChunkData;

    ChunkData chunkData = ...
    chunkData.setBlock(x, y, z, Material.WATER);

    to fill chunks with water blocks. But these blocks of water do not begin to flow when they are surrounded by air.

    How to create flowing water?

    Thanks!
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. What function do I have to use to update the block?

    Do you mean the BlockState.update() function?

    I can't get BlockState from ChunkData, only Material, MaterialData and BlockData.

    Do I have to catch an event to update the block?
     
    Last edited: Nov 17, 2020
  4. Offline

    timtower Administrator Administrator Moderator

    @ixilon Why are you using ChunkData then?
     
  5. Offline

    marcelo.mb

    @ixilon
    If you are not familiar with ChunkData I would rather than use a BlockList.
    • Create a cube with two corner points. (There is a very nice class to use: Cuboid. https://www.spigotmc.org/threads/region-cuboid.329859/)
    • With the method getBlocks() you get the BlockList returned.
    • Then loop through this BlockList and set every Material type of every block to water.
     
Thread Status:
Not open for further replies.

Share This Page